Exemplo n.º 1
0
 def test_validate_s3_location_throws_on_invalid_location(self):
     self.params.s3_location = 'invalid-s3-location'
     with self.assertRaisesRegexp(
             ValueError,
             '--{0} must specify the Amazon S3 URL format as '
             's3://<bucket>/<key>.'.format(self.arg_name)):
         validate_s3_location(self.params, self.arg_name)
Exemplo n.º 2
0
 def test_validate_s3_location_returns_bucket_key(self):
     self.params.s3_location = 's3://{0}/{1}'.format(self.bucket, self.key)
     validate_s3_location(self.params, self.arg_name)
     self.assertIn('bucket', self.params)
     self.assertEquals(self.bucket, self.params.bucket)
     self.assertIn('key', self.params)
     self.assertEquals(self.key, self.params.key)
Exemplo n.º 3
0
 def _validate_args(self, parsed_args):
     validate_s3_location(parsed_args, 's3_location')
     if parsed_args.ignore_hidden_files \
             and parsed_args.no_ignore_hidden_files:
         raise RuntimeError(
             'You cannot specify both --ignore-hidden-files and '
             '--no-ignore-hidden-files.')
     if not parsed_args.description:
         parsed_args.description = ('Uploaded by AWS CLI {0} UTC'.format(
             datetime.utcnow().isoformat()))
Exemplo n.º 4
0
 def _validate_agent_installer(self, params):
     validate_s3_location(params, 'agent_installer')
     if 'bucket' not in params:
         params.bucket = 'aws-codedeploy-{0}'.format(params.region)
     if 'key' not in params:
         params.key = 'latest/{0}'.format(params.system.INSTALLER)
         params.installer = params.system.INSTALLER
     else:
         start = params.key.rfind('/') + 1
         params.installer = params.key[start:]
Exemplo n.º 5
0
 def _validate_agent_installer(self, params):
     validate_s3_location(params, 'agent_installer')
     if 'bucket' not in params:
         params.bucket = 'aws-codedeploy-{0}'.format(params.region)
     if 'key' not in params:
         params.key = 'latest/{0}'.format(params.system.INSTALLER)
         params.installer = params.system.INSTALLER
     else:
         start = params.key.rfind('/') + 1
         params.installer = params.key[start:]
Exemplo n.º 6
0
 def _validate_args(self, parsed_args):
     validate_s3_location(parsed_args, 's3_location')
     if parsed_args.ignore_hidden_files \
             and parsed_args.no_ignore_hidden_files:
         raise RuntimeError(
             'You cannot specify both --ignore-hidden-files and '
             '--no-ignore-hidden-files.'
         )
     if not parsed_args.description:
         parsed_args.description = (
             'Uploaded by AWS CLI {0} UTC'.format(
                 datetime.utcnow().isoformat()
             )
         )
Exemplo n.º 7
0
 def test_validate_s3_location_not_present(self):
     validate_s3_location(self.params, 'unknown')
     self.assertNotIn('bucket', self.params)
     self.assertNotIn('key', self.params)