本文整理汇总了Python中pulp.client.extensions.extensions.PulpCliCommand.add_option方法的典型用法代码示例。如果您正苦于以下问题:Python PulpCliCommand.add_option方法的具体用法?Python PulpCliCommand.add_option怎么用?Python PulpCliCommand.add_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pulp.client.extensions.extensions.PulpCliCommand
的用法示例。
在下文中一共展示了PulpCliCommand.add_option方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
PulpCliSection.__init__(self, 'sync', _('run, schedule, or view the status of sync operations'))
self.context = context
self.prompt = context.prompt
# Run an Immediate Sync
run_command = PulpCliCommand('run', _('triggers an immediate sync of a specific repository'), self.run)
run_command.add_option(PulpCliOption('--id', _('identifies the repository to sync'), required=True))
self.add_command(run_command)
示例2: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
"""
@param context:
@type context: pulp.client.extensions.core.ClientContext
"""
super(ListenerSection, self).__init__(context, "listener", _("manage server-side event listeners"))
self.add_subsection(EmailSection(context))
self.add_subsection(RestApiSection(context))
self.add_subsection(AMQPSection(context))
m = _("list all of the event listeners in the system")
self.add_command(PulpCliCommand("list", m, self.list))
m = _("delete an event listener")
delete_command = PulpCliCommand("delete", m, self.delete)
delete_command.add_option(self.id_option)
self.add_command(delete_command)
示例3: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
super(AMQPSection, self).__init__(context, 'amqp',
_('manage amqp listeners'))
m = _('optional name of an exchange that overrides the setting from '
'server.conf')
self.exchange_option = PulpCliOption('--exchange', m, required=False)
create_command = PulpCliCommand('create', _('create a listener'),
self.create)
create_command.add_option(self.event_types_option)
create_command.add_option(self.exchange_option)
self.add_command(create_command)
m = _('update an event listener')
update_command = PulpCliCommand('update', m, self.update)
update_command.add_option(self.id_option)
update_command.add_option(self._copy_flip_required(self.event_types_option))
update_command.add_option(self.exchange_option)
self.add_command(update_command)
示例4: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
super(ConsumerGroupMemberSection, self).__init__('members', _('manage members of consumer groups'))
self.context = context
self.prompt = context.prompt
id_option = PulpCliOption('--consumer-group-id', _('id of a consumer group'), required=True)
list_command = PulpCliCommand('list', _('list of consumers in a particular group'), self.list)
list_command.add_option(id_option)
self.add_command(list_command)
add_command = CriteriaCommand(self.add, name='add', include_search=False,
description=_('add consumers based on search parameters'))
add_command.add_option(id_option)
self.add_command(add_command)
remove_command = CriteriaCommand(self.remove, name='remove', include_search=False,
description=_('remove consumers based on search parameters'))
remove_command.add_option(id_option)
self.add_command(remove_command)
示例5: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
PulpCliSection.__init__(self, 'user', _('add/remove user from the role'))
self.context = context
self.prompt = context.prompt # for easier access
# Common Options
id_option = PulpCliOption('--role-id', 'identifies the role', required=True)
login_option = PulpCliOption('--login', 'identifies the user', required=True)
# AddUser command
add_user_command = PulpCliCommand('add', 'adds user to a role', self.add_user)
add_user_command.add_option(id_option)
add_user_command.add_option(login_option)
self.add_command(add_user_command)
# RemoveUser command
remove_user_command = PulpCliCommand('remove', 'removes user from a role', self.remove_user)
remove_user_command.add_option(id_option)
remove_user_command.add_option(login_option)
self.add_command(remove_user_command)
示例6: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
PulpCliSection.__init__(self, 'group', _('consumer group commands'))
self.context = context
self.prompt = context.prompt # for easier access
self.add_subsection(ConsumerGroupMemberSection(context))
# Common Options
id_option = PulpCliOption('--consumer-group-id', _('uniquely identifies the consumer group; only alphanumeric, -, and _ allowed'), required=True)
name_option = PulpCliOption('--display-name', _('user-readable display name for the consumer group'), required=False)
description_option = PulpCliOption('--description', _('user-readable description for the consumer group'), required=False)
note_desc = 'adds/updates/deletes notes to programmatically identify the resource; '
note_desc += 'key-value pairs must be separated by an equal sign (e.g. key=value); multiple notes can '
note_desc += 'be changed by specifying this option multiple times; notes are deleted by '
note_desc += 'specifying "" as the value'
note_option = PulpCliOption('--note', _(note_desc), required=False, allow_multiple=True)
# Create Command
create_command = PulpCliCommand('create', _('creates a new consumer group'), self.create)
create_command.add_option(id_option)
create_command.add_option(name_option)
create_command.add_option(description_option)
create_command.add_option(note_option)
self.add_command(create_command)
# Update Command
update_command = PulpCliCommand('update', _('changes metadata on an existing consumer group'), self.update)
update_command.add_option(id_option)
update_command.add_option(name_option)
update_command.add_option(description_option)
update_command.add_option(note_option)
self.add_command(update_command)
# Delete Command
delete_command = PulpCliCommand('delete', _('deletes a consumer group'), self.delete)
delete_command.add_option(id_option)
self.add_command(delete_command)
# List Command
list_command = PulpCliCommand('list', _('lists summary of consumer groups registered to the Pulp server'), self.list)
list_command.add_option(PulpCliFlag('--details', _('if specified, all the consumer group information is displayed')))
list_command.add_option(PulpCliOption('--fields', _('comma-separated list of consumer group fields; if specified, only the given fields will displayed'), required=False))
self.add_command(list_command)
# Search Command
self.add_command(SearchCommand(self.search))
# Bind Command
bind_command = PulpCliCommand('bind',
_('binds each consumer in a consumer group to a repository '
'distributor for consuming published content'),
self.bind)
bind_command.add_option(id_option)
bind_command.add_option(PulpCliOption('--repo-id', 'repository id', required=True))
bind_command.add_option(PulpCliOption('--distributor-id', 'distributor id', required=True))
self.add_command(bind_command)
示例7: __init__
# 需要导入模块: from pulp.client.extensions.extensions import PulpCliCommand [as 别名]
# 或者: from pulp.client.extensions.extensions.PulpCliCommand import add_option [as 别名]
def __init__(self, context):
PulpCliSection.__init__(self, "user", "user lifecycle (list, create, update, etc.) commands")
self.context = context
self.prompt = context.prompt # for easier access
# Common Options
login_option = PulpCliOption(
"--login", "uniquely identifies the user; only alphanumeric, -, and _ allowed", required=True
)
name_option = PulpCliOption("--name", "user-readable full name of the user", required=False)
# Create command
create_command = PulpCliCommand("create", "creates a user", self.create)
create_command.add_option(login_option)
create_command.add_option(
PulpCliOption(
"--password", "password for the new user, if you do not want to be prompted for one", required=False
)
)
create_command.add_option(name_option)
self.add_command(create_command)
# Update Command
update_command = PulpCliCommand("update", "changes metadata of an existing user", self.update)
update_command.add_option(PulpCliOption("--login", "identifies the user to be updated", required=True))
update_command.add_option(name_option)
update_command.add_option(
PulpCliOption(
"--password",
"new password for the user, use -p if you want to be prompted for the password",
required=False,
)
)
update_command.add_option(
PulpCliFlag("-p", "if specified, you will be prompted to enter new password for the user")
)
self.add_command(update_command)
# Delete Command
delete_command = PulpCliCommand("delete", "deletes a user", self.delete)
delete_command.add_option(PulpCliOption("--login", "identifies the user to be deleted", required=True))
self.add_command(delete_command)
# List Command
list_command = PulpCliCommand("list", "lists summary of users registered to the Pulp server", self.list)
list_command.add_option(PulpCliFlag("--details", "if specified, all the user information is displayed"))
list_command.add_option(
PulpCliOption(
"--fields",
"comma-separated list of user fields; if specified, only the given fields will displayed",
required=False,
)
)
self.add_command(list_command)
# Search Command
self.add_command(CriteriaCommand(self.search, include_search=True))