def configure(self): requestbuilder.command.BaseCommand.configure(self) add_bundle_creds(self.args, self.config) walrus_auth = EucaRsaV2Auth( config=self.config, loglevel=self.log.level, cert=self.args.get('cert'), privatekey=self.args.get('privatekey'), spoof_key_id=self.args.get('spoof_key_id')) self.__walrus = NCInternalWalrus(auth=walrus_auth, config=self.config, loglevel=self.log.level, url=self.args.get('url')) self.__walrus.configure()
def configure(self): EuStoreRequest.configure(self) set_userregion(self.config, self.args.get('userregion')) if self.args.get('kernel_type'): # Use it and complain self.args['hypervisor'] = self.args['kernel_type'] msg = ('argument -k/--kernel-type is deprecated; use --hypervisor ' 'instead') self.log.warn(msg) print >> sys.stderr, 'warning:', msg # Get bundle creds first add_bundle_creds(self.args, self.config) if not self.args.get('cert'): raise ArgumentError( 'missing certificate; please supply one with -c') self.log.debug('certificate: %s', self.args['cert']) if not self.args.get('privatekey'): raise ArgumentError( 'missing private key; please supply one with --privatekey') self.log.debug('private key: %s', self.args['privatekey']) if not self.args.get('ec2cert'): raise ArgumentError( 'missing cloud certificate; please supply one with --ec2cert') self.log.debug('cloud certificate: %s', self.args['ec2cert']) if not self.args.get('user'): raise ArgumentError( 'missing account ID; please supply one with --user') self.log.debug('account ID: %s', self.args['user']) # Set up the web services -- we're going to use them a lot query_auth = QuerySigV2Auth(self.config, key_id=self.args.get('key_id'), secret_key=self.args.get('secret_key')) self.__euare = Euare(self.config, loglevel=self.log.level, auth=copy.copy(query_auth), url=self.args.get('iam_url')) self.log.debug('configuring euare service') self.__euare.configure() self.__eucalyptus = Eucalyptus(self.config, loglevel=self.log.level, auth=copy.copy(query_auth), url=self.args.get('ec2_url')) self.log.debug('configuring eucalyptus service') self.__eucalyptus.configure() s3_auth = S3RestAuth(self.config, key_id=self.args.get('key_id'), secret_key=self.args.get('secret_key')) self.__walrus = Walrus(self.config, loglevel=self.log.level, auth=s3_auth, url=self.args.get('s3_url')) self.__walrus.configure() # Check other args next if self.args.get('tarball'): if not self.args.get('architecture'): raise ArgumentError('argument -a/--architecture is required ' 'when -t/--tarball is used') if not self.args.get('hypervisor'): raise ArgumentError('argument --hypervisor is required when ' '-t/--tarball is used') self.args['tarball'] = os.path.expanduser(os.path.expandvars( self.args['tarball'])) if not os.path.exists(self.args['tarball']): raise ArgumentError("tarball file '{0}' does not exist" .format(self.args['tarball'])) if not os.path.isfile(self.args['tarball']): raise ArgumentError("tarball file '{0}' is not a file" .format(self.args['tarball'])) if self.args.get('kernel') and not self.args.get('ramdisk'): raise ArgumentError('argument --kernel: --ramdisk is required') if self.args.get('ramdisk') and not self.args.get('kernel'): raise ArgumentError('argument --ramdisk: --kernel is required') if self.args.get('image') and self.args.get('architecture'): self.log.warn("downloaded image's architecture may be overridden")