Python oslo_config.cfg.SubCommandOpt() Examples
The following are 6
code examples of oslo_config.cfg.SubCommandOpt().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
oslo_config.cfg
, or try the search function
.
Example #1
Source File: status.py From kuryr-kubernetes with Apache License 2.0 | 6 votes |
def main(): opt = cfg.SubCommandOpt( 'category', title='command', description='kuryr-k8s-status command or category to execute', handler=add_parsers) conf = cfg.ConfigOpts() conf.register_cli_opt(opt) conf(sys.argv[1:]) os_vif.initialize() objects.register_locally_defined_vifs() try: return conf.category.action_fn() except Exception: print('Error:\n%s' % traceback.format_exc()) # This is 255 so it's not confused with the upgrade check exit codes. return 255
Example #2
Source File: manage.py From freezer-api with Apache License 2.0 | 6 votes |
def parse_config(): DB_INIT = [ cfg.SubCommandOpt('db', dest='db', title='DB Options', handler=add_db_opts ) ] # register database backend drivers config.register_db_drivers_opt() # register database cli options CONF.register_cli_opts(DB_INIT) # register logging opts log.register_options(CONF) default_config_files = cfg.find_config_files('freezer', 'freezer-api') CONF(args=sys.argv[1:], project='freezer-api', default_config_files=default_config_files, version=FREEZER_API_VERSION )
Example #3
Source File: db_manage.py From zun with Apache License 2.0 | 5 votes |
def main(): command_opt = cfg.SubCommandOpt('command', title='Command', help='Available commands', handler=add_command_parsers) CONF.register_cli_opt(command_opt) CONF(project='zun') CONF.command.func()
Example #4
Source File: test_db_manage.py From watcher with Apache License 2.0 | 5 votes |
def test_run_db_manage_app(self, m_sys, m_prepare_service): # Patch command function m_func = mock.Mock() cfg.CONF.register_opt(cfg.SubCommandOpt("command")) cfg.CONF.command.func = m_func # Only append if the command is not None m_sys.argv = list(filter(None, ["watcher-db-manage", self.command])) dbmanage.main() self.assertEqual(1, m_func.call_count) m_prepare_service.assert_called_once_with( ["watcher-db-manage", self.expected], cfg.CONF)
Example #5
Source File: dbsync.py From cyborg with Apache License 2.0 | 5 votes |
def main(): command_opt = cfg.SubCommandOpt('command', title='Command', help=_('Available commands'), handler=add_command_parsers) CONF.register_cli_opt(command_opt) service.prepare_service(sys.argv) CONF.command.func()
Example #6
Source File: config.py From syntribos with Apache License 2.0 | 4 votes |
def list_cli_opts(): return [ cfg.SubCommandOpt(name="sub_command", handler=sub_commands, help=_("Available commands"), title="syntribos Commands"), cfg.MultiStrOpt("test-types", dest="test_types", short="t", default=[""], sample_default=["SQL", "XSS"], help=_( "Test types to run against the target API")), cfg.MultiStrOpt("excluded-types", dest="excluded_types", short="e", default=[""], sample_default=["SQL", "XSS"], help=_("Test types to be excluded from " "current run against the target API")), cfg.BoolOpt("colorize", dest="colorize", short="cl", default=True, help=_("Enable color in syntribos terminal output")), cfg.StrOpt("outfile", short="o", sample_default="out.json", help=_("File to print " "output to")), cfg.StrOpt("format", dest="output_format", short="f", default="json", choices=["json"], ignore_case=True, help=_("The format for outputting results")), cfg.StrOpt("min-severity", dest="min_severity", short="S", default="LOW", choices=syntribos.RANKING, help=_("Select a minimum severity for reported " "defects")), cfg.StrOpt("min-confidence", dest="min_confidence", short="C", default="LOW", choices=syntribos.RANKING, help=_("Select a minimum confidence for reported " "defects")), cfg.BoolOpt("stacktrace", dest="stacktrace", default=True, help=_("Select if Syntribos outputs a stacktrace " " if an exception is raised")), cfg.StrOpt( "custom_root", dest="custom_root", help=_("Filesystem location for syntribos root directory, " "containing logs, templates, payloads, config files. " "Creates directories and skips interactive prompts when " "used with 'syntribos init'"), deprecated_group="init", deprecated_name="custom_install_root") ]