def create_storage_account_async_true(self, context):
     name = context.template_unit.get_storage_account_name()
     description = context.template_unit.get_storage_account_description()
     label = context.template_unit.get_storage_account_label()
     location = context.template_unit.get_storage_account_location()
     # make sure storage account exist
     if not self.azure_adapter.storage_account_exists(
             context.azure_key_id, name):
         m = '%s [%s] created but not exist' % (
             AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, name)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.FAIL,
                          m, 4)
         self.log.error(m)
     else:
         m = '%s [%s] created' % (AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, name)
         commit_azure_storage_account(name, description, label, location,
                                      ASAStatus.ONLINE,
                                      context.experiment_id)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END,
                          m, 0)
         self.log.debug(m)
         # create cloud service
         self.scheduler.add_once(feature='azure_cloud_service',
                                 method='create_cloud_service',
                                 context=context,
                                 seconds=3)
 def __check_storage_account_in_db(self, args_context):
     # check whether storage account created by azure formation before
     if contain_azure_storage_account(args_context.name):
         m = '%s [%s] exist and created by %s before' % (AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT,
                                                         args_context.name,
                                                         AZURE_FORMATION)
         commit_azure_log(args_context.experiment_id, ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END, m, 1)
     else:
         m = '%s [%s] exist but not created by %s before' % (AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT,
                                                             args_context.name,
                                                             AZURE_FORMATION)
         commit_azure_storage_account(args_context.name,
                                      args_context.description,
                                      args_context.label,
                                      args_context.location,
                                      ASAStatus.ONLINE,
                                      args_context.experiment_id)
         commit_azure_log(args_context.experiment_id, ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END, m, 2)
     self.log.debug(m)
 def create_storage_account_async_true(self, context):
     name = context.template_unit.get_storage_account_name()
     description = context.template_unit.get_storage_account_description()
     label = context.template_unit.get_storage_account_label()
     location = context.template_unit.get_storage_account_location()
     # make sure storage account exist
     if not self.azure_adapter.storage_account_exists(context.azure_key_id, name):
         m = '%s [%s] created but not exist' % (AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, name)
         commit_azure_log(context.experiment_id, ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.FAIL, m, 4)
         self.log.error(m)
     else:
         m = '%s [%s] created' % (AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, name)
         commit_azure_storage_account(name, description, label, location, ASAStatus.ONLINE, context.experiment_id)
         commit_azure_log(context.experiment_id, ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END, m, 0)
         self.log.debug(m)
         # create cloud service
         self.scheduler.add_once(feature='azure_cloud_service',
                                 method='create_cloud_service',
                                 context=context,
                                 seconds=3)
 def __check_storage_account_in_db(self, args_context):
     # check whether storage account created by azure formation before
     if contain_azure_storage_account(args_context.name):
         m = '%s [%s] exist and created by %s before' % (
             AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, args_context.name,
             AZURE_FORMATION)
         commit_azure_log(args_context.experiment_id,
                          ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END,
                          m, 1)
     else:
         m = '%s [%s] exist but not created by %s before' % (
             AZURE_RESOURCE_TYPE.STORAGE_ACCOUNT, args_context.name,
             AZURE_FORMATION)
         commit_azure_storage_account(args_context.name,
                                      args_context.description,
                                      args_context.label,
                                      args_context.location,
                                      ASAStatus.ONLINE,
                                      args_context.experiment_id)
         commit_azure_log(args_context.experiment_id,
                          ALOperation.CREATE_STORAGE_ACCOUNT, ALStatus.END,
                          m, 2)
     self.log.debug(m)