Beispiel #1
0
 def __init__(self, name, environment='', env_sample_file='', timeout_seconds=None, version=None,
              build_args=None, dockerfile=None, ssh=None, cache_from=None,
              deployment_identifier=None, working_dir='.'):
     self.name = name
     self.environment = environment
     self.deployment_identifier = deployment_identifier
     self.env_sample_file = env_sample_file
     self.timeout_seconds = timeout_seconds
     self.version = version
     self.ecr_client = boto3.session.Session(region_name=self.region).client('ecr')
     self.cluster_name = get_cluster_name(environment)
     self.service_configuration = ServiceConfiguration(service_name=name, environment=environment).get_config()
     self.service_info_fetcher = ServiceInformationFetcher(self.name, self.environment, self.service_configuration)
     if not self.service_info_fetcher.stack_found:
         raise UnrecoverableException(
             "error finding stack in ServiceUpdater: {}-{}".format(self.name, self.environment))
     ecr_repo_config = self.service_configuration.get('ecr_repo')
     self.ecr = ECR(
         self.region,
         ecr_repo_config.get('name', spinalcase(self.name + '-repo')),
         ecr_repo_config.get('account_id', get_account_id()),
         ecr_repo_config.get('assume_role_arn', None),
         version,
         build_args,
         dockerfile,
         working_dir,
         ssh,
         cache_from
     )
Beispiel #2
0
 def __init__(self, name, environment):
     self.name = name
     self.environment = environment
     self.cluster_name = get_cluster_name(environment)
     self.ecs_client = get_client_for('ecs', self.environment)
     self.ec2_client = get_client_for('ec2', self.environment)
     self.init_stack_info()
 def __init__(self, name, environment, service_configuration):
     self.name = name
     self.environment = environment
     self.cluster_name = get_cluster_name(environment)
     self.cfn_client = get_client_for('cloudformation', self.environment)
     self.service_configuration = service_configuration
     self.service_info = {}
     self.init_stack_info()
 def __init__(self, environment):
     self.environment = environment
     environment_configuration = EnvironmentConfiguration(
         self.environment
     )
     environment_configuration.update_config()
     self.configuration = environment_configuration.get_config()[self.environment]
     self.cluster_name = get_cluster_name(environment)
     self.client = get_client_for('cloudformation', self.environment)
 def _get_environment_stack(self):
     try:
         cfn_client = get_client_for('cloudformation', self.env)
         environment_stack = cfn_client.describe_stacks(
             StackName=get_cluster_name(self.env)
         )['Stacks'][0]
     except ClientError:
         return None
     return environment_stack
Beispiel #6
0
    def _get_environment_stack(self):
        try:
            log("Looking for " + self.environment + " cluster.")
            environment_stack = self.client.describe_stacks(
                StackName=get_cluster_name(self.environment))['Stacks'][0]
            log_bold(self.environment + " stack found. Using stack with ID: " +
                     environment_stack['StackId'])
        except ClientError:
            log_err(self.environment +
                    " cluster not found. Create the environment \
cluster using `create_environment` command.")
            exit(1)
        return environment_stack
Beispiel #7
0
 def __init__(self, name, environment, env_sample_file, version=None,
              build_args=None, working_dir='.'):
     self.name = name
     self.environment = environment
     if env_sample_file is not None:
         self.env_sample_file = env_sample_file
     else:
         self.env_sample_file = './env.sample'
     self.version = version
     self.ecr_client = boto3.session.Session(region_name=self.region).client('ecr')
     self.cluster_name = get_cluster_name(environment)
     self.working_dir = working_dir
     self.build_args = build_args
 def __init__(self, env):
     self.template = Template()
     self.env = env
     self.cluster_name = get_cluster_name(env)