def __check_cloud_service_in_db(self, context):
     # check whether cloud service created by azure formation before
     if contain_azure_cloud_service(context.name):
         m = '%s [%s] exist and created by %s before' % (AZURE_RESOURCE_TYPE.CLOUD_SERVICE,
                                                         context.name,
                                                         AZURE_FORMATION)
         commit_azure_log(context.experiment_id, ALOperation.CREATE_CLOUD_SERVICE, ALStatus.END, m, 1)
     else:
         m = '%s [%s] exist but not created by %s before' % (
         AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name, AZURE_FORMATION)
         commit_azure_cloud_service(context.name, context.label,
                                    context.location,
                                    ACSStatus.CREATED,
                                    context.experiment_id)
         commit_azure_log(context.experiment_id, ALOperation.CREATE_CLOUD_SERVICE, ALStatus.END, m, 2)
     self.log.debug(m)
 def __check_exist_after_creation(self, context):
     if not self.azure_adapter.cloud_service_exists(context.azure_key_id, context.name):
         m = '%s [%s] created but not exist' % (AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name)
         commit_azure_log(context.experiment_id, ALOperation.CREATE_CLOUD_SERVICE, ALStatus.FAIL, m, 3)
         self.log.error(m)
         return False
     else:
         m = '%s [%s] created' % (AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name)
         commit_azure_cloud_service(context.name,
                                    context.label,
                                    context.location,
                                    ACSStatus.CREATED,
                                    context.experiment_id)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_CLOUD_SERVICE,
                          ALStatus.END, m, 0)
         self.log.debug(m)
 def __check_cloud_service_in_db(self, context):
     # check whether cloud service created by azure formation before
     if contain_azure_cloud_service(context.name):
         m = '%s [%s] exist and created by %s before' % (
             AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name,
             AZURE_FORMATION)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_CLOUD_SERVICE, ALStatus.END, m,
                          1)
     else:
         m = '%s [%s] exist but not created by %s before' % (
             AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name,
             AZURE_FORMATION)
         commit_azure_cloud_service(context.name, context.label,
                                    context.location, ACSStatus.CREATED,
                                    context.experiment_id)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_CLOUD_SERVICE, ALStatus.END, m,
                          2)
     self.log.debug(m)
 def __check_exist_after_creation(self, context):
     if not self.azure_adapter.cloud_service_exists(context.azure_key_id,
                                                    context.name):
         m = '%s [%s] created but not exist' % (
             AZURE_RESOURCE_TYPE.CLOUD_SERVICE, context.name)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_CLOUD_SERVICE, ALStatus.FAIL,
                          m, 3)
         self.log.error(m)
         return False
     else:
         m = '%s [%s] created' % (AZURE_RESOURCE_TYPE.CLOUD_SERVICE,
                                  context.name)
         commit_azure_cloud_service(context.name, context.label,
                                    context.location, ACSStatus.CREATED,
                                    context.experiment_id)
         commit_azure_log(context.experiment_id,
                          ALOperation.CREATE_CLOUD_SERVICE, ALStatus.END, m,
                          0)
         self.log.debug(m)