def configure(self): WalrusRequest.configure(self) if (self.args.get('literal_dest', False) and len(self.args['sources']) != 1): # Can't explicitly specify dest file names when we're uploading # more than one thing raise ArgumentError('argument -T: only allowed with one file') if self.args['dest'].startswith('/'): raise ArgumentError('destination must begin with a bucket name')
def configure(self): self.configure_bundle_upload_auth() WalrusRequest.configure(self) self.configure_bundle_creds() self.configure_bundle_properties() self.configure_bundle_output() self.generate_encryption_keys()
def configure(self): WalrusRequest.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))
def configure(self): WalrusRequest.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))
def configure(self): WalrusRequest.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')
def configure(self): WalrusRequest.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']) else: if self.args.get('size') is None: raise ArgumentError( "argument --size is required when uploading a file object") source = _FileObjectExtent(sys.stdin, 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')
def configure(self): WalrusRequest.configure(self) validate_generic_bucket_name(self.args['bucket'])
def configure(self): WalrusRequest.configure(self) for path in self.args['paths']: if '/' not in path: raise ArgumentError("path '{0}' must include a key name")
def configure(self): WalrusRequest.configure(self) if self.args['numeric_output']: self.args['long_output'] = True
def configure(self): self.configure_bundle_upload_auth() WalrusRequest.configure(self)