示例#1
0
 def run_task(self,
              cluster,
              task_definition,
              count,
              started_by,
              overrides,
              launchtype='EC2',
              subnets=(),
              security_groups=(),
              public_ip=False):
     if not self.access_key_id or not self.secret_access_key:
         raise EcsConnectionError(
             u'Unable to locate credentials. Configure credentials by running "aws configure".'
         )
     if cluster == 'unknown-cluster':
         raise EcsConnectionError(
             u'An error occurred (ClusterNotFoundException) when calling the RunTask operation: Cluster not found.'
         )
     if self.deployment_errors:
         error = dict(Error=dict(Code=123, Message="Something went wrong"))
         raise ClientError(error, 'fake_error')
     return dict(tasks=[
         dict(taskArn='arn:foo:bar'),
         dict(taskArn='arn:lorem:ipsum')
     ])
示例#2
0
 def update_rule(self, cluster, rule, task_definition):
     if not self.access_key_id or not self.secret_access_key:
         raise EcsConnectionError(
             u'Unable to locate credentials. Configure credentials by running "aws configure".'
         )
     if cluster == 'unknown-cluster':
         raise EcsConnectionError(
             u'An error occurred (ClusterNotFoundException) when calling the RunTask operation: Cluster not found.'
         )
示例#3
0
 def register_task_definition(self, family, containers, volumes, role_arn,
                              execution_role_arn, additional_properties):
     if not self.access_key_id or not self.secret_access_key:
         raise EcsConnectionError(
             u'Unable to locate credentials. Configure credentials by running "aws configure".'
         )
     return deepcopy(RESPONSE_TASK_DEFINITION_2)
示例#4
0
 def describe_task_definition(self, task_definition_arn):
     if not self.access_key_id or not self.secret_access_key:
         raise EcsConnectionError(
             u'Unable to locate credentials. Configure credentials by running "aws configure".'
         )
     if task_definition_arn in RESPONSE_TASK_DEFINITIONS:
         return deepcopy(RESPONSE_TASK_DEFINITIONS[task_definition_arn])
     raise UnknownTaskDefinitionError('Unknown task definition arn: %s' %
                                      task_definition_arn)