Exemple #1
0
    def configure(self):
        # This goes before configure because -S's absence causes
        # self.auth.configure to blow up.  With an upload policy that
        # is undesirable.
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))
        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QueryHmacV2Auth.from_other(self.auth)

        if self.args.get('url') and not self.args.get('ec2_url'):
            self.log.warn('-U/--url used without --ec2-url; communication '
                          'with different regions may result')
        if self.args.get('ec2_url') and not self.args.get('url'):
            self.log.warn('--ec2-url used without -U/--url; communication '
                          'with different regions may result')

        # Set up access to empyrean in case we need auto cert fetching.
        try:
            self.args['empyrean_service'] = \
                EmpyreanRequest.SERVICE_CLASS.from_other(
                    self.service, url=self.args.get('empyrean_url'))
            self.args['empyrean_auth'] = EmpyreanRequest.AUTH_CLASS.from_other(
                self.auth)
        except:
            self.log.debug('empyrean setup failed; auto cert fetching '
                           'will be unavailable', exc_info=True)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
Exemple #2
0
    def configure(self):
        # This goes before configure because -S's absence causes
        # self.auth.configure to blow up.  With an upload policy that
        # is undesirable.
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        # Set up access to empyrean in case we need auto cert fetching.
        try:
            self.args['empyrean_service'] = \
                EmpyreanRequest.SERVICE_CLASS.from_other(
                    self.service, url=self.args.get('empyrean_url'))
            self.args['empyrean_auth'] = EmpyreanRequest.AUTH_CLASS.from_other(
                self.auth)
        except:
            self.log.debug(
                'empyrean setup failed; auto cert fetching '
                'will be unavailable',
                exc_info=True)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
        self.generate_encryption_keys()
    def configure(self):
        S3Request.configure(self)

        # The private key could be the user's or the cloud's.  In the config
        # this is a user-level option.
        if not self.args.get('privatekey'):
            config_privatekey = self.config.get_user_option('private-key')
            if self.args.get('userregion'):
                self.args['privatekey'] = config_privatekey
            elif 'EC2_PRIVATE_KEY' in os.environ:
                self.args['privatekey'] = os.getenv('EC2_PRIVATE_KEY')
            elif config_privatekey:
                self.args['privatekey'] = config_privatekey
            else:
                raise ArgumentError(
                    'missing private key; please supply one with -k')
        self.args['privatekey'] = os.path.expanduser(os.path.expandvars(
            self.args['privatekey']))
        if not os.path.exists(self.args['privatekey']):
            raise ArgumentError("private key file '{0}' does not exist"
                                .format(self.args['privatekey']))
        if not os.path.isfile(self.args['privatekey']):
            raise ArgumentError("private key file '{0}' is not a file"
                                .format(self.args['privatekey']))
        self.log.debug('private key: %s', self.args['privatekey'])
    def configure(self):
        S3Request.configure(self)
        self.configure_bundle_upload_auth()
        self.configure_bundle_creds()
        self.configure_bundle_output()
        self.configure_bundle_properties()

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))
        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QueryHmacV2Auth.from_other(self.auth)

        if self.args.get("check_cert"):
            if not self.args.get("iam_service"):
                self.args["iam_service"] = IAMRequest.SERVICE_CLASS.from_other(
                    self.service)
            if not self.args.get("iam_auth"):
                self.args["iam_auth"] = IAMRequest.AUTH_CLASS.from_other(
                    self.auth)

        if self.args.get('url') and not self.args.get('ec2_url'):
            self.log.warn('-U/--url used without --ec2-url; communication '
                          'with different regions may result')
        if self.args.get('ec2_url') and not self.args.get('url'):
            self.log.warn('--ec2-url used without -U/--url; communication '
                          'with different regions may result')
    def configure(self):
        S3Request.configure(self)

        # The private key could be the user's or the cloud's.  In the config
        # this is a user-level option.
        if not self.args.get('privatekey'):
            config_privatekey = self.config.get_user_option('private-key')
            if self.args.get('userregion'):
                self.args['privatekey'] = config_privatekey
            elif 'EC2_PRIVATE_KEY' in os.environ:
                self.args['privatekey'] = os.getenv('EC2_PRIVATE_KEY')
            elif config_privatekey:
                self.args['privatekey'] = config_privatekey
            else:
                raise ArgumentError(
                    'missing private key; please supply one with -k')
        self.args['privatekey'] = os.path.expanduser(os.path.expandvars(
            self.args['privatekey']))
        if not os.path.exists(self.args['privatekey']):
            raise ArgumentError("private key file '{0}' does not exist"
                                .format(self.args['privatekey']))
        if not os.path.isfile(self.args['privatekey']):
            raise ArgumentError("private key file '{0}' is not a file"
                                .format(self.args['privatekey']))
        self.log.debug('private key: %s', self.args['privatekey'])
Exemple #6
0
    def configure(self):
        S3Request.configure(self)

        bucket, _, key = self.args['path'].partition('/')
        if not bucket:
            raise ArgumentError('path must contain a bucket name')
        if not key:
            raise ArgumentError('path must contain a key name')
Exemple #7
0
    def configure(self):
        S3Request.configure(self)

        bucket, _, key = self.args['path'].partition('/')
        if not bucket:
            raise ArgumentError('path must contain a bucket name')
        if not key:
            raise ArgumentError('path must contain a key name')
    def configure(self):
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
        self.generate_encryption_keys()
Exemple #9
0
    def configure(self):
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
        self.generate_encryption_keys()
    def configure(self):
        S3Request.configure(self)
        if not self.args.get('ec2_service'):
            self.args['ec2_service'] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))

        if not self.args.get('ec2_auth'):
            self.args['ec2_auth'] = QueryHmacV2Auth.from_other(self.auth)
        if not self.args.get('profile'):
            self.args['profile'] = 'default'
Exemple #11
0
    def configure(self):
        S3Request.configure(self)
        if not self.args.get('ec2_service'):
            self.args['ec2_service'] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))

        if not self.args.get('ec2_auth'):
            self.args['ec2_auth'] = QueryHmacV2Auth.from_other(self.auth)
        if not self.args.get('profile'):
            self.args['profile'] = 'default'
Exemple #12
0
 def configure(self):
     S3Request.configure(self)
     for path in self.args['paths']:
         if path.startswith('/'):
             raise ArgumentError(
                 ('argument \'{0}\' must not start with '
                  '"/"; format is BUCKET[/KEY]').format(path))
         bucket = path.split('/', 1)[0]
         try:
             validate_generic_bucket_name(bucket)
         except ValueError as err:
             raise ArgumentError('bucket "{0}": {1}'.format(
                 bucket, err.message))
Exemple #13
0
    def configure(self):
        S3Request.configure(self)
        self.configure_bundle_upload_auth()
        self.configure_bundle_creds()
        self.configure_bundle_output()
        self.configure_bundle_properties()

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))

        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QuerySigV2Auth.from_other(self.auth)
Exemple #14
0
    def configure(self):
        S3Request.configure(self)
        self.configure_bundle_upload_auth()
        self.configure_bundle_creds()
        self.configure_bundle_output()
        self.configure_bundle_properties()

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))

        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QuerySigV2Auth.from_other(self.auth)
Exemple #15
0
 def configure(self):
     S3Request.configure(self)
     for path in self.args['paths']:
         if path.startswith('/'):
             raise ArgumentError((
                 'argument \'{0}\' must not start with '
                 '"/"; format is BUCKET[/KEY]').format(path))
         bucket = path.split('/', 1)[0]
         try:
             validate_generic_bucket_name(bucket)
         except ValueError as err:
             raise ArgumentError(
                 'bucket "{0}": {1}'.format(bucket, err.message))
Exemple #16
0
    def configure(self):
        S3Request.configure(self)

        if self.args['source'] == '-':
            self.files['file'] = sys.stdin
        elif isinstance(self.args['source'], basestring):
            self.files['file'] = open(self.args['source'])
        else:
            self.files['file'] = self.args['source']
        bucket, _, key = self.args['dest'].partition('/')
        if not bucket:
            raise ArgumentError('destination bucket name must be non-empty')
        if not key:
            raise ArgumentError('destination key name must be non-empty')
Exemple #17
0
    def configure(self):
        S3Request.configure(self)

        if self.args['source'] == '-':
            self.files['file'] = sys.stdin
        elif isinstance(self.args['source'], six.string_types):
            self.files['file'] = open(self.args['source'])
        else:
            self.files['file'] = self.args['source']
        bucket, _, key = self.args['dest'].partition('/')
        if not bucket:
            raise ArgumentError('destination bucket name must be non-empty')
        if not key:
            raise ArgumentError('destination key name must be non-empty')
Exemple #18
0
 def configure(self):
     S3Request.configure(self)
     if self.args['dest'] == '-':
         self.args['dest'] = sys.stdout
         self.args['show_progress'] = False
     elif isinstance(self.args['dest'], six.string_types):
         if not os.path.exists(self.args['dest']):
             raise ArgumentError(
                 "argument -d/--directory: '{0}' does not exist"
                 .format(self.args['dest']))
         if not os.path.isdir(self.args['dest']):
             raise ArgumentError(
                 "argument -d/--directory: '{0}' is not a directory"
                 .format(self.args['dest']))
Exemple #19
0
 def configure(self):
     S3Request.configure(self)
     if self.args['dest'] == '-':
         self.args['dest'] = sys.stdout
         self.args['show_progress'] = False
     elif isinstance(self.args['dest'], basestring):
         if not os.path.exists(self.args['dest']):
             raise ArgumentError(
                 "argument -d/--directory: '{0}' does not exist".format(
                     self.args['dest']))
         if not os.path.isdir(self.args['dest']):
             raise ArgumentError(
                 "argument -d/--directory: '{0}' is not a directory".format(
                     self.args['dest']))
    def configure(self):
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
        self.generate_encryption_keys()

        if self.args.get('check_cert'):
            if not self.args.get('iam_service'):
                self.args['iam_service'] = IAMRequest.SERVICE_CLASS.from_other(
                    self.service)
            if not self.args.get('iam_auth'):
                self.args['iam_auth'] = IAMRequest.AUTH_CLASS.from_other(
                    self.auth)
Exemple #21
0
    def configure(self):
        S3Request.configure(self)
        self.configure_bundle_upload_auth()
        self.configure_bundle_creds()
        self.configure_bundle_output()
        self.configure_bundle_properties()

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))
        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QueryHmacV2Auth.from_other(self.auth)

        if self.args.get("check_cert"):
            if not self.args.get("iam_service"):
                self.args["iam_service"] = IAMRequest.SERVICE_CLASS.from_other(
                    self.service)
            if not self.args.get("iam_auth"):
                self.args["iam_auth"] = IAMRequest.AUTH_CLASS.from_other(
                    self.auth)
Exemple #22
0
 def configure(self):
     S3Request.configure(self)
     if self.args['source'] == '-':
         if self.args.get('size') is None:
             raise ArgumentError(
                 "argument --size is required when uploading stdin")
         source = _FileObjectExtent(sys.stdin, self.args['size'])
     elif isinstance(self.args['source'], basestring):
         source = _FileObjectExtent.from_filename(
             self.args['source'], size=self.args.get('size'))
     else:
         if self.args.get('size') is None:
             raise ArgumentError(
                 "argument --size is required when uploading a file object")
         source = _FileObjectExtent(self.args['source'], self.args['size'])
     self.args['source'] = source
     bucket, _, key = self.args['dest'].partition('/')
     if not bucket:
         raise ArgumentError('destination bucket name must be non-empty')
     if not key:
         raise ArgumentError('destination key name must be non-empty')
Exemple #23
0
 def configure(self):
     S3Request.configure(self)
     if self.args['source'] == '-':
         if self.args.get('size') is None:
             raise ArgumentError(
                 "argument --size is required when uploading stdin")
         source = _FileObjectExtent(sys.stdin, self.args['size'])
     elif isinstance(self.args['source'], basestring):
         source = _FileObjectExtent.from_filename(
             self.args['source'], size=self.args.get('size'))
     else:
         if self.args.get('size') is None:
             raise ArgumentError(
                 "argument --size is required when uploading a file object")
         source = _FileObjectExtent(self.args['source'], self.args['size'])
     self.args['source'] = source
     bucket, _, key = self.args['dest'].partition('/')
     if not bucket:
         raise ArgumentError('destination bucket name must be non-empty')
     if not key:
         raise ArgumentError('destination key name must be non-empty')
Exemple #24
0
    def configure(self):
        S3Request.configure(self)

        bucket, _, key = self.args['source'].partition('/')
        if not bucket:
            raise ArgumentError('source must contain a bucket name')
        if not key:
            raise ArgumentError('source must contain a key name')

        if isinstance(self.args.get('dest'), basestring):
            # If it is not a string we assume it is a file-like object
            if self.args['dest'] == '-':
                self.args['dest'] = sys.stdout
            elif os.path.isdir(self.args['dest']):
                basename = os.path.basename(key)
                if not basename:
                    raise ArgumentError("specify a complete file path with -o "
                                        "to download objects that end in '/'")
                dest_path = os.path.join(self.args['dest'], basename)
                self.args['dest'] = open(dest_path, 'w')
            else:
                self.args['dest'] = open(self.args['dest'], 'w')
    def configure(self):
        # This goes before configure because -S's absence causes
        # self.auth.configure to blow up.  With an upload policy that
        # is undesirable.
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        # Set up access to bootstrap in case we need auto cert fetching.
        try:
            self.args['bootstrap_service'] = \
                BootstrapRequest.SERVICE_CLASS.from_other(
                    self.service, url=self.args.get('bootstrap_url'))
            self.args['bootstrap_auth'] = \
                BootstrapRequest.AUTH_CLASS.from_other(self.auth)
        except ClientError:
            self.log.debug('bootstrap setup failed; auto cert fetching '
                           'will be unavailable', exc_info=True)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
        self.generate_encryption_keys()
Exemple #26
0
    def configure(self):
        # This goes before configure because -S's absence causes
        # self.auth.configure to blow up.  With an upload policy that
        # is undesirable.
        self.configure_bundle_upload_auth()

        S3Request.configure(self)

        if not self.args.get("ec2_service"):
            self.args["ec2_service"] = EC2.from_other(
                self.service, url=self.args.get('ec2_url'))
        if not self.args.get("ec2_auth"):
            self.args["ec2_auth"] = QueryHmacV2Auth.from_other(self.auth)

        if self.args.get('url') and not self.args.get('ec2_url'):
            self.log.warn('-U/--url used without --ec2-url; communication '
                          'with different regions may result')
        if self.args.get('ec2_url') and not self.args.get('url'):
            self.log.warn('--ec2-url used without -U/--url; communication '
                          'with different regions may result')

        # Set up access to empyrean in case we need auto cert fetching.
        try:
            self.args['empyrean_service'] = \
                EmpyreanRequest.SERVICE_CLASS.from_other(
                    self.service, url=self.args.get('empyrean_url'))
            self.args['empyrean_auth'] = EmpyreanRequest.AUTH_CLASS.from_other(
                self.auth)
        except:
            self.log.debug(
                'empyrean setup failed; auto cert fetching '
                'will be unavailable',
                exc_info=True)

        self.configure_bundle_creds()
        self.configure_bundle_properties()
        self.configure_bundle_output()
Exemple #27
0
 def __init__(self, **kwargs):
     S3Request.__init__(self, **kwargs)
     self.last_upload_error = None
     self._lock = threading.Lock()
Exemple #28
0
 def configure(self):
     # This goes before configure because -S's absence causes
     # self.auth.configure to blow up.  With an upload policy that
     # is undesirable.
     self.configure_bundle_upload_auth()
     S3Request.configure(self)
Exemple #29
0
 def configure(self):
     self.configure_bundle_upload_auth()
     S3Request.configure(self)
 def configure(self):
     S3Request.configure(self)
     validate_generic_bucket_name(self.args['bucket'])
Exemple #31
0
 def configure(self):
     # This goes before configure because -S's absence causes
     # self.auth.configure to blow up.  With an upload policy that
     # is undesirable.
     self.configure_bundle_upload_auth()
     S3Request.configure(self)
Exemple #32
0
 def __init__(self, **kwargs):
     S3Request.__init__(self, **kwargs)
     self.last_upload_error = None
     self._lock = threading.Lock()
Exemple #33
0
 def configure(self):
     S3Request.configure(self)
     if '/' not in self.args['path']:
         raise ArgumentError("path '{0}' must include a key name"
                             .format(self.args['path']))
Exemple #34
0
 def configure(self):
     self.configure_bundle_upload_auth()
     S3Request.configure(self)
 def configure(self):
     S3Request.configure(self)
     if self.args['numeric_output']:
         self.args['long_output'] = True
Exemple #36
0
 def configure(self):
     S3Request.configure(self)
     validate_generic_bucket_name(self.args['bucket'])
 def configure(self):
     S3Request.configure(self)
     if '/' not in self.args['path']:
         raise ArgumentError("path '{0}' must include a key name".format(
             self.args['path']))