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) publish_group.add_option(OPT_REPOVIEW) # 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)
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 __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)
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)
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 __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 """ 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)
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)
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)