Esempio n. 1
0
File: cli.py Progetto: pombreda/pulp
    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))
Esempio n. 2
0
 def __init__(self, context, name, description):
     PulpCliCommand.__init__(self, name, description, self.unbind)
     self.context = context
     self.prompt = context.prompt
     self.add_option(PulpCliOption('--repo-id', 'repository id', required=True))
     self.add_option(PulpCliFlag('--force', 'delete the binding immediately and discontinue '
                                            'tracking consumer actions'))
Esempio n. 3
0
    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; supported types: '
             '("consumer_registered", "consumer_unregistered", "repo_bound", "repo_unbound",'
             '"content_unit_installed", "content_unit_uninstalled", "unit_profile_changed", '
             '"added_to_group", "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))
Esempio n. 4
0
    def __init__(self, method, name=None, description=None, filtering=True,
                 include_search=True, *args, **kwargs):
        """
        :param name: name used to invoke the command
        :type  name: str
        :param description: user-readable text describing the command
        :type  description: str
        :param method:  A method to call when this command is executed. See
                        okaara docs for more info
        :type  method:  callable
        :param filtering:   if True, the command will add all filtering options
        :type  filtering:   bool
        :param include_search: if True, the command will add all non-filter
                               criteria options such as limit, seek, sort, etc.
        :type  include_search: bool
        """
        name = name or kwargs.pop('name', None) or 'search'
        description = description or kwargs.pop('description', None) or _SEARCH_DESCRIPTION

        PulpCliCommand.__init__(self, name, description, method, **kwargs)

        # Hang on to these so unit tests can verify the command is configuration
        self.filtering = filtering
        self.include_search = include_search

        if filtering:
            self.add_filtering()
        if include_search:
            self.add_display_criteria_options()
Esempio n. 5
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.unbind)
        self.context = context
        self.prompt = context.prompt

        self.add_option(PulpCliOption('--repo-id', 'repository id', required=True))
        self.add_option(PulpCliOption('--distributor-id', 'distributor id', required=True))
Esempio n. 6
0
    def __init__(self, method, name=None, description=None, filtering=True,
                 include_search=True, *args, **kwargs):
        """
        :param name: name used to invoke the command
        :type  name: str
        :param description: user-readable text describing the command
        :type  description: str
        :param method:  A method to call when this command is executed. See
                        okaara docs for more info
        :type  method:  callable
        :param filtering:   if True, the command will add all filtering options
        :type  filtering:   bool
        :param include_search: if True, the command will add all non-filter
                               criteria options such as limit, seek, sort, etc.
        :type  include_search: bool
        """
        name = name or kwargs.pop('name', None) or 'search'
        description = description or kwargs.pop('description', None) or _SEARCH_DESCRIPTION

        PulpCliCommand.__init__(self, name, description, method, **kwargs)

        # Hang on to these so unit tests can verify the command is configuration
        self.filtering = filtering
        self.include_search = include_search

        if filtering:
            self.add_filtering()
        if include_search:
            self.add_display_criteria_options()
Esempio n. 7
0
    def __init__(self, context, strategy, name, description):
        PulpCliCommand.__init__(self, name, description, self.delete)
        self.context = context
        self.strategy = strategy

        d = 'identifies the schedule to delete'
        self.create_option('--schedule-id', _(d), required=True)
Esempio n. 8
0
    def __init__(self, context, strategy, name=NAME_CREATE, description=DESC_CREATE):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_option(OPT_SCHEDULE)
        self.add_option(OPT_FAILURE_THRESHOLD)
Esempio n. 9
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.create)
        self.context = context
        self.prompt = context.prompt

        d = "identifies the repository the package category will be created in"
        self.create_option("--repo-id", _(d), required=True)

        d = "id of this package category"
        self.create_option("--category-id", _(d), aliases=["-i"], required=True)

        d = "name of this package category"
        self.create_option("--name", _(d), aliases=["-n"], required=True)

        d = "description of this package category"
        self.create_option("--description", _(d), aliases=["-d"], required=True)

        d = "display order for this package category"
        self.create_option("--display-order", _(d), allow_multiple=False, required=False, default=0)

        d = "package group ids to include in this package category"
        self.create_option("--group", _(d), aliases=["-g"], allow_multiple=True, required=False)

        d = "display extra information about the creation process"
        self.create_flag("-v", _(d))
Esempio n. 10
0
    def __init__(self, context):
        desc = 'updates an existing repository\'s configuration'
        PulpCliCommand.__init__(self, 'update', desc, self.update)

        self.context = context

        add_repo_options(self, True)
Esempio n. 11
0
    def __init__(self, context):
        desc = 'creates a new repository that is configured to sync and publish RPM related content'
        PulpCliCommand.__init__(self, 'create', desc, self.create)

        self.context = context

        add_repo_options(self, False)
Esempio n. 12
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.bind)
        self.context = context
        self.prompt = context.prompt

        self.add_option(
            PulpCliOption('--repo-id', 'repository id', required=True))
Esempio n. 13
0
File: polling.py Progetto: omps/pulp
    def __init__(self, name, description, method, context, poll_frequency_in_seconds=None):
        """
        :param name: command name
        :type  name: str
        :param description: command description
        :type  description: str
        :param method: method that will be fun when the command is invoked
        :type  method: function
        :param context: client context
        :type  context: pulp.client.extensions.core.ClientContext
        :param poll_frequency_in_seconds: time between polling calls to the server
        :type  poll_frequency_in_seconds: float
        """
        PulpCliCommand.__init__(self, name, description, method)
        self.context = context
        self.prompt = context.prompt

        self.poll_frequency_in_seconds = poll_frequency_in_seconds
        if poll_frequency_in_seconds is None:
            self.poll_frequency_in_seconds = float(self.context.config['output']['poll_frequency_in_seconds'])

        self.add_flag(FLAG_BACKGROUND)

        #list of tasks we already know about
        self.known_tasks = set()
Esempio n. 14
0
    def __init__(self, context, strategy, name, description):
        PulpCliCommand.__init__(self, name, description, self.add)
        self.context = context
        self.strategy = strategy

        self.create_option('--schedule', SCHEDULE_DESCRIPTION, aliases=['-s'], required=True)
        self.create_option('--failure-threshold', FAILURE_THRESHOLD_DESCRIPTION, aliases=['-f'], required=False)
Esempio n. 15
0
    def __init__(self, context):
        d = _('login and download a session certificate')
        PulpCliCommand.__init__(self, 'login', d, self.login)

        self.context = context

        self.create_option('--username', _('server account username'), aliases=['-u'], required=True)
        self.create_option('--password', _('server account password'), aliases=['-p'], required=False)
Esempio n. 16
0
File: cli.py Progetto: pombreda/pulp
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.unregister)
        self.context = context
        self.prompt = context.prompt

        d = 'if specified, the local consumer identification certificate will be '\
            'removed even if the server cannot be contacted'
        self.create_flag('--force', _(d))
Esempio n. 17
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.unregister)
        self.context = context
        self.prompt = context.prompt

        d = 'if specified, the local consumer identification certificate will be '\
            'removed even if the server cannot be contacted'
        self.create_flag('--force', _(d))
Esempio n. 18
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.cancel)
        self.context = context

        d = 'removes the client-side tracking file for the upload regardless of ' \
        'whether or not it was able to be deleted on the server; this should ' \
        'only be used in the event that the server\'s knowledge of an upload ' \
        'has been removed'
        self.create_flag('--force', _(d))
Esempio n. 19
0
    def __init__(self, context):
        """
        :param context: The client context.
        :type context: pulp.client.extensions.core.ClientContext
        """
        PulpCliCommand.__init__(self, self.NAME, self.DESCRIPTION, self.status)

        self.context = context
        self.api = context.server.server_status
Esempio n. 20
0
    def __init__(self, context):
        """
        :param context: The client context.
        :type context: pulp.client.extensions.core.ClientContext
        """
        PulpCliCommand.__init__(self, self.NAME, self.DESCRIPTION, self.status)

        self.context = context
        self.api = context.server.server_status
Esempio n. 21
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context

        # Add options and groups
        add_required_group(self)
        add_erratum_group(self)
        add_display_group(self, FIELDS_ERRATA)
        add_pagination_group(self)
Esempio n. 22
0
 def __init__(self, context, name, description):
     PulpCliCommand.__init__(self, name, description, self.unbind)
     self.context = context
     self.prompt = context.prompt
     self.add_option(
         PulpCliOption('--repo-id', 'repository id', required=True))
     self.add_option(
         PulpCliFlag(
             '--force', 'delete the binding immediately and discontinue '
             'tracking consumer actions'))
Esempio n. 23
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.unbind)
        self.context = context
        self.prompt = context.prompt

        self.add_option(PulpCliOption("--repo-id", "repository id", required=True))
        self.add_option(PulpCliOption("--distributor-id", "distributor id", required=True))
        self.add_option(
            PulpCliFlag("--force", _("delete the binding immediately and discontinue tracking consumer actions"))
        )
Esempio n. 24
0
    def __init__(self,
                 context,
                 strategy,
                 name=NAME_LIST,
                 description=DESC_LIST):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_flag(FLAG_DETAILS)
Esempio n. 25
0
    def __init__(self, context, upload_manager, name='list', description=DESC_LIST, method=None):

        if method is None:
            method = self.run

        PulpCliCommand.__init__(self, name, description, method)

        self.context = context
        self.prompt = context.prompt
        self.upload_manager = upload_manager
Esempio n. 26
0
    def __init__(self, context, upload_manager, name="resume", description=DESC_RESUME, method=None):

        if method is None:
            method = self.run

        PulpCliCommand.__init__(self, name, description, method)

        self.context = context
        self.prompt = context.prompt
        self.upload_manager = upload_manager
Esempio n. 27
0
    def __init__(self,
                 context,
                 strategy,
                 name=NAME_NEXT_RUN,
                 description=DESC_NEXT_RUN):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_flag(FLAG_QUIET)
Esempio n. 28
0
    def __init__(self, context, upload_manager, name='cancel', description=DESC_CANCEL, method=None):

        if method is None:
            method = self.run

        PulpCliCommand.__init__(self, name, description, method)

        self.context = context
        self.prompt = context.prompt
        self.upload_manager = upload_manager
Esempio n. 29
0
    def __init__(self,
                 context,
                 strategy,
                 name=NAME_DELETE,
                 description=DESC_DELETE):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_option(OPT_SCHEDULE_ID)
Esempio n. 30
0
    def __init__(self, context, strategy, name, description):
        PulpCliCommand.__init__(self, name, description, self.update)
        self.context = context
        self.strategy = strategy

        d = 'identifies the schedule to update'
        self.create_option('--schedule-id', _(d), required=True)
        self.create_option('--schedule', SCHEDULE_DESCRIPTION, aliases=['-s'], required=False)
        self.create_option('--failure-threshold', FAILURE_THRESHOLD_DESCRIPTION, aliases=['-f'], required=False)
        self.create_option('--enabled', ENABLED_DESCRIPTION, aliases=['-e'], required=False)
Esempio n. 31
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.create)
        self.context = context
        self.prompt = context.prompt

        d = "identifies the repository the package group will be created in"
        self.create_option("--repo-id", _(d), required=True)

        d = "id of this package group"
        self.create_option("--group-id", _(d), aliases=["-i"], required=True)

        d = "name of this package group"
        self.create_option("--name", _(d), aliases=["-n"], required=True)

        d = "description of this package group"
        self.create_option("--description", _(d), aliases=["-d"], required=True)

        d = (
            'conditional package name to include in this package group, specified as "pkg_name:required_package"; multiple may '
            "be indicated by specifying the argument multiple times"
        )
        self.create_option("--cond-name", _(d), allow_multiple=True, required=False)

        d = (
            "mandatory package name to include in this package group; multiple may "
            "be indicated by specifying the argument multiple times"
        )
        self.create_option("--mand-name", _(d), allow_multiple=True, required=False)

        d = (
            "optional package name to include in this package group; multiple may "
            "be indicated by specifying the argument multiple times"
        )
        self.create_option("--opt-name", _(d), allow_multiple=True, required=False)

        d = (
            "default package name to include in this package group; multiple may "
            "be indicated by specifying the argument multiple times"
        )
        self.create_option("--default-name", _(d), aliases=["-p"], allow_multiple=True, required=False)

        d = "display order for this package group"
        self.create_option("--display-order", _(d), allow_multiple=False, required=False, default=0)

        d = 'sets the "langonly" attribute for this package group'
        self.create_option("--langonly", _(d), allow_multiple=False, required=False)

        d = 'set "default" flag on package group to True'
        self.create_flag("--default", _(d))

        d = 'set "user_visible" flag on package group to True'
        self.create_flag("--user-visible", _(d))

        d = "display extra information about the creation process"
        self.create_flag("-v", _(d))
Esempio n. 32
0
    def __init__(self,
                 context,
                 strategy,
                 name=NAME_CREATE,
                 description=DESC_CREATE):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_option(OPT_SCHEDULE)
        self.add_option(OPT_FAILURE_THRESHOLD)
Esempio n. 33
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.publish)
        self.context = context

        # In the RPM client, there is currently only one distributor for a
        # repository, so we don't need to ask them for the distributor ID (yet).
        self.create_option('--repo-id', _('identifies the repository to publish'), required=True)

        d = 'if specified, the CLI process will end but the publish will continue on '\
            'the server; the progress can be later displayed using the status command'
        self.create_flag('--bg', _(d))
Esempio n. 34
0
    def __init__(self, context, strategy, name=NAME_UPDATE, description=DESC_UPDATE):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_option(OPT_SCHEDULE_ID)
        self.add_option(OPT_FAILURE_THRESHOLD)
        self.add_option(OPT_ENABLED)

        schedule_copy = copy.copy(OPT_SCHEDULE)
        schedule_copy.required = False
        self.add_option(schedule_copy)
    def __init__(self, options_bundle=None, include_sync=True, include_ssl=True, include_proxy=True,
                 include_throttling=True, include_unit_policy=True):
        PulpCliCommand.__init__(self, 'mixin', '', self.run)
        importer_config.ImporterConfigMixin.__init__(self,
                                                     options_bundle=options_bundle,
                                                     include_sync=include_sync,
                                                     include_ssl=include_ssl,
                                                     include_proxy=include_proxy,
                                                     include_throttling=include_throttling,
                                                     include_unit_policy=include_unit_policy)

        self.last_parsed_config = None
Esempio n. 36
0
 def __init__(self, name, description, method, context):
     """
     @param name: The command name.
     @type name: str
     @param description: The command description.
     @type description: str
     @param method: The command (main) method.
     @type method: instancemethod
     @param context: The command context object.
     @type context: See okaara.
     """
     PulpCliCommand.__init__(self, name, description, method)
     self.context = context
    def __init__(self, options_bundle=None, include_sync=True, include_ssl=True, include_proxy=True,
                 include_throttling=True, include_unit_policy=True, include_basic_auth=True):
        PulpCliCommand.__init__(self, 'mixin', '', self.run)
        importer_config.ImporterConfigMixin.__init__(self,
                                                     options_bundle=options_bundle,
                                                     include_sync=include_sync,
                                                     include_ssl=include_ssl,
                                                     include_proxy=include_proxy,
                                                     include_basic_auth=include_basic_auth,
                                                     include_throttling=include_throttling,
                                                     include_unit_policy=include_unit_policy)

        self.last_parsed_config = None
Esempio n. 38
0
    def __init__(self,
                 context,
                 strategy,
                 name=NAME_UPDATE,
                 description=DESC_UPDATE):
        PulpCliCommand.__init__(self, name, description, self.run)
        self.context = context
        self.strategy = strategy

        self.add_option(OPT_SCHEDULE_ID)
        self.add_option(OPT_FAILURE_THRESHOLD)
        self.add_option(OPT_ENABLED)

        schedule_copy = copy.copy(OPT_SCHEDULE)
        schedule_copy.required = False
        self.add_option(schedule_copy)
Esempio n. 39
0
File: sync.py Progetto: ehelms/pulp
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.sync)
        self.context = context

        self.create_option('--repo-id', _('identifies the repository to sync'), required=True)

        # I originally wrote this when the flag was for foreground. In case we
        # move back to that model, I've left the developer the description already.
        # You're welcome.
        #
        # d = 'if specified, the progress for the sync will be continually displayed ' \
        #     'on screen and the CLI process will not end until it is completed; the ' \
        #    'progress can be viewed later using the status command if this is not specified'

        d = _('if specified, the CLI process will end but the sync will continue on ' \
              'the server; the progress can be later displayed using the status command')
        self.create_flag('--bg', d)
Esempio n. 40
0
    def __init__(self, context, name, description):
        PulpCliCommand.__init__(self, name, description, self.create)
        self.context = context
        self.prompt = context.prompt

        d = 'identifies the repository the packages will be uploaded into'
        self.create_option('--repo-id', _(d), required=True)

        d = 'full path to the package to upload; may be specified multiple times ' \
            'for multiple files'
        self.create_option('--file', _(d), aliases=['-f'], allow_multiple=True, required=False)

        d = 'full path to a directory containing RPMs, all of which will be uploaded; ' \
            'may be specified multiple times for multiple directories'
        self.create_option('--dir', _(d), aliases=['-d'], allow_multiple=True, required=False)

        d = 'display extra information about the upload process'
        self.create_flag('-v', _(d))
Esempio n. 41
0
    def __init__(self, context):
        d = _('deletes the user\'s session certificate')
        PulpCliCommand.__init__(self, 'logout', d, self.logout)

        self.context = context
Esempio n. 42
0
File: cli.py Progetto: pombreda/pulp
 def __init__(self, context, name, description):
     PulpCliCommand.__init__(self, name, description, self.status)
     self.context = context
     self.prompt = context.prompt
Esempio n. 43
0
    def __init__(self, context):
        PulpCliCommand.__init__(self, 'list', 'lists repositories on the server', self.list)
        self.context = context
        self.prompt = context.prompt

        self.add_option(PulpCliFlag('--details', 'if specified, extra information on the repository will be displayed'))
Esempio n. 44
0
    def __init__(self, context):
        desc = 'deletes a repository'
        PulpCliCommand.__init__(self, 'delete', desc, self.delete)
        self.context = context

        self.add_option(PulpCliOption('--repo-id', 'identifies the repository to delete', required=True))
Esempio n. 45
0
 def __init__(self, context, name, description):
     PulpCliCommand.__init__(self, name, description, self.register)
     self.context = context
     self.prompt = context.prompt