本文整理汇总了Python中tambo.Transport.catch_help方法的典型用法代码示例。如果您正苦于以下问题:Python Transport.catch_help方法的具体用法?Python Transport.catch_help怎么用?Python Transport.catch_help使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tambo.Transport
的用法示例。
在下文中一共展示了Transport.catch_help方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self, argv):
# Console Logger
sh = logging.StreamHandler()
sh.setFormatter(log.color_format())
sh.setLevel(logging.DEBUG)
root_logger = logging.getLogger()
root_logger.setLevel(logging.DEBUG)
root_logger.addHandler(sh)
self.api_credentials()
# TODO: Need to implement `--filename` and make it available
options = [['--log', '--logging']]
parser = Transport(argv, mapper=self.mapper,
options=options, check_help=False,
check_version=False)
parser.parse_args()
chacractl.config['verbosity'] = parser.get('--log', 'info')
parser.catch_help = self.help()
parser.catch_version = chacractl.__version__
parser.mapper = self.mapper
if len(argv) <= 1:
return parser.print_help()
parser.dispatch()
parser.catches_help()
parser.catches_version()
示例2: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self):
options = ['--allowed']
parser = Transport(self.argv, options=options)
parser.catch_help = self._help
parser.parse_args()
delgado.config['allowed'] = parser.get('--allowed') or []
engine = Engine(connection=self.connection)
engine.run_forever()
示例3: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self):
parser = Transport(self.argv, options=['--socket-location'])
parser.catch_help = self._help
parser.parse_args()
location = parser.get('--socket-location') or '/tmp/pytest.sock'
delgado.config['allowed'] = ['py.test']
engine = Engine(socket_location=location)
engine.run_forever()
示例4: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self):
transport = Transport(self.argv, check_help=False)
transport.catch_help = self.__doc__
if len(self.argv) <= 1:
transport.print_help()
transport.parse_args()
for action in self.actions:
if transport.has(action):
return self.actions.get(action)()
# If nothing matches, print the help
transport.print_help()
示例5: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self, argv=None):
""" pass argv during testing """
if argv is None:
argv = self.argv
options = [['--output', '-o']]
parser = Transport(argv, options=options)
parser.catch_help = self.help()
parser.parse_args()
self.source = util.infer_path(parser.unknown_commands)
self.output = parser.get('--output', self.source + '-dvd.iso')
self.check_dependency()
self.make_iso()
self.make_sha256sum()
示例6: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self, argv):
parser = Transport(argv, mapper=self.mapper,
options=[], check_help=False,
check_version=False)
parser.parse_args()
parser.catch_help = self.help(parser.subhelp())
parser.catch_version = ceph_installer.__version__
parser.mapper = self.mapper
if len(argv) <= 1:
return parser.print_help()
parser.dispatch()
parser.catches_help()
parser.catches_version()
示例7: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self, argv):
options = []
parser = Transport(argv, mapper=self.mapper,
options=options, check_help=False,
check_version=False)
parser.parse_args()
parser.catch_help = self.help()
parser.catch_version = rhcephpkg.__version__
parser.mapper = self.mapper
if len(argv) <= 1:
return parser.print_help()
parser.dispatch()
parser.catches_help()
parser.catches_version()
示例8: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self, argv):
options = [['--log', '--logging']]
parser = Transport(argv, mapper=self.mapper,
options=options, check_help=False,
check_version=False)
parser.parse_args()
merfi.config['verbosity'] = parser.get('--log', 'info')
merfi.config['check'] = parser.has('--check')
parser.catch_help = self.help()
parser.catch_version = merfi.__version__
parser.mapper = self.mapper
if len(argv) <= 1:
return parser.print_help()
parser.dispatch()
parser.catches_help()
parser.catches_version()
示例9: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self, argv):
"""
Main method for parsing arguments, it uses whatever `argv` is although
it should always be a list. Once it goes through the ``Transport`` class
it tries to generate the help from the mapped classes and the current
docstring for this module.
If nothing matches it will return the help.
"""
self.get_extend_commands()
transport = Transport(argv, self.mapper)
transport.catch_help = "%s \n%s" % (__doc__, transport.subhelp())
transport.catch_version = "dozo version {0}".format(__version__)
if len(self.argv) <= 1:
transport.print_help()
transport.dispatch()
示例10: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self, argv):
parser = Transport(argv, mapper=self.mapper,
check_help=False,
check_version=False)
parser.parse_args()
parser.catch_help = self.help()
parser.catch_version = wari.__version__
parser.mapper = self.mapper
if len(argv) <= 1:
return parser.print_help()
# create the connection and set the collection
conn = wari.db.get_connection()
wari.db.connection = conn
wari.db.collection = conn['wari']
parser.dispatch()
parser.catches_help()
parser.catches_version()
conn.close()
示例11: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self):
parser = Transport(self.arguments, options=self.options, check_help=True)
parser.catch_help = self._help
parser.parse_args()
parser.catches_help()
if not parser.unknown_commands:
log.error("it is required to pass an identifer, but none was provided")
raise SystemExit(1)
self.identifier = parser.unknown_commands[-1]
if parser.has('--poll'):
return self.poll()
for key in [
'stdout', 'stderr', 'command', 'ended',
'started', 'succeeded', 'exit_code']:
if parser.has(key):
return self.get(key)
# if nothing else matches, just try to give a generic, full summary
self.summary()
示例12: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self):
options = ['create', 'update', 'generate', 'remove', 'get']
parser = Transport(self.argv, options=options)
parser.catch_help = self._help
parser.parse_args()
if parser.has('create'):
return self.create(parser.get('create'))
if parser.has('update'):
optional_args = ['key', 'step', 'secret', 'b32']
items = [i for i in parser.arguments if i in optional_args]
return self.update(parser.get('update'), items)
if parser.has('generate'):
return self.generate()
if parser.has('remove'):
return self.remove(parser.get('remove'))
if parser.has('get'):
items = [i for i in parser.arguments if i in ['pin']]
return self.get(parser.get('get'), items)
示例13: main
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def main(self):
parser = Transport(self.arguments, options=self.options, check_help=True)
parser.catch_help = self._help
parser.parse_args()
parser.catches_help()
branch = parser.get('--branch', 'master')
user = parser.get('--user', 'vagrant')
high_verbosity = '-vvvv' if parser.has('-vvvv') else '-v'
if not parser.unknown_commands:
log.error("it is required to pass a host to deploy to, but none was provided")
raise SystemExit(1)
command = [
"ansible-playbook",
"-i", "%s," % parser.unknown_commands[-1],
high_verbosity,
"-u", user,
"--extra-vars", 'branch=%s' % branch,
"deploy.yml",
]
log.debug("Running command: %s" % ' '.join(command))
out, err, code = process.run(command, cwd=playbook_path)
log.error(err)
log.debug(out)
示例14: parse_args
# 需要导入模块: from tambo import Transport [as 别名]
# 或者: from tambo.Transport import catch_help [as 别名]
def parse_args(self):
options = ['create', 'update', 'generate']
parser = Transport(self.argv, options=options)
parser.catch_help = self._help
parser.parse_args()