Example #1
0
    def register(self, subparsers, parsed_config):
        self.config = parsed_config
        encrypt_gce_image_parser = subparsers.add_parser(
            'encrypt-gce-image',
            description='Create an encrypted GCE image from an existing image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )

        # Migrate any config options if there were set
        project = parsed_config.get_option('%s.project' % (self.name(),))
        if project:
            parsed_config.set_option('gce.project', project)
            parsed_config.unset_option('%s.project' % (self.name(),))

        network = parsed_config.get_option('%s.network' % (self.name(),))
        if network:
            parsed_config.set_option('gce.network', network)
            parsed_config.unset_option('%s.network' % (self.name(),))

        subnetwork = parsed_config.get_option('%s.subnetwork' % (self.name(),))
        if subnetwork:
            parsed_config.set_option('gce.subnetwork', subnetwork)
            parsed_config.unset_option('%s.subnetwork' % (self.name(),))

        zone = parsed_config.get_option('%s.zone' % (self.name(),))
        if zone:
            parsed_config.set_option('gce.zone', zone)
            parsed_config.unset_option('%s.zone' % (self.name(),))
        if project or network or subnetwork or zone:
            parsed_config.save_config()

        encrypt_gce_image_args.setup_encrypt_gce_image_args(
            encrypt_gce_image_parser, parsed_config)
        setup_instance_config_args(encrypt_gce_image_parser, parsed_config)
Example #2
0
 def register(self, subparsers, parsed_config):
     launch_gce_image_parser = subparsers.add_parser(
         'launch-gce-image', formatter_class=brkt_cli.SortingHelpFormatter)
     launch_gce_image_args.setup_launch_gce_image_args(
         launch_gce_image_parser)
     setup_instance_config_args(launch_gce_image_parser,
                                mode=INSTANCE_METAVISOR_MODE)
Example #3
0
 def register(self, subparsers, parsed_config):
     update_gce_image_parser = subparsers.add_parser(
         'update-gce-image', formatter_class=brkt_cli.SortingHelpFormatter)
     update_encrypted_gce_image_args.setup_update_gce_image_args(
         update_gce_image_parser)
     setup_instance_config_args(update_gce_image_parser,
                                brkt_env_default=BRKT_ENV_PROD)
Example #4
0
    def register(self, subparsers, parsed_config):
        self.config = parsed_config

        aws_parser = subparsers.add_parser(
            self.name(),
            description='AWS operations',
            help='AWS operations'
        )

        aws_subparsers = aws_parser.add_subparsers(
            dest='aws_subcommand'
        )

        diag_parser = aws_subparsers.add_parser(
            'diag',
            description=(
                'Create instance to diagnose an existing encrypted instance.'
            ),
            help='Diagnose an encrypted instance',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        diag_args.setup_diag_args(diag_parser)
        diag_parser.set_defaults(aws_subcommand='diag')

        encrypt_ami_parser = aws_subparsers.add_parser(
            'encrypt',
            description='Create an encrypted AMI from an existing AMI.',
            help='Encrypt an AWS image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        encrypt_ami_args.setup_encrypt_ami_args(encrypt_ami_parser)
        setup_instance_config_args(encrypt_ami_parser, parsed_config,
                                   mode=INSTANCE_CREATOR_MODE)
        encrypt_ami_parser.set_defaults(aws_subcommand='encrypt')

        share_logs_parser = aws_subparsers.add_parser(
            'share-logs',
            description='Share logs from an existing encrypted instance.',
            help='Share logs',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        share_logs_args.setup_share_logs_args(share_logs_parser)
        share_logs_parser.set_defaults(aws_subcommand='share-logs')

        update_encrypted_ami_parser = aws_subparsers.add_parser(
            'update',
            description=(
                'Update an encrypted AMI with the latest Metavisor '
                'release.'
            ),
            help='Update an encrypted AWS image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        update_encrypted_ami_args.setup_update_encrypted_ami(
            update_encrypted_ami_parser)
        setup_instance_config_args(update_encrypted_ami_parser,
                                   parsed_config,
                                   mode=INSTANCE_UPDATER_MODE)
        update_encrypted_ami_parser.set_defaults(aws_subcommand='update')
Example #5
0
 def register(self, subparsers, parsed_config):
     launch_gce_image_parser = subparsers.add_parser(
         'launch-gce-image',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     launch_gce_image_args.setup_launch_gce_image_args(launch_gce_image_parser)
     setup_instance_config_args(launch_gce_image_parser,
                                mode=INSTANCE_METAVISOR_MODE)
Example #6
0
 def register(self, subparsers, parsed_config):
     encrypt_ami_parser = subparsers.add_parser(
         'encrypt-ami',
         description='Create an encrypted AMI from an existing AMI.',
         formatter_class=brkt_cli.SortingHelpFormatter)
     encrypt_ami_args.setup_encrypt_ami_args(encrypt_ami_parser)
     setup_instance_config_args(encrypt_ami_parser,
                                mode=INSTANCE_CREATOR_MODE)
Example #7
0
 def register(self, subparsers, parsed_config):
     update_gce_image_parser = subparsers.add_parser(
         'update-gce-image',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     update_encrypted_gce_image_args.setup_update_gce_image_args(update_gce_image_parser)
     setup_instance_config_args(update_gce_image_parser,
                                brkt_env_default=BRKT_ENV_PROD)
Example #8
0
 def register(self, subparsers, parsed_config):
     encrypt_ami_parser = subparsers.add_parser(
         'encrypt-ami',
         description='Create an encrypted AMI from an existing AMI.',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     encrypt_ami_args.setup_encrypt_ami_args(encrypt_ami_parser)
     setup_instance_config_args(encrypt_ami_parser,
                                mode=INSTANCE_CREATOR_MODE)
Example #9
0
 def register(self, subparsers, parsed_config):
     update_encrypted_ami_parser = subparsers.add_parser(
         'update-encrypted-ami',
         description=('Update an encrypted AMI with the latest Metavisor '
                      'release.'),
         formatter_class=brkt_cli.SortingHelpFormatter)
     update_encrypted_ami_args.setup_update_encrypted_ami(
         update_encrypted_ami_parser)
     setup_instance_config_args(update_encrypted_ami_parser,
                                mode=INSTANCE_UPDATER_MODE)
Example #10
0
 def register(self, subparsers, parsed_config):
     self.config = parsed_config
     update_encrypted_vmdk_parser = subparsers.add_parser(
         'update-vmdk',
         description='Update an encrypted VMDK with the latest Metavisor',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     update_encrypted_vmdk_args.setup_update_vmdk_args(
         update_encrypted_vmdk_parser)
     setup_instance_config_args(update_encrypted_vmdk_parser, parsed_config)
Example #11
0
 def register(self, subparsers, parsed_config):
     self.config = parsed_config
     encrypt_vmdk_parser = subparsers.add_parser(
         'encrypt-vmdk',
         description='Create an encrypted VMDK from an existing VMDK',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     encrypt_vmdk_args.setup_encrypt_vmdk_args(
         encrypt_vmdk_parser)
     setup_instance_config_args(encrypt_vmdk_parser, parsed_config)
Example #12
0
 def register(self, subparsers, parsed_config):
     self.config = parsed_config
     encrypt_gce_image_parser = subparsers.add_parser(
         'encrypt-gce-image',
         description='Create an encrypted GCE image from an existing image',
         help='Encrypt a GCE image',
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     encrypt_gce_image_args.setup_encrypt_gce_image_args(
         encrypt_gce_image_parser, parsed_config)
     setup_instance_config_args(encrypt_gce_image_parser, parsed_config)
Example #13
0
 def register(self, subparsers, parsed_config):
     self.config = parsed_config
     launch_gce_image_parser = subparsers.add_parser(
         'launch-gce-image',
         formatter_class=brkt_cli.SortingHelpFormatter,
         description='Launch a GCE image',
         help='Launch a GCE image'
     )
     launch_gce_image_args.setup_launch_gce_image_args(
         launch_gce_image_parser)
     setup_instance_config_args(launch_gce_image_parser, parsed_config,
                                mode=INSTANCE_METAVISOR_MODE)
Example #14
0
 def register(self, subparsers, parsed_config):
     self.config = parsed_config
     update_gce_image_parser = subparsers.add_parser(
         'update-gce-image',
         description=(
             'Update an encrypted GCE image with the latest Metavisor '
             'release'),
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     update_encrypted_gce_image_args.setup_update_gce_image_args(
         update_gce_image_parser, parsed_config)
     setup_instance_config_args(update_gce_image_parser, parsed_config)
Example #15
0
 def register(self, subparsers, parsed_config):
     update_encrypted_ami_parser = subparsers.add_parser(
         'update-encrypted-ami',
         description=(
             'Update an encrypted AMI with the latest Metavisor '
             'release.'
         ),
         formatter_class=brkt_cli.SortingHelpFormatter
     )
     update_encrypted_ami_args.setup_update_encrypted_ami(
         update_encrypted_ami_parser)
     setup_instance_config_args(update_encrypted_ami_parser,
                                mode=INSTANCE_UPDATER_MODE)
Example #16
0
    def register(self, subparsers, parsed_config):
        parser = subparsers.add_parser(
            self.name(),
            description=('Generate MIME multipart user-data that is passed to '
                         'Metavisor and cloud-init when running an instance.'),
            formatter_class=brkt_cli.SortingHelpFormatter)

        setup_instance_config_args(parser)

        parser.add_argument('-v',
                            '--verbose',
                            dest='make_user_data_verbose',
                            action='store_true',
                            help='Print status information to the console')
Example #17
0
    def register(self, subparsers, parsed_config):
        parser = subparsers.add_parser(
            self.name(),
            description=(
                'Generate MIME multipart user-data that is passed to '
                'Metavisor and cloud-init when running an instance.'
            ),
            help='Make user data for passing to Metavisor',
            formatter_class=brkt_cli.SortingHelpFormatter
        )

        setup_instance_config_args(
            parser, parsed_config, mode=INSTANCE_METAVISOR_MODE)

        parser.add_argument(
            '-v',
            '--verbose',
            dest='make_user_data_verbose',
            action='store_true',
            help='Print status information to the console'
        )
        parser.add_argument(
            '--brkt-file',
            metavar='FILENAME',
            dest='make_user_data_brkt_files',
            action='append',
            help=argparse.SUPPRESS
        )
        parser.add_argument(
            '--guest-user-data-file',
            metavar='PATH:TYPE',
            dest='make_user_data_guest_files',
            action='append',
            help=('User-data file and MIME content type to be passed to '
                  'cloud-init on the guest instance. Can be specified '
                  'multiple times.')
        )
        # Certain customers need to set the FQDN of the guest instance, which
        # is used by Metavisor as the CN field of the Subject DN in the cert
        # requests it submits to an EST server (for North-South VPN tunneling).
        parser.add_argument(
            '--guest-fqdn',
            metavar='FQDN',
            dest='make_user_data_guest_fqdn',
            help=argparse.SUPPRESS
        )
Example #18
0
    def register(self, subparsers, parsed_config):
        parser = subparsers.add_parser(
            self.name(),
            description=(
                'Generate MIME multipart user-data that is passed to '
                'Metavisor and cloud-init when running an instance.'
            ),
            formatter_class=brkt_cli.SortingHelpFormatter
        )

        setup_instance_config_args(parser)

        parser.add_argument(
            '-v',
            '--verbose',
            dest='make_user_data_verbose',
            action='store_true',
            help='Print status information to the console'
        )
Example #19
0
    def register(self, subparsers, parsed_config):
        self.config = parsed_config

        gce_parser = subparsers.add_parser(
            self.name(),
            description='GCE Operations',
            help='GCE Operations'
        )

        gce_subparsers = gce_parser.add_subparsers(
            dest='gce_subcommand'
        )

        encrypt_gce_image_parser = gce_subparsers.add_parser(
            'encrypt',
            description='Create an encrypted GCE image from an existing image',
            help='Encrypt a GCE image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        encrypt_gce_image_args.setup_encrypt_gce_image_args(
            encrypt_gce_image_parser, parsed_config)
        setup_instance_config_args(encrypt_gce_image_parser, parsed_config)

        update_gce_image_parser = gce_subparsers.add_parser(
            'update',
            description=(
                'Update an encrypted GCE image with the latest Metavisor '
                'release'),
            help='Update an encrypted GCE image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        update_encrypted_gce_image_args.setup_update_gce_image_args(
            update_gce_image_parser, parsed_config)
        setup_instance_config_args(update_gce_image_parser, parsed_config)

        launch_gce_image_parser = gce_subparsers.add_parser(
            'launch',
            description='Launch a GCE image',
            help='Launch a GCE image',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        launch_gce_image_args.setup_launch_gce_image_args(
            launch_gce_image_parser)
        setup_instance_config_args(launch_gce_image_parser, parsed_config,
                                   mode=INSTANCE_METAVISOR_MODE)
Example #20
0
    def register(self, subparsers, parsed_config):
        self.config = parsed_config
        vmware_parser = subparsers.add_parser(
            self.name(),
            description='VMWare Operations',
            help='VMWare Operations',
        )

        vmware_subparsers = vmware_parser.add_subparsers(
            dest='vmware_subcommand'
        )

        encrypt_with_vcenter_parser = vmware_subparsers.add_parser(
            'encrypt-with-vcenter',
            description=(
                'Create an encrypted VMDK from an existing VMDK using vCenter'
            ),
            help='Encrypt a VMDK using vCenter',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        encrypt_vmdk_args.setup_encrypt_vmdk_args(
            encrypt_with_vcenter_parser)
        setup_instance_config_args(encrypt_with_vcenter_parser, parsed_config)

        encrypt_with_esx_parser = vmware_subparsers.add_parser(
            'encrypt-with-esx-host',
            description=(
                'Create an encrypted VMDK from an existing VMDK on an ESX host'
            ),
            help='Encrypt a VMDK on a ESX host',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        encrypt_with_esx_host_args.setup_encrypt_with_esx_host_args(
            encrypt_with_esx_parser)
        setup_instance_config_args(encrypt_with_esx_parser, parsed_config)

        update_with_vcenter_parser = vmware_subparsers.add_parser(
            'update-with-vcenter',
            description=(
                'Update an encrypted VMDK with the latest Metavisor using vCenter'
            ),
            help='Update an encrypted VMDK using vCenter',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        update_encrypted_vmdk_args.setup_update_vmdk_args(
            update_with_vcenter_parser)
        setup_instance_config_args(update_with_vcenter_parser, parsed_config)

        update_with_esx_parser = vmware_subparsers.add_parser(
            'update-with-esx-host',
            description=(
                'Update an encrypted VMDK with the latest Metavisor on an ESX host'
            ),
            help='Update an encrypted VMDK on an ESX host',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        update_with_esx_host_args.setup_update_with_esx_host_args(
            update_with_esx_parser)
        setup_instance_config_args(update_with_esx_parser, parsed_config)

        rescue_metavisor_parser = vmware_subparsers.add_parser(
            'rescue-metavisor',
            description=(
                'Upload a Metavisor VM cores and diagnostics to a URL'
            ),
            help='Upload Metavisor VM cores to URL',
            formatter_class=brkt_cli.SortingHelpFormatter
        )
        rescue_metavisor_args.setup_rescue_metavisor_args(
            rescue_metavisor_parser)
        setup_instance_config_args(rescue_metavisor_parser, parsed_config)