本文整理汇总了Python中pulp.client.extensions.extensions.PulpCliOptionGroup类的典型用法代码示例。如果您正苦于以下问题:Python PulpCliOptionGroup类的具体用法?Python PulpCliOptionGroup怎么用?Python PulpCliOptionGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PulpCliOptionGroup类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, context, renderer, distributor_id, name='run', description=DESC_PUBLISH_RUN,
method=None, override_config_options=()):
"""
:param context: Pulp client context
:type context: See okaara
:param renderer: StatusRenderer subclass that will interpret the sync or publish progress
report
:type renderer: StatusRenderer
:param distributor_id: Id of a distributor to be used for publishing
:type distributor_id: str
:param override_config_options: Additional publish options to be accepted from user. These
options will override respective options from the default
publish config. Each entry should be either a PulpCliOption
or PulpCliFlag instance
:type override_config_options: list
"""
super(RunPublishRepositoryCommand, self).__init__(name, description, method, context,
renderer)
self.distributor_id = distributor_id
self.override_config_keywords = []
# Process and add config override options in their own group and save option keywords
if override_config_options:
override_config_group = PulpCliOptionGroup(_("Publish Options"))
self.add_option_group(override_config_group)
for option in override_config_options:
override_config_group.add_option(option)
self.override_config_keywords.append(option.keyword)
开发者ID:maxamillion,项目名称:pulp,代码行数:33,代码来源:sync_publish.py
示例2: add_erratum_group
def add_erratum_group(command):
"""
Adds the erratum group and all of its options to the given command.
"""
erratum_group = PulpCliOptionGroup(_('Erratum'))
erratum_group.add_option(PulpCliOption('--erratum-id', _('if specified, the full details of an individual erratum are displayed'), required=False))
command.add_option_group(erratum_group)
开发者ID:stpierre,项目名称:pulp,代码行数:7,代码来源:pulp_cli.py
示例3: add_required_group
def add_required_group(command):
"""
Adds the required group and all of its options to the given command.
"""
required_group = PulpCliOptionGroup(_('Required'))
required_group.add_option(PulpCliOption('--repo-id', _('identifies the repository to search within'), required=True))
command.add_option_group(required_group)
开发者ID:stpierre,项目名称:pulp,代码行数:7,代码来源:pulp_cli.py
示例4: add_pagination_group
def add_pagination_group(command):
"""
Adds the pagination group and all of its options to the given command.
"""
pagination_group = PulpCliOptionGroup(_('Pagination'))
pagination_group.add_option(PulpCliOption('--limit', _('maximum number of results to display'), aliases=['-l'], required=False))
pagination_group.add_option(PulpCliOption('--skip', _('number of results to skip'), aliases=['-s'], required=False))
command.add_option_group(pagination_group)
开发者ID:stpierre,项目名称:pulp,代码行数:8,代码来源:pulp_cli.py
示例5: __init__
def __init__(self, context):
super(SearchErrataCommand, self).__init__(self.errata, context, name='errata',
description=DESC_ERRATA)
erratum_group = PulpCliOptionGroup(_('Erratum'))
m = _('if specified, the full details of an individual erratum are '
'displayed, and all other options are ignored except for '
'--repo-id.')
erratum_group.add_option(PulpCliOption('--erratum-id', m, required=False))
self.add_option_group(erratum_group)
开发者ID:hjensas,项目名称:pulp_rpm,代码行数:11,代码来源:contents.py
示例6: __init__
def __init__(
self,
options_bundle=None,
include_sync=True,
include_ssl=True,
include_proxy=True,
include_throttling=True,
include_unit_policy=True,
):
# If the caller didn't dork with any of the options, instantiate one with the defaults
self.options_bundle = options_bundle or OptionsBundle()
# Created now, but won't be added to the command until the include_* flags are checked.
# Stored as instance variables so a class using this mixin can further manipulate them.
self.sync_group = PulpCliOptionGroup(GROUP_NAME_SYNC)
self.ssl_group = PulpCliOptionGroup(GROUP_NAME_SSL)
self.proxy_group = PulpCliOptionGroup(GROUP_NAME_PROXY)
self.throttling_group = PulpCliOptionGroup(GROUP_NAME_THROTTLING)
self.unit_policy_group = PulpCliOptionGroup(GROUP_NAME_UNIT_POLICY)
if include_sync:
self.populate_sync_group()
self.add_option_group(self.sync_group)
if include_ssl:
self.populate_ssl_group()
self.add_option_group(self.ssl_group)
if include_proxy:
self.populate_proxy_group()
self.add_option_group(self.proxy_group)
if include_throttling:
self.populate_throttling_group()
self.add_option_group(self.throttling_group)
if include_unit_policy:
self.populate_unit_policy()
self.add_option_group(self.unit_policy_group)
开发者ID:mccun934,项目名称:pulp,代码行数:40,代码来源:importer_config.py
示例7: __init__
def __init__(self, name, description, method, context, renderer, override_config_options=()):
"""
Initialize the command, and call the superclass __init__().
:param name: The name of the command
:type name: basestring
:param description: The description of the command
:type description: basestring
:param method: The method to be run if the command is used
:type method: callable
:param context: The CLI context from Okaara
:type context: pulp.client.extensions.core.ClientContext
:param renderer: The renderer to be used to print progress reports
:type renderer: StatusRenderer
:param override_config_options: Additional options to be accepted from the user. These
options will override respective options from the default
config. Each entry should be either a PulpCliOption
or PulpCliFlag instance
:type override_config_options: tuple
"""
if method is None:
method = self.run
super(SyncPublishCommand, self).__init__(name, description, method, context)
self.renderer = renderer
self.add_option(options.OPTION_REPO_ID)
self.context = context
self.prompt = context.prompt
self.override_config_keywords = []
# Process and add config override options in their own group and save option keywords
if override_config_options:
override_config_group = PulpCliOptionGroup(_("Options"))
self.add_option_group(override_config_group)
for option in override_config_options:
override_config_group.add_option(option)
self.override_config_keywords.append(option.keyword)
开发者ID:BrnoPCmaniak,项目名称:pulp,代码行数:39,代码来源:sync_publish.py
示例8: __init__
def __init__(self, context, renderer, distributor_id, name='run', description=DESC_PUBLISH_RUN,
method=None, override_config_options=[]):
"""
:param context: Pulp client context
:type context: See okaara
:param renderer: StatusRenderer subclass that will interpret the sync or publish progress report
:type renderer: StatusRenderer
:param distributor_id: Id of a distributor to be used for publishing
:type distributor_id: str
:param override_config_options: Additional publish options to be accepted from user. These options will override
respective options from the default publish config.
:type override_config_options: List of PulpCliOption and PulpCliFlag instances
"""
if method is None:
method = self.run
super(RunPublishRepositoryCommand, self).__init__(name, description, method)
self.context = context
self.prompt = context.prompt
self.renderer = renderer
self.distributor_id = distributor_id
self.override_config_keywords = []
self.add_option(options.OPTION_REPO_ID)
self.create_flag('--' + NAME_BACKGROUND, DESC_BACKGROUND)
# Process and add config override options in their own group and save option keywords
if override_config_options:
override_config_group = PulpCliOptionGroup(_("Publish Options"))
self.add_option_group(override_config_group)
for option in override_config_options:
override_config_group.add_option(option)
self.override_config_keywords.append(option.keyword)
开发者ID:ryanschneider,项目名称:pulp,代码行数:38,代码来源:sync_publish.py
示例9: add_display_group
def add_display_group(command, default_fields):
"""
Adds the display group and all of its options to the given command.
"""
d = 'comma-separated list of fields to include for each unit; if unspecified all of the following will be displayed; '
d += 'valid fields: %(f)s'
description = _(d) % {'f' : ', '.join(default_fields)}
display_group = PulpCliOptionGroup(_('Display'))
display_group.add_option(PulpCliOption('--fields', description, aliases=['-f'], required=False, default=','.join(default_fields)))
display_group.add_option(PulpCliOption('--ascending', _('comma-separated list of fields to sort ascending; the order of the fields determines the order priority'), aliases=['-a'], required=False))
display_group.add_option(PulpCliOption('--descending', _('comma-separated list of fields to sort descending; ignored if --ascending is specified'), aliases=['-d'], required=False))
command.add_option_group(display_group)
开发者ID:stpierre,项目名称:pulp,代码行数:13,代码来源:pulp_cli.py
示例10: ISODistributorConfigMixin
class ISODistributorConfigMixin(object):
def __init__(self):
self.publishing_group = PulpCliOptionGroup(_('Publishing'))
d = _('if "true", the repository will be published over the HTTP protocol')
self.opt_http = PulpCliOption('--serve-http', d, required=False,
parse_func=parsers.parse_boolean)
d = _('if "true", the repository will be published over the HTTPS protocol')
self.opt_https = PulpCliOption('--serve-https', d, required=False,
parse_func=parsers.parse_boolean)
d = _('full path to the CA certificate that should be used to verify client authorization '
'certificates; setting this turns on client authorization for the repository')
self.opt_auth_ca = PulpCliOption('--auth-ca', d, required=False)
d = _(
'relative path the repository will be served from. Only alphanumeric characters, '
'forward slashes, underscores, and dashes are allowed.')
self.opt_relative_url = PulpCliOption('--relative-url', d, required=False)
self.publishing_group.add_option(self.opt_http)
self.publishing_group.add_option(self.opt_https)
self.publishing_group.add_option(self.opt_auth_ca)
self.publishing_group.add_option(self.opt_relative_url)
self.add_option_group(self.publishing_group)
def _parse_distributor_config(self, user_input):
"""
Generate an ISODistributor configuration based on the given parameters (user input).
:param user_input: The keys and values passed to the CLI by the user
:type user_input: dict
"""
key_tuples = (
(constants.CONFIG_SERVE_HTTP, self.opt_http.keyword),
(constants.CONFIG_SERVE_HTTPS, self.opt_https.keyword),
(constants.CONFIG_SSL_AUTH_CA_CERT, self.opt_auth_ca.keyword),
(constants.CONFIG_RELATIVE_URL, self.opt_relative_url.keyword),
)
config = {}
for config_key, input_key in key_tuples:
safe_parse(user_input, config, input_key, config_key)
arg_utils.convert_file_contents((constants.CONFIG_SSL_AUTH_CA_CERT,), config)
return config
开发者ID:ATIX-AG,项目名称:pulp_rpm,代码行数:46,代码来源:create_update.py
示例11: __init__
def __init__(self):
self.publishing_group = PulpCliOptionGroup(_('Publishing'))
d = _('if "true", the repository will be published over the HTTP protocol')
self.opt_http = PulpCliOption('--serve-http', d, required=False,
parse_func=parsers.parse_boolean)
d = _('if "true", the repository will be published over the HTTPS protocol')
self.opt_https = PulpCliOption('--serve-https', d, required=False,
parse_func=parsers.parse_boolean)
d = _('full path to the CA certificate that should be used to verify client authorization '
'certificates; setting this turns on client authorization for the repository')
self.opt_auth_ca = PulpCliOption('--auth-ca', d, required=False)
self.publishing_group.add_option(self.opt_http)
self.publishing_group.add_option(self.opt_https)
self.publishing_group.add_option(self.opt_auth_ca)
self.add_option_group(self.publishing_group)
开发者ID:asmacdo,项目名称:pulp_rpm,代码行数:18,代码来源:create_update.py
示例12: add_distributor_config_to_command
def add_distributor_config_to_command(command):
"""
Adds the repository configuration related options to the given command,
organizing them into the appropriate groups.
:param command: command to add options to
:type command: pulp.clients.extensions.extensions.PulpCliCommand
"""
publish_group = PulpCliOptionGroup(NAME_PUBLISHING)
publish_group.add_option(OPT_RELATIVE_URL)
publish_group.add_option(OPT_SERVE_HTTP)
publish_group.add_option(OPT_SERVE_HTTPS)
# Order added indicates order in usage, so pay attention to this order
# when dorking with it to make sure it makes sense
command.add_option_group(publish_group)
开发者ID:lsjostro,项目名称:pulp_win,代码行数:18,代码来源:repo_options.py
示例13: __init__
def __init__(self):
self.publishing_group = PulpCliOptionGroup(_('Publishing'))
d = _('if "true", the repository will be published over the HTTP protocol')
self.opt_http = PulpCliOption('--serve-http', d, required=False,
parse_func=parsers.parse_boolean)
d = _('if "true", the repository will be published over the HTTPS protocol')
self.opt_https = PulpCliOption('--serve-https', d, required=False,
parse_func=parsers.parse_boolean)
d = _('full path to the CA certificate that should be used to verify client authorization '
'certificates; setting this turns on client authorization for the repository')
self.opt_auth_ca = PulpCliOption('--auth-ca', d, required=False)
d = _(
'relative path the repository will be served from. Only alphanumeric characters, '
'forward slashes, underscores, and dashes are allowed.')
self.opt_relative_url = PulpCliOption('--relative-url', d, required=False)
self.publishing_group.add_option(self.opt_http)
self.publishing_group.add_option(self.opt_https)
self.publishing_group.add_option(self.opt_auth_ca)
self.publishing_group.add_option(self.opt_relative_url)
self.add_option_group(self.publishing_group)
开发者ID:ATIX-AG,项目名称:pulp_rpm,代码行数:23,代码来源:create_update.py
示例14: add_to_command
def add_to_command(command):
"""
Adds the repository configuration related options to the given command,
organizing them into the appropriate groups.
:param command: command to add options to
:type command: pulp.clients.extensions.extensions.PulpCliCommand
"""
# Groups
basic_group = PulpCliOptionGroup(NAME_BASIC)
publish_group = PulpCliOptionGroup(NAME_PUBLISHING)
# Order added indicates order in usage, so pay attention to this order when
# dorking with it to make sure it makes sense
command.add_option_group(basic_group)
command.add_option_group(publish_group)
# Metadata Options - Reorganized using standard commands
basic_group.add_option(std_options.OPTION_REPO_ID)
basic_group.add_option(std_options.OPTION_NAME)
basic_group.add_option(std_options.OPTION_DESCRIPTION)
basic_group.add_option(std_options.OPTION_NOTES)
# Publish Options
publish_group.add_option(OPT_RELATIVE_URL)
publish_group.add_option(OPT_SERVE_HTTP)
publish_group.add_option(OPT_SERVE_HTTPS)
publish_group.add_option(OPT_CHECKSUM_TYPE)
开发者ID:mccun934,项目名称:pulp_win,代码行数:29,代码来源:repo_options.py
示例15: add_repo_options
def add_repo_options(command, is_update):
"""
Adds options/flags for all repo configuration values (repo, importer, and
distributor). This is meant to be called for both create and update commands
to simplify consistency
@param command: command to add options to
"""
# Groups
basic_group = PulpCliOptionGroup('Basic')
throttling_group = PulpCliOptionGroup('Throttling')
ssl_group = PulpCliOptionGroup('Feed Authentication')
proxy_group = PulpCliOptionGroup('Feed Proxy')
sync_group = PulpCliOptionGroup('Synchronization')
publish_group = PulpCliOptionGroup('Publishing')
repo_auth_group = PulpCliOptionGroup('Client Authentication')
# Order added indicates order in usage, so pay attention to this order when
# dorking with it to make sure it makes sense
command.add_option_group(basic_group)
command.add_option_group(sync_group)
command.add_option_group(publish_group)
command.add_option_group(ssl_group)
command.add_option_group(repo_auth_group)
command.add_option_group(proxy_group)
command.add_option_group(throttling_group)
# Metadata Options
basic_group.add_option(PulpCliOption('--repo-id', 'uniquely identifies the repository; only alphanumeric, -, and _ allowed', required=True))
basic_group.add_option(PulpCliOption('--feed', 'URL of the external source repository to sync', required=False))
basic_group.add_option(PulpCliOption('--display-name', 'user-readable display name for the repository', required=False))
basic_group.add_option(PulpCliOption('--description', 'user-readable description of the repo\'s contents', required=False))
d = 'adds/updates/deletes key-value pairs to programmatically identify the repository; '
d += 'pairs must be separated by an equal sign (e.g. key=value); multiple notes can '
d += 'be %(i)s by specifying this option multiple times; notes are deleted by '
d += 'specifying "" as the value'
d = _(d)
if is_update:
d = d % {'i' : _('changed')}
else:
d = d % {'i' : _('added')}
basic_group.add_option(PulpCliOption('--note', d, required=False, allow_multiple=True))
d = 'if "true", on each successful sync the repository will automatically be ' \
'published on the configured protocols; if "false" synchronized content will ' \
'only be available after manually publishing the repository; defaults to "true"'
basic_group.add_option(PulpCliOption('--auto-publish', _(d), required=False))
# Synchronization Options
sync_group.add_option(PulpCliOption('--only-newest', 'if "true", only the newest version of a given package is downloaded; defaults to false', required=False))
sync_group.add_option(PulpCliOption('--skip-types', 'comma-separated list of types to omit when synchronizing, if not specified all types will be synchronized; valid values are: %s' % ', '.join(VALID_SKIP_TYPES), required=False))
sync_group.add_option(PulpCliOption('--verify-size', 'if "true", the size of each synchronized file will be verified against the repo metadata; defaults to false', required=False))
sync_group.add_option(PulpCliOption('--verify-checksum', 'if "true", the checksum of each synchronized file will be verified against the repo metadata; defaults to false', required=False))
sync_group.add_option(PulpCliOption('--remove-old', 'if "true", removes old packages from the repo; defaults to false', required=False))
sync_group.add_option(PulpCliOption('--retain-old-count', 'count indicating how many old rpm versions to retain; defaults to 0; this count only takes effect when remove-old option is set to true.', required=False))
# Proxy Options
proxy_group.add_option(PulpCliOption('--proxy-url', 'URL to the proxy server to use', required=False))
proxy_group.add_option(PulpCliOption('--proxy-port', 'port on the proxy server to make requests', required=False))
proxy_group.add_option(PulpCliOption('--proxy-user', 'username used to authenticate with the proxy server', required=False))
proxy_group.add_option(PulpCliOption('--proxy-pass', 'password used to authenticate with the proxy server', required=False))
# Throttling Options
throttling_group.add_option(PulpCliOption('--max-speed', 'maximum bandwidth used per download thread, in KB/sec, when synchronizing the repo', required=False))
throttling_group.add_option(PulpCliOption('--num-threads', 'number of threads that will be used to synchronize the repo', required=False))
# SSL Options
ssl_group.add_option(PulpCliOption('--feed-ca-cert', 'full path to the CA certificate that should be used to verify the external repo server\'s SSL certificate', required=False))
ssl_group.add_option(PulpCliOption('--verify-feed-ssl', 'if "true", the feed\'s SSL certificate will be verified against the feed_ca_cert; defaults to false', required=False))
ssl_group.add_option(PulpCliOption('--feed-cert', 'full path to the certificate to use for authentication when accessing the external feed', required=False))
ssl_group.add_option(PulpCliOption('--feed-key', 'full path to the private key for feed_cert', required=False))
# Publish Options
publish_group.add_option(PulpCliOption('--relative-url', 'relative path the repository will be served from; defaults to relative path of the feed URL', required=False))
publish_group.add_option(PulpCliOption('--serve-http', 'if "true", the repository will be served over HTTP; defaults to false', required=False))
publish_group.add_option(PulpCliOption('--serve-https', 'if "true", the repository will be served over HTTPS; defaults to true', required=False))
publish_group.add_option(PulpCliOption('--checksum-type', 'type of checksum to use during metadata generation', required=False))
publish_group.add_option(PulpCliOption('--gpg-key', 'GPG key used to sign and verify packages in the repository', required=False))
publish_group.add_option(PulpCliOption('--regenerate-metadata', 'if "true", when the repository is published the repo metadata will be regenerated instead of reusing the metadata downloaded from the feed; defaults to true', required=False))
# Publish Security Options
repo_auth_group.add_option(PulpCliOption('--host-ca', 'full path to the CA certificate that signed the repository hosts\'s SSL certificate when serving over HTTPS', required=False))
repo_auth_group.add_option(PulpCliOption('--auth-ca', 'full path to the CA certificate that should be used to verify client authentication certificates; setting this turns on client authentication for the repository', required=False))
repo_auth_group.add_option(PulpCliOption('--auth-cert', 'full path to the entitlement certificate that will be given to bound consumers to grant access to this repository', required=False))
开发者ID:ehelms,项目名称:pulp,代码行数:87,代码来源:pulp_cli.py
示例16: add_to_command
def add_to_command(command):
"""
Adds the repository configuration related options to the given command,
organizing them into the appropriate groups.
:param command: command to add options to
:type command: pulp.clients.extensions.extensions.PulpCliCommand
"""
# Groups
basic_group = PulpCliOptionGroup(NAME_BASIC)
throttling_group = PulpCliOptionGroup(NAME_THROTTLING)
ssl_group = PulpCliOptionGroup(NAME_FEED)
proxy_group = PulpCliOptionGroup(NAME_PROXY)
sync_group = PulpCliOptionGroup(NAME_SYNC)
publish_group = PulpCliOptionGroup(NAME_PUBLISHING)
repo_auth_group = PulpCliOptionGroup(NAME_AUTH)
# Order added indicates order in usage, so pay attention to this order when
# dorking with it to make sure it makes sense
command.add_option_group(basic_group)
command.add_option_group(sync_group)
command.add_option_group(publish_group)
command.add_option_group(ssl_group)
command.add_option_group(repo_auth_group)
command.add_option_group(proxy_group)
command.add_option_group(throttling_group)
# Metadata Options - Reorganized using standard commands
basic_group.add_option(std_options.OPTION_REPO_ID)
basic_group.add_option(std_options.OPTION_NAME)
basic_group.add_option(std_options.OPTION_DESCRIPTION)
basic_group.add_option(std_options.OPTION_NOTES)
# Synchronization Options
sync_group.add_option(OPT_FEED)
sync_group.add_option(OPT_NEWEST)
sync_group.add_option(OPT_SKIP)
sync_group.add_option(OPT_VERIFY_SIZE)
sync_group.add_option(OPT_VERIFY_CHECKSUM)
sync_group.add_option(OPT_REMOVE_OLD)
sync_group.add_option(OPT_RETAIN_OLD_COUNT)
# Proxy Options
proxy_group.add_option(OPT_PROXY_URL)
proxy_group.add_option(OPT_PROXY_PORT)
proxy_group.add_option(OPT_PROXY_USER)
proxy_group.add_option(OPT_PROXY_PASS)
# Throttling Options
throttling_group.add_option(OPT_MAX_SPEED)
throttling_group.add_option(OPT_NUM_THREADS)
# SSL Options
ssl_group.add_option(OPT_FEED_CA_CERT)
ssl_group.add_option(OPT_VERIFY_FEED_SSL)
ssl_group.add_option(OPT_FEED_CERT)
ssl_group.add_option(OPT_FEED_KEY)
# Publish Options
# The server-side APIs don't allow this to be updated, so hide it as an
# option entirely; RPM repos are always published automatically with our
# CLI until we clean that up. jdob, Sept 24, 2012
# publish_group.add_option(OPT_AUTO_PUBLISH)
publish_group.add_option(OPT_RELATIVE_URL)
publish_group.add_option(OPT_SERVE_HTTP)
publish_group.add_option(OPT_SERVE_HTTPS)
publish_group.add_option(OPT_CHECKSUM_TYPE)
publish_group.add_option(OPT_GPG_KEY)
# Publish Security Options
repo_auth_group.add_option(OPT_HOST_CA)
repo_auth_group.add_option(OPT_AUTH_CA)
repo_auth_group.add_option(OPT_AUTH_CERT)
开发者ID:jwmatthews,项目名称:pulp_rpm,代码行数:76,代码来源:repo_options.py
示例17: add_distributor_config_to_command
def add_distributor_config_to_command(command):
publish_group = PulpCliOptionGroup(NAME_PUBLISHING)
repo_auth_group = PulpCliOptionGroup(NAME_AUTH)
# The server-side APIs don't allow this to be updated, so hide it as an
# option entirely; RPM repos are always published automatically with our
# CLI until we clean that up. jdob, Sept 24, 2012
# publish_group.add_option(OPT_AUTO_PUBLISH)
publish_group.add_option(OPT_RELATIVE_URL)
publish_group.add_option(OPT_SERVE_HTTP)
publish_group.add_option(OPT_SERVE_HTTPS)
publish_group.add_option(OPT_CHECKSUM_TYPE)
publish_group.add_option(OPT_GPG_KEY)
publish_group.add_option(OPT_GENERATE_SQLITE)
# Order added indicates order in usage, so pay attention to this order when
# dorking with it to make sure it makes sense
command.add_option_group(publish_group)
command.add_option_group(repo_auth_group)
# Publish Security Options
repo_auth_group.add_option(OPT_HOST_CA)
repo_auth_group.add_option(OPT_AUTH_CA)
repo_auth_group.add_option(OPT_AUTH_CERT)
开发者ID:AndreaGiardini,项目名称:pulp_rpm,代码行数:25,代码来源:repo_options.py
示例18: ImporterConfigMixin
class ImporterConfigMixin(object):
"""
Mixin to add to a command that will provide options on the CLI to accept the standard
configuration values for a Pulp importer. This mixin also provides a method to parse
the submitted user input and generate a config dict suitable for an importer
config values. The produced configuration uses the keys in
pulp.common.plugins.importer_constants.
Touch points are provided to manipulate the options created by this mixin for each group
(the populate_* methods). If options are added through overridden versions of those methods,
the corresponding parse_* method should be updated to read those.
The option groups are also stored as instance variables, further allowing the subclass
the ability to manipulate them.
The option instances that will be used in this mixin are contained in an OptionsBundle
instance. If no changes to the option defaults are required, this can be omitted from
this object's instantiation. If tweaks to the options are required, they should be done
in an instance of OptionsBundle and then passed to this class at instantiation.
This mixin must be used in a class that subclasses PulpCliCommand as well. The usage is as
follows:
* Define a class that extends both PulpCliCommand and ImporterConfigMixin.
* Call the ImporterConfigMixin.__init__ method in its constructor. This will add the
necessary options to the command.
* In the execution method of the command, run parse_user_input(), passing in the args
parsed from the user input. The result of that is a dict that can be used server-side
to configure an importer.
"""
def __init__(self,
options_bundle=None,
include_sync=True,
include_ssl=True,
include_proxy=True,
include_throttling=True,
include_unit_policy=True):
# If the caller didn't dork with any of the options, instantiate one with the defaults
self.options_bundle = options_bundle or OptionsBundle()
# Created now, but won't be added to the command until the include_* flags are checked.
# Stored as instance variables so a class using this mixin can further manipulate them.
self.sync_group = PulpCliOptionGroup(GROUP_NAME_SYNC)
self.ssl_group = PulpCliOptionGroup(GROUP_NAME_SSL)
self.proxy_group = PulpCliOptionGroup(GROUP_NAME_PROXY)
self.throttling_group = PulpCliOptionGroup(GROUP_NAME_THROTTLING)
self.unit_policy_group = PulpCliOptionGroup(GROUP_NAME_UNIT_POLICY)
if include_sync:
self.populate_sync_group()
self.add_option_group(self.sync_group)
if include_ssl:
self.populate_ssl_group()
self.add_option_group(self.ssl_group)
if include_proxy:
self.populate_proxy_group()
self.add_option_group(self.proxy_group)
if include_throttling:
self.populate_throttling_group()
self.add_option_group(self.throttling_group)
if include_unit_policy:
self.populate_unit_policy()
self.add_option_group(self.unit_policy_group)
def populate_sync_group(self):
"""
Adds options to the synchronization group. This is only called if the include_sync flag is
set to True in the constructor.
"""
self.sync_group.add_option(self.options_bundle.opt_feed)
self.sync_group.add_option(self.options_bundle.opt_validate)
def populate_ssl_group(self):
"""
Adds options to the SSL group. This is only called if the include_ssl flag is
set to True in the constructor.
"""
self.ssl_group.add_option(self.options_bundle.opt_feed_ca_cert)
self.ssl_group.add_option(self.options_bundle.opt_verify_feed_ssl)
self.ssl_group.add_option(self.options_bundle.opt_feed_cert)
self.ssl_group.add_option(self.options_bundle.opt_feed_key)
def populate_proxy_group(self):
"""
Adds options to the proxy group. This is only called if the include_proxy flag is
set to True in the constructor.
"""
self.proxy_group.add_option(self.options_bundle.opt_proxy_host)
self.proxy_group.add_option(self.options_bundle.opt_proxy_port)
self.proxy_group.add_option(self.options_bundle.opt_proxy_user)
self.proxy_group.add_option(self.options_bundle.opt_proxy_pass)
def populate_throttling_group(self):
"""
Adds options to the throttling group. This is only called if the include_throttling flag is
#.........这里部分代码省略.........
开发者ID:hgschmie,项目名称:pulp,代码行数:101,代码来源:importer_config.py
注:本文中的pulp.client.extensions.extensions.PulpCliOptionGroup类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论