def GenerateDownloadPreprovisionedDataCommand(install_path, module_name, filename): """Returns a string used to download preprovisioned data.""" module_name_with_underscores_removed = module_name.replace('_', '-') destpath = posixpath.join(install_path, filename) # TODO(ferneyhough): Refactor this so that this mkdir command # is run on all clouds, and is os-agnostic (this is linux specific). mkdir_command = 'mkdir -p %s' % posixpath.dirname(destpath) account_name = FLAGS.azure_preprovisioned_data_bucket connection_string = util.GetAzureStorageConnectionString(account_name, []) download_command = ( 'az storage blob download ' '--no-progress ' '--account-name {account_name} ' '--container-name {container_name} ' '--name {name} ' '--file {file} ' '--connection-string "{connection_string}"'.format( account_name=account_name, container_name=module_name_with_underscores_removed, name=filename, file=destpath, connection_string=connection_string)) return '{0} && {1}'.format(mkdir_command, download_command)
def _PostCreate(self): """Get our connection string and our keys.""" self.connection_string = util.GetAzureStorageConnectionString( self.name, self.resource_group.args) self.connection_args = ['--connection-string', self.connection_string] self.key = util.GetAzureStorageAccountKey(self.name, self.resource_group.args)
def GenerateStatPreprovisionedDataCommand(module_name, filename): """Returns a string used to download preprovisioned data.""" module_name_with_underscores_removed = module_name.replace('_', '-') account_name = FLAGS.azure_preprovisioned_data_bucket connection_string = util.GetAzureStorageConnectionString(account_name, []) return ('az storage blob show ' '--account-name {account_name} ' '--container-name {container_name} ' '--name {name} ' '--connection-string "{connection_string}"'.format( account_name=account_name, container_name=module_name_with_underscores_removed, name=filename, connection_string=connection_string))