예제 #1
0
    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()
예제 #2
0
    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()
예제 #3
0
class BundleAndUpload(requestbuilder.command.BaseCommand):
    DESCRIPTION = ('[Eucalyptus NC internal] Bundle and upload an image on '
                   'behalf of a user')
    ARGS = [Arg('-b', '--bucket', required=True,
                help='bucket to upload the bundle to (required)'),
            Arg('-i', '--image', required=True,
                help='file containing the image to bundle (required)'),
            # --arch's default should go away when these bugs are fixed:
            # https://eucalyptus.atlassian.net/browse/EUCA-5979
            # https://eucalyptus.atlassian.net/browse/EUCA-5980
            Arg('-r', '--arch', default='x86_64',
                help='image architecture (default: x86_64)'),
            Arg('-d', '--directory', help='''location to place the working
                directory with temporary files'''),
            Arg('--cert', metavar='FILE',
                help='''file containing the X.509 certificate to use when
                signing requests and bundling the image'''),
            Arg('--privatekey', metavar='FILE',
                help='''file containing the private key to use when signing
                requests and bundling the image'''),
            Arg('--spoof-key-id', metavar='KEY_ID',
                help='run this command as if signed by a specific access key'),
            Arg('--ec2cert', metavar='FILE',
                help="file containing the cloud's X.509 certificate"),
            Arg('--user', metavar='ACCOUNT', help="the user's account ID"),
            Arg('-c', '--upload-policy', metavar='POLICY',
                help='Base64-encoded S3 upload policy'),
            Arg('--upload-policy-signature', '--policysignature',
                dest='upload_policy_signature', metavar='SIGNATURE',
                route_to=None, help='''signature for the upload policy given
                with --upload-policy'''),
            Arg('-U', '--url', help='storage service endpoint URL'),
            Arg('--euca-auth', action='store_true', help=argparse.SUPPRESS),
            Arg('--kernel', metavar='IMAGE', help='''ID of the kernel image to
                associate with the machine bundle'''),
            Arg('--ramdisk', metavar='IMAGE', help='''ID of the ramdisk image
                to associate with the machine bundle''')]
    # Note that this is a back end service for which region support is
    # out of scope.  This isn't going to get tested with that.

    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 main(self):
        cmd = BundleImage(image=self.args['image'], arch=self.args['arch'],
                          cert=self.args['cert'],
                          privatekey=self.args['privatekey'],
                          user=self.args['user'],
                          destination=self.args.get('directory'),
                          ec2cert=self.args['ec2cert'], image_type='machine',
                          config=self.config,
                          kernel=self.args['kernel'],
                          ramdisk=self.args['ramdisk'])
        parts, manifest = cmd.main()

        cmd = UploadBundle(bucket=self.args['bucket'], manifest=manifest,
                           acl='ec2-bundle-read', config=self.config,
                           service=self.__walrus)
        manifest_loc = cmd.main()
        return manifest_loc
예제 #4
0
class BundleAndUpload(requestbuilder.command.BaseCommand):
    DESCRIPTION = ('[Eucalyptus NC internal] Bundle and upload an image on '
                   'behalf of a user')
    ARGS = [
        Arg('-b',
            '--bucket',
            required=True,
            help='bucket to upload the bundle to (required)'),
        Arg('-i',
            '--image',
            required=True,
            help='file containing the image to bundle (required)'),
        # --arch's default should go away when these bugs are fixed:
        # https://eucalyptus.atlassian.net/browse/EUCA-5979
        # https://eucalyptus.atlassian.net/browse/EUCA-5980
        Arg('-r',
            '--arch',
            default='x86_64',
            help='image architecture (default: x86_64)'),
        Arg('-d',
            '--directory',
            help='''location to place the working
                directory with temporary files'''),
        Arg('--cert',
            metavar='FILE',
            help='''file containing the X.509 certificate to use when
                signing requests and bundling the image'''),
        Arg('--privatekey',
            metavar='FILE',
            help='''file containing the private key to use when signing
                requests and bundling the image'''),
        Arg('--spoof-key-id',
            metavar='KEY_ID',
            help='run this command as if signed by a specific access key'),
        Arg('--ec2cert',
            metavar='FILE',
            help="file containing the cloud's X.509 certificate"),
        Arg('--user', metavar='ACCOUNT', help="the user's account ID"),
        Arg('-c',
            '--upload-policy',
            metavar='POLICY',
            help='Base64-encoded S3 upload policy'),
        Arg('--upload-policy-signature',
            '--policysignature',
            dest='upload_policy_signature',
            metavar='SIGNATURE',
            route_to=None,
            help='''signature for the upload policy given
                with --upload-policy'''),
        Arg('-U', '--url', help='storage service endpoint URL'),
        Arg('--euca-auth', action='store_true', help=argparse.SUPPRESS),
        Arg('--kernel',
            metavar='IMAGE',
            help='''ID of the kernel image to
                associate with the machine bundle'''),
        Arg('--ramdisk',
            metavar='IMAGE',
            help='''ID of the ramdisk image
                to associate with the machine bundle''')
    ]

    # Note that this is a back end service for which region support is
    # out of scope.  This isn't going to get tested with that.

    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 main(self):
        cmd = BundleImage(image=self.args['image'],
                          arch=self.args['arch'],
                          cert=self.args['cert'],
                          privatekey=self.args['privatekey'],
                          user=self.args['user'],
                          destination=self.args.get('directory'),
                          ec2cert=self.args['ec2cert'],
                          image_type='machine',
                          config=self.config,
                          kernel=self.args['kernel'],
                          ramdisk=self.args['ramdisk'])
        parts, manifest = cmd.main()

        cmd = UploadBundle(bucket=self.args['bucket'],
                           manifest=manifest,
                           acl='ec2-bundle-read',
                           config=self.config,
                           service=self.__walrus)
        manifest_loc = cmd.main()
        return manifest_loc