def __init__(self, parser): super(cmd_init, self).__init__(parser) for argument, kwargs in ARGUMENTS.items(): parser.add_argument('--%s' % argument, **kwargs) parser.add_argument( '--force', action='store_true', help=( "Skip confirmation questions when initialization has " "already been performed.")) parser.add_argument( '--enable-candid', default=False, action="store_true", help=("Enable configuring the use of an external Candid server. " "This feature is currently experimental. " "If this isn't enabled, all --candid-* arguments " "will be ignored.")) parser.add_argument( '--enable-idm', nargs=0, action=deprecated_for('--enable-candid')) add_candid_options(parser) add_rbac_options(parser) parser.add_argument( '--skip-admin', action='store_true', help=( "Skip the admin creation when initializing in 'all' mode.")) add_create_admin_options(parser)
def add_arguments(self, parser): add_candid_options(parser) add_rbac_options(parser) parser.add_argument( '--json', action='store_true', default=False, help="Return the current authentication configuration as JSON")
def setUp(self): super().setUp() self.maas_bin_path = 'snap-path/bin/maas-region' self.mock_subprocess = self.patch(init, 'subprocess') self.mock_environ = patch.dict( init.os.environ, {'SNAP': 'snap-path'}, clear=True) self.mock_environ.start() self.parser = ArgumentParser() init.add_rbac_options(self.parser) init.add_candid_options(self.parser)
def __init__(self, parser): super().__init__(parser) parser.add_argument( "--skip-admin", action="store_true", help="Skip the admin creation.", ) add_create_admin_options(parser) add_candid_options(parser) add_rbac_options(parser)
def __init__(self, parser): super(cmd_init, self).__init__(parser) monkey_patch_for_all_mode_bw_compatability(parser) subparsers = parser.add_subparsers(metavar=None, title="run modes", dest="run_mode") subparsers.required = True subparsers_map = {} subparsers_map["region+rack"] = subparsers.add_parser( "region+rack", help="Both region and rack controllers", description=( "Initialise MAAS to run both a region and rack controller."), ) subparsers_map["region"] = subparsers.add_parser( "region", help="Region controller only", description=("Initialise MAAS to run only a region controller."), ) subparsers_map["rack"] = subparsers.add_parser( "rack", help="Rack controller only", description=("Initialise MAAS to run only a rack controller."), ) for argument, kwargs in ARGUMENTS.items(): kwargs = kwargs.copy() for_modes = kwargs.pop("for_mode") for for_mode in for_modes: subparsers_map[for_mode].add_argument("--%s" % argument, **kwargs) add_deprecated_mode_argument(parser) for for_mode in ["region+rack", "region", "rack"]: subparsers_map[for_mode].add_argument( "--force", action="store_true", help=("Skip confirmation questions when initialization has " "already been performed."), ) parser.add_argument( "--enable-candid", default=False, action="store_true", help=argparse.SUPPRESS, ) for for_mode in ["region+rack", "region"]: add_candid_options(subparsers_map[for_mode], suppress_help=True) add_rbac_options(subparsers_map[for_mode], suppress_help=True) subparsers_map[for_mode].add_argument("--skip-admin", action="store_true", help=argparse.SUPPRESS) add_create_admin_options(subparsers_map[for_mode], suppress_help=True)
def __init__(self, parser): super().__init__(parser) parser.add_argument( '--skip-admin', action='store_true', help="Skip the admin creation.") add_create_admin_options(parser) parser.add_argument( '--enable-candid', default=False, action="store_true", help=("Enable configuring the use of an external Candid server. " "If this isn't enabled, all --candid-* arguments " "will be ignored.")) add_candid_options(parser) add_rbac_options(parser)
def setUp(self): super().setUp() self.parser = ArgumentParser() init.add_candid_options(self.parser) self.mock_stderr = self.patch(init.sys, "stderr", StringIO())