sparse-intern-71089
04/14/2020, 5:33 AMfaint-table-42725
04/14/2020, 4:13 PMbootstrap_storage_account_name is also an Output
You will want to invert where the json.dumps happens:
protected_settings=combined_output.apply(lambda lst: json.dumps({'storageAccountName': lst[0], 'storageAccountKey': lst[1]}))colossal-room-15708
04/15/2020, 12:56 AMcombined_output to a component?faint-table-42725
04/15/2020, 1:30 AMcombined_output = Output.all(install_scripts_storage_account.name, install_scripts_storage_account.primary_access_key, install_scripts_storage_blob.url) earlierfaint-table-42725
04/15/2020, 1:30 AMcolossal-room-15708
04/15/2020, 4:18 AM___main___.py , the protected_settings is in a different file, a component, so I have to pass the combined_output to the componentfaint-table-42725
04/15/2020, 5:08 AM__main__.py calls that function, you can pass it as an arg when calling that function.colossal-room-15708
04/15/2020, 6:29 AMcompute.extensions is part of the component and the combined_output is in the main.
That's what threw the error I mentioned.faint-table-42725
04/15/2020, 6:38 AMjson.dumps within the lambda?colossal-room-15708
04/15/2020, 7:04 AMstorage_information = [
install_scripts_storage_account.name,
install_scripts_storage_account.primary_access_key,
install_scripts_storage_blob.url
]
vms = Compute("vms",
ComputeArgs(
resource_group_name=resource_group.name,
vnet=network.vnet,
public_subnet_id=network.public_subnet_id,
storage_info=storage_information
)
)
`component.py`:
class ComputeArgs:
def __init__(
self,
resource_group_name: str,
vnet: network.VirtualNetwork,
public_subnet_id: str,
storage_info: list
):
self.resource_group_name = resource_group_name
self.vnet = vnet
self.public_subnet_id = public_subnet_id
self.storage_info = storage_info
compute.Extension("{0}install".format(server),
name="{0}install".format(server),
virtual_machine_id=vm.id,
publisher="Microsoft.Compute",
type="CustomScriptExtension",
type_handler_version="1.9",
auto_upgrade_minor_version=True,
settings=args.storage_info.apply(lambda lst: json.dumps({'commandToExecute': command_to_execute, 'fileUris': [args.bootstrap_file_name]})),
protected_settings=args.storage_info.apply(lambda lst: json.dumps({'storageAccountName': lst[0], 'storageAccountKey': lst[1]}))
)
This doesn't work, saying that list doesn't have an apply method.
I believe I need to do the apply in the main , which I have tried, but that never worked.colossal-room-15708
04/15/2020, 7:18 AMmain
install_extension_settings = combined_output.apply(lambda lst: json.dumps({'commandToExecute': command_to_execute, 'fileUris': [lst[2]]}))
install_extension_protected_settings = combined_output.apply(lambda lst: json.dumps({'storageAccountName': lst[0], 'storageAccountKey': lst[1]}))
Passing that over to the component. Would've liked to do this inside the component though. Seems like Outputs don't like to do that though.