示例#1
0
    def validate_deployment_group(self):
        dgp = self._resource_names['deployment_group_name']
        service = self._resource_names['service']
        service_arn = self._resource_names['service_arn']
        cluster = self._resource_names['cluster']
        cluster_arn = self._resource_names['cluster_arn']

        grp_info = self.deployment_group_details['deploymentGroupInfo']
        compute_platform = grp_info['computePlatform']

        if compute_platform != 'ECS':
            raise exceptions.InvalidPlatformError(resource='Deployment Group',
                                                  name=dgp)

        target_services = \
            self.deployment_group_details['deploymentGroupInfo']['ecsServices']

        # either ECS resource names or ARNs can be stored, so check both
        for target in target_services:
            target_serv = target['serviceName']
            if target_serv != service and target_serv != service_arn:
                raise exceptions.InvalidProperyError(dg_name=dgp,
                                                     resource='service',
                                                     resource_name=service)

            target_cluster = target['clusterName']
            if target_cluster != cluster and target_cluster != cluster_arn:
                raise exceptions.InvalidProperyError(dg_name=dgp,
                                                     resource='cluster',
                                                     resource_name=cluster)
示例#2
0
 def validate_application(self):
     app_name = self._resource_names['app_name']
     if self.app_details['application']['computePlatform'] != 'ECS':
         raise exceptions.InvalidPlatformError(resource='Application',
                                               name=app_name)