Пример #1
0
    def get_parser():
        parser = argparse.ArgumentParser(
            usage="ho stop",
            formatter_class=CustomFormatter,
            description=textwrap.dedent(
                """\
            Stop AWS delegates.

            The documentation for each sub-subcommand can be displayed with

               ho stop sub-subcommand --help

            For instance:

               ho stop delegates --help
               usage: ho stop delegates [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """
            ),
        )

        subparsers = parser.add_subparsers(
            title="stop subcommands", description="valid stop subcommands", help="stop subcommand -h"
        )

        subparsers.add_parser(
            "delegates",
            formatter_class=CustomFormatter,
            description=textwrap.dedent(
                """\
            Stop (suspend) delegate clusters.

            """
            ),
            epilog=textwrap.dedent(
                """ Examples:

            $ ho stop subnets
            $ echo $?
            0

            """
            ),
            help="Stop (suspend) delegate clusters",
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=StopDelegates)

        return parser
Пример #2
0
    def get_parser():
        parser = argparse.ArgumentParser(
            usage='ho stop',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Stop AWS delegates.

            The documentation for each sub-subcommand can be displayed with

               ho stop sub-subcommand --help

            For instance:

               ho stop delegates --help
               usage: ho stop delegates [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='stop subcommands',
            description='valid stop subcommands',
            help='stop subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Stop (suspend) delegate clusters.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho stop subnets
            $ echo $?
            0

            """),
            help='Stop (suspend) delegate clusters',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=StopDelegates,
        )

        return parser
Пример #3
0
    def get_parser():
        parser = argparse.ArgumentParser(
            usage='ho start',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Start AWS delegates.

            The documentation for each sub-subcommand can be displayed with

               ho start sub-subcommand --help

            For instance:

               ho start delegates --help
               usage: ho start delegates [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='start subcommands',
            description='valid start subcommands',
            help='start subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Start (revive) stopped delegate clusters.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho start subnets
            $ echo $?
            0

            """),
            help='Start (revive) stopped delegate clusters',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=StartDelegates,
        )

        return parser
Пример #4
0
    def get_parser():
        parser = argparse.ArgumentParser(usage='ho probe',
                                         formatter_class=CustomFormatter,
                                         description=textwrap.dedent("""\
            Probe AWS connection and cluster configuration.

            The documentation for each sub-subcommand can be displayed with

               ho probe sub-subcommand --help

            For instance:

               ho probe aws --help
               usage: ho probe aws [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='probe subcommands',
            description='valid probe subcommands',
            help='probe subcommand -h',
        )

        subparsers.add_parser(
            'aws',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Probe AWS (test ability to connect to EC2).

            Once you have set up your AWS credentials in ~/.boto,
            run this subcommand to check connectivity.
            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho probe aws
            $ echo $?
            0

            """),
            help='Test ability to connect to AWS EC2',
            parents=[subcommand_parser()],
            add_help=False,
        ).set_defaults(func=ProbeAWS, )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Probe delegates (number of instances in subnet).

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho probe delegates
            $ echo $?
            0

            """),
            help='Print number of instances in each subnet',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=ProbeDelegates, )

        subparsers.add_parser(
            'public-ips',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            List public IPs in a special format

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho probe public-ips
            $ echo $?
            0

            """),
            help='List public IP addresses in special format',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=ProbePublicIPs, )

        subparsers.add_parser(
            'region',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Test connect to the region defined in YAML.

            This subcommand reads the "region" stanza of the YAML
            file to determine which region to connect to. Then it
            attempts to open a connection to the VPC service in that
            region.
            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho probe region
            $ echo $?
            0

            """),
            help='Test region connectivity',
            parents=[subcommand_parser()],
            add_help=False,
        ).set_defaults(func=ProbeRegion, )

        subparsers.add_parser(
            'subnets',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Probe subnets and create them if they are missing.

            This subcommand checks that each delegate has a subnet in AWS VPC,
            in accordance with the 'delegate' stanza of the YaML. If any subnet
            is missing, it is created and the YaML is updated.

            It also checks the Salt Master's dedicated subnet and creates it if
            necessary.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho probe subnets
            $ echo $?
            0

            """),
            help='Probe subnets and create if missing',
            parents=[subcommand_parser_with_retag()],
            add_help=False,
        ).set_defaults(func=ProbeSubnets, )

        subparsers.add_parser(
            'vpc',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Probe VPC and create one if it is missing.

            This subcommand checks the VPC status in AWS, compares it with the
            YaML. If VPC is missing in AWS, it is created and the YaML is
            updated.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho probe vpc
            $ echo $?
            0

            """),
            help='Probe VPC and create if missing',
            parents=[subcommand_parser_with_retag()],
            add_help=False,
        ).set_defaults(func=ProbeVPC, )

        subparsers.add_parser(
            'yaml',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Validate YaML file.

            Use this subcommand to validate the yaml file.
            """),
            epilog=textwrap.dedent("""
            Examples:

            $ ho probe yaml
            $ echo $?
            0

            $ ho --yamlfile bogus probe-yaml
            ... tracebacks ...
            $ echo $?
            1

            """),
            help='Probe YaML file',
            parents=[subcommand_parser()],
            add_help=False,
        ).set_defaults(func=ProbeYaml, )

        return parser
Пример #5
0
    def get_parser():
        parser = argparse.ArgumentParser(
            usage='ho wipeout',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) AWS entities.

            The documentation for each sub-subcommand can be displayed with

               ho wipeout sub-subcommand --help

            For instance:

               ho wipeout delegates --help
               usage: ho wipeout delegates [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='wipeout subcommands',
            description='valid wipeout subcommands',
            help='wipeout subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) delegate clusters.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout subnets
            $ echo $?
            0

            """),
            help='Wipe out (completely delete) delegate clusters',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=WipeOutDelegates,
        )

        subparsers.add_parser(
            'subnets',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) one or more subnets.

            Ipsum dolum

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout subnets 3
            $ ho wipeout subnets 1,5
            $ ho wipeout subnets 1-3,6

            """),
            help='Wipe out (completely delete) one or more subnets',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=WipeOutSubnets,
        )

        subparsers.add_parser(
            'vpc',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) VPC.

            Ipsum dolum

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout vpc
            $ echo $?
            0

            """),
            help='Wipe out (completely delete) VPC',
            parents=[dry_run_only_parser()],
            add_help=False,
        ).set_defaults(
            func=WipeOutVPC,
        )

        return parser
Пример #6
0
    def get_parser():
        parser = argparse.ArgumentParser(
            usage='ho install',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install delegats.

            The documentation for each sub-subcommand can be displayed with

               ho install sub-subcommand --help

            For instance:

               ho install delegate --help
               usage: ho install delegate [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='install subcommands',
            description='valid install subcommands',
            help='install subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install delegate cluster(s) in AWS.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install delegates 1-12
            $ echo $?
            0

            """),
            help='Install delegate cluster(s) in AWS',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=InstallDelegates,
        )

        subparsers.add_parser(
            'keypairs',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Import SSH public key into AWS EC2.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install keypair
            $ echo $?
            0

            """),
            help='Import SSH public key into AWS EC2',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=InstallKeypairs,
        )

        subparsers.add_parser(
            'subnets',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install delegate subnet(s) in AWS.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install subnets 1-12
            $ ho install subnets --all
            $ ho install subnets --all --dry-run

            """),
            help='Install delegate subnet(s) in AWS',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(
            func=InstallSubnets,
        )

        subparsers.add_parser(
            'vpc',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install Virtual Private Cloud (VPC).

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install vpc
            $ ho install --dry-run

            """),
            help='Install Virtual Private Cloud (VPC)',
            parents=[dry_run_only_parser()],
            add_help=False,
        ).set_defaults(
            func=InstallVPC,
        )

        return parser
Пример #7
0
    def get_parser():
        parser = argparse.ArgumentParser(usage='ho install',
                                         formatter_class=CustomFormatter,
                                         description=textwrap.dedent("""\
            Install delegats.

            The documentation for each sub-subcommand can be displayed with

               ho install sub-subcommand --help

            For instance:

               ho install delegate --help
               usage: ho install delegate [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='install subcommands',
            description='valid install subcommands',
            help='install subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install delegate cluster(s) in AWS.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install delegates 1-12
            $ echo $?
            0

            """),
            help='Install delegate cluster(s) in AWS',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=InstallDelegates, )

        subparsers.add_parser(
            'keypairs',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Import SSH public key into AWS EC2.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install keypair
            $ echo $?
            0

            """),
            help='Import SSH public key into AWS EC2',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=InstallKeypairs, )

        subparsers.add_parser(
            'subnets',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install delegate subnet(s) in AWS.

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install subnets 1-12
            $ ho install subnets --all
            $ ho install subnets --all --dry-run

            """),
            help='Install delegate subnet(s) in AWS',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=InstallSubnets, )

        subparsers.add_parser(
            'vpc',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Install Virtual Private Cloud (VPC).

            """),
            epilog=textwrap.dedent("""
            Example:

            $ ho install vpc
            $ ho install --dry-run

            """),
            help='Install Virtual Private Cloud (VPC)',
            parents=[dry_run_only_parser()],
            add_help=False,
        ).set_defaults(func=InstallVPC, )

        return parser
Пример #8
0
    def get_parser():
        parser = argparse.ArgumentParser(usage='ho wipeout',
                                         formatter_class=CustomFormatter,
                                         description=textwrap.dedent("""\
            Wipe out (completely delete) AWS entities.

            The documentation for each sub-subcommand can be displayed with

               ho wipeout sub-subcommand --help

            For instance:

               ho wipeout delegates --help
               usage: ho wipeout delegates [-h]
               ...

            For more information, refer to the README.rst file at
            https://github.com/smithfarm/ceph-auto-aws/README.rst
            """))

        subparsers = parser.add_subparsers(
            title='wipeout subcommands',
            description='valid wipeout subcommands',
            help='wipeout subcommand -h',
        )

        subparsers.add_parser(
            'delegates',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) delegate clusters.

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout subnets
            $ echo $?
            0

            """),
            help='Wipe out (completely delete) delegate clusters',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=WipeOutDelegates, )

        subparsers.add_parser(
            'subnets',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) one or more subnets.

            Ipsum dolum

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout subnets 3
            $ ho wipeout subnets 1,5
            $ ho wipeout subnets 1-3,6

            """),
            help='Wipe out (completely delete) one or more subnets',
            parents=[cluster_options_parser()],
            add_help=False,
        ).set_defaults(func=WipeOutSubnets, )

        subparsers.add_parser(
            'vpc',
            formatter_class=CustomFormatter,
            description=textwrap.dedent("""\
            Wipe out (completely delete) VPC.

            Ipsum dolum

            """),
            epilog=textwrap.dedent(""" Examples:

            $ ho wipeout vpc
            $ echo $?
            0

            """),
            help='Wipe out (completely delete) VPC',
            parents=[dry_run_only_parser()],
            add_help=False,
        ).set_defaults(func=WipeOutVPC, )

        return parser