How to use the pulp.client.extensions.extensions.PulpCliOption function in PuLP

To help you get started, we’ve selected a few PuLP examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pulp / pulp / client_admin / pulp / client / admin / event.py View on Github external
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)
github pulp / pulp / rpm-support / src / pulp_rpm / extension / admin / export.py View on Github external
from pulp.client.commands.repo.sync_publish import RunPublishRepositoryCommand
from pulp.client.extensions.extensions import PulpCliOption

from pulp_rpm.common import ids
from pulp_rpm.extension.admin.status import RpmIsoStatusRenderer

# -- commands -----------------------------------------------------------------

DESC_EXPORT_RUN = _('triggers an immediate ISO export of a repository')

DESC_ISO_PREFIX = _('prefix to use in the generated iso naming, default: -.iso')
OPTION_ISO_PREFIX = PulpCliOption('--iso-prefix', DESC_ISO_PREFIX, required=False)

DESC_START_DATE = _('start date for errata export; only errata whose issued date is on or after the given value will be included in the generated iso; format: "2009-03-30 00:00:00"')
OPTION_START_DATE = PulpCliOption('--start-date', DESC_START_DATE, required=False)

DESC_END_DATE = _('end date for errata export; only errata whose issued date is on or before the given value will be included in the generated iso; format: "2011-03-30 00:00:00"')
OPTION_END_DATE = PulpCliOption('--end-date', DESC_END_DATE, required=False)

class RpmIsoExportCommand(RunPublishRepositoryCommand):
    def __init__(self, context):
        override_config_options = [OPTION_ISO_PREFIX, OPTION_START_DATE, OPTION_END_DATE]

        super(RpmIsoExportCommand, self).__init__(context=context, 
                                                  renderer=RpmIsoStatusRenderer(context),
                                                  distributor_id=ids.TYPE_ID_DISTRIBUTOR_ISO, 
                                                  description=DESC_EXPORT_RUN,
                                                  override_config_options=override_config_options)
github pulp / pulp / client_lib / pulp / client / commands / criteria.py View on Github external
))

        m = _('matches resources whose value for the specified field is greater than or equal to '
              'the given value')
        filter_group.add_option(PulpCliOption(
            '--gte', m, required=False, allow_multiple=True, parse_func=self._parse_key_value
        ))

        m = _('matches resources whose value for the specified field is less than the given value')
        filter_group.add_option(PulpCliOption(
            '--lt', m, required=False, allow_multiple=True, parse_func=self._parse_key_value
        ))

        m = _('matches resources whose value for the specified field is less than or equal to the '
              'given value')
        filter_group.add_option(PulpCliOption(
            '--lte', m, required=False, allow_multiple=True, parse_func=self._parse_key_value
        ))

        self.add_option_group(filter_group)
github pulp / pulpcore / builtins / extensions / consumer / pulp_consumer / pulp_cli.py View on Github external
def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.history)
        self.context = context
        self.prompt = context.prompt

        d = 'limits displayed history entries to the given type;'
        d += 'supported types: ("consumer_registered", "consumer_unregistered", "repo_bound", "repo_unbound",'
        d += '"content_unit_installed", "content_unit_uninstalled", "unit_profile_changed", "added_to_group",'
        d += '"removed_from_group")'
        self.add_option(PulpCliOption('--event-type', _(d), required=False))
        self.add_option(PulpCliOption('--limit', 'limits displayed history entries to the given amount (must be greater than zero)', required=False))
        self.add_option(PulpCliOption('--sort', 'indicates the sort direction ("ascending" or "descending") based on the entry\'s timestamp', required=False))
        self.add_option(PulpCliOption('--start-date', 'only return entries that occur on or after the given date in iso8601 format (yyyy-mm-ddThh:mm:ssZ)', required=False))
        self.add_option(PulpCliOption('--end-date', 'only return entries that occur on or before the given date in iso8601 format (yyyy-mm-ddThh:mm:ssZ)', required=False))
github pulp / pulpcore / client_admin / pulp / client / admin / auth.py View on Github external
id_option = PulpCliOption('--role-id', 'uniquely identifies the role; only alphanumeric, '
                                  ' -, and _ allowed',
                                  required=True, validate_func=validators.id_validator)

        # Create command
        create_command = PulpCliCommand('create', 'creates a role', self.create)
        create_command.add_option(id_option)
        create_command.add_option(PulpCliOption('--display-name', 'user-friendly name for the role',
                                                required=False))
        create_command.add_option(PulpCliOption('--description', 'user-friendly text describing '
                                                'the role', required=False))
        self.add_command(create_command)

        # Update command
        update_command = PulpCliCommand('update', 'updates a role', self.update)
        update_command.add_option(PulpCliOption('--role-id', 'identifies the role to be updated',
                                                required=True))
        update_command.add_option(PulpCliOption('--display-name', 'user-friendly name for the role',
                                                required=False))
        update_command.add_option(PulpCliOption('--description', 'user-friendly text describing '
                                                'the role', required=False))
        self.add_command(update_command)

        # Delete Command
        delete_command = PulpCliCommand('delete', 'deletes a role', self.delete)
        delete_command.add_option(PulpCliOption('--role-id', 'identifies the role to be deleted',
                                                required=True))
        self.add_command(delete_command)

        # List Command
        list_command = PulpCliCommand('list', 'lists summary of roles on the Pulp server',
                                      self.list)
github pulp / pulpcore / client_lib / pulp / client / commands / repo / importer_config.py View on Github external
def __init__(self):

        # -- synchronization options --------------------------------------------------

        d = _('URL of the external source repository to sync')
        self.opt_feed = PulpCliOption('--feed', d, required=False)

        d = _('if "true", the size and checksum of each synchronized file will be verified against '
              'the repo metadata')
        self.opt_validate = PulpCliOption('--validate', d, required=False,
                                          parse_func=parsers.pulp_parse_optional_boolean)

        # -- proxy options ------------------------------------------------------------

        d = _('proxy server url to use')
        self.opt_proxy_host = PulpCliOption('--proxy-host', d, required=False)

        d = _('port on the proxy server to make requests')
        self.opt_proxy_port = PulpCliOption('--proxy-port', d, required=False,
                                            parse_func=parsers.pulp_parse_optional_positive_int)

        d = _('username used to authenticate with the proxy server')
github pulp / pulp_rpm / extensions_admin / pulp_rpm / extensions / admin / export.py View on Github external
'the server; the progress can be later displayed using the status command')
# These two flags exist because there is currently no place to configure group publishes
DESC_SERVE_HTTP = _('the ISO images will be served over HTTP; default to False; if '
                    'this export is to a directory, this has no effect.')
DESC_SERVE_HTTPS = _('the ISO images will be served over HTTPS; defaults to True; if '
                     'this export is to a directory, this has no effect.')
DESC_MANIFEST = _('if this flag is used, a PULP_MANIFEST file will be created')
DESC_INCREMENTAL_MD = _('if this flag is used, incremental exports will use yum repodata'
                        ' metadata instead of json.')

# The iso prefix is restricted to the same character set as an id, so we use the id_validator
OPTION_ISO_PREFIX = PulpCliOption('--iso-prefix', DESC_ISO_PREFIX, required=False,
                                  validate_func=validators.id_validator)
OPTION_START_DATE = PulpCliOption('--start-date', DESC_START_DATE, required=False,
                                  validate_func=validators.iso8601_datetime_validator)
OPTION_END_DATE = PulpCliOption('--end-date', DESC_END_DATE, required=False,
                                validate_func=validators.iso8601_datetime_validator)
OPTION_EXPORT_DIR = PulpCliOption('--export-dir', DESC_EXPORT_DIR, required=False)
OPTION_RELATIVE_URL = PulpCliOption('--relative-url', DESC_RELATIVE_URL, required=False)
OPTION_ISO_SIZE = PulpCliOption('--iso-size', DESC_ISO_SIZE, required=False,
                                parse_func=parsers.parse_optional_positive_int)
OPTION_SERVE_HTTPS = PulpCliOption('--serve-https', DESC_SERVE_HTTPS, required=False,
                                   default='true', parse_func=parsers.parse_boolean)
OPTION_SERVE_HTTP = PulpCliOption('--serve-http', DESC_SERVE_HTTP, required=False, default='false',
                                  parse_func=parsers.parse_boolean)
FLAG_MANIFEST = PulpCliFlag('--' + constants.CREATE_PULP_MANIFEST, DESC_MANIFEST, ['-m'])
OPTION_INCREMENTAL_MD = PulpCliOption('--incremental-export-repomd', DESC_INCREMENTAL_MD,
                                      required=False, default='false',
                                      parse_func=parsers.parse_boolean)


class RpmExportCommand(RunPublishRepositoryCommand):
github pulp / pulp_rpm / extensions_admin / pulp_rpm / extensions / admin / upload / errata.py View on Github external
OPT_TITLE = PulpCliOption('--title', d, aliases=['-n'], required=True)

d = _('description of the erratum')
OPT_DESC = PulpCliOption('--description', d, aliases=['-d'], required=True)

d = _('version of the erratum')
OPT_VERSION = PulpCliOption('--version', d, required=True)

d = _('release of the erratum')
OPT_RELEASE = PulpCliOption('--release', d, required=True)

d = _('type of the erratum; examples: "bugzilla", "security", "enhancement"')
OPT_TYPE = PulpCliOption('--type', d, aliases=['-t'], required=True)

d = _('status of the erratum; examples: "final"')
OPT_STATUS = PulpCliOption('--status', d, aliases=['-s'], required=True)

d = _('timestamp the erratum was last updated; expected format "YYYY-MM-DD HH:MM:SS"')
OPT_UPDATED = PulpCliOption('--updated', d, aliases=['-u'], required=True)

d = _('timestamp the erratum was issued; expected format "YYYY-MM-DD HH:MM:SS"')
OPT_ISSUED = PulpCliOption('--issued', d, required=True)

d = _('path to a CSV file containing reference information. '
      'An example of a reference would be information of a bugzilla issue. '
      'Format for each entry is: "href,type,id,title"')
OPT_REFERENCE = PulpCliOption('--reference-csv', d, aliases=['-r'], required=False)

d = _('path to a CSV file containing package list information. '
      'Format for each entry is: "name,version,release,epoch,arch,filename,checksum,'
      'checksum_type,sourceurl"')
OPT_PKG_LIST = PulpCliOption('--pkglist-csv', d, aliases=['-p'], required=True)
github pulp / pulpcore / client_lib / pulp / client / commands / options.py View on Github external
DESC_ID = _('unique identifier; only alphanumeric, -, and _ allowed')
DESC_ID_ALLOWING_DOTS = _('unique identifier; only alphanumeric, ., -, and _ allowed')
DESC_NAME = _('user-readable display name (may contain i18n characters)')
DESC_DESCRIPTION = _('user-readable description (may contain i18n characters)')
DESC_NOTE = _(
    'adds/updates/deletes notes to programmatically identify the resource; '
    'key-value pairs must be separated by an equal sign (e.g. key=value); multiple notes can '
    'be changed by specifying this option multiple times; notes are deleted by '
    'specifying "" as the value')
DESC_ALL = _('match all records. If other filters are specified, they will be '
             'applied. This option is only useful when you need to explicitly '
             'request that no filters be applied.')

# General Resource
OPTION_NAME = PulpCliOption('--display-name', DESC_NAME, required=False)
OPTION_DESCRIPTION = PulpCliOption('--description', DESC_DESCRIPTION, required=False)
OPTION_NOTES = PulpCliOption('--note', DESC_NOTE, required=False,
                             allow_multiple=True, parse_func=parsers.parse_notes)

# IDs
OPTION_REPO_ID = PulpCliOption('--repo-id', DESC_ID_ALLOWING_DOTS, required=True,
                               validate_func=validators.id_validator_allow_dots)
OPTION_GROUP_ID = PulpCliOption('--group-id', DESC_ID, required=True,
                                validate_func=validators.id_validator)
OPTION_CONSUMER_ID = PulpCliOption('--consumer-id', DESC_ID_ALLOWING_DOTS, required=True,
                                   validate_func=validators.id_validator_allow_dots)
OPTION_CONTENT_SOURCE_ID = PulpCliOption('--source-id', DESC_ID, aliases=['-s'], required=False,
                                         validate_func=validators.id_validator)
FLAG_ALL = PulpCliFlag('--all', DESC_ALL)
github pulp / pulp / client_consumer / pulp / client / consumer / cli.py View on Github external
name_option = PulpCliOption('--display-name', _(d), required=False)

    d = 'user-readable description for the consumer'
    description_option = PulpCliOption('--description', _(d), 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)

    update_note_d = d % {'i' : _('changed')}
    add_note_d =  d % {'i' : _('added')}

    update_note_option = PulpCliOption('--note', update_note_d, required=False, allow_multiple=True)
    add_note_option = PulpCliOption('--note', add_note_d, required=False, allow_multiple=True)

    # Register Command
    d = 'registers this consumer to the Pulp server'
    register_command = RegisterCommand(context, 'register', _(d))
    register_command.add_option(id_option)
    register_command.add_option(name_option)
    register_command.add_option(description_option)
    register_command.add_option(add_note_option)
    context.cli.add_command(register_command)

    # Update Command
    d = 'changes metadata of this consumer'
    update_command = UpdateCommand(context, 'update', _(d))
    update_command.add_option(name_option)
    update_command.add_option(description_option)
    update_command.add_option(update_note_option)