Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
Arquivo: auth.py Projeto: omps/pulp
    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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    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)
Exemplo n.º 5
0
    def __init__(self, context):
        super(RepoGroupMemberSection, self).__init__('members', _('manage members of repository groups'))
        self.context = context
        self.prompt = context.prompt

        id_option = PulpCliOption('--group-id', _('id of a repository group'), required=True)

        list_command = PulpCliCommand('list', _('list of repositories in a particular group'), self.list)
        list_command.add_option(id_option)
        self.add_command(list_command)

        add_command = SearchCommand(self.add, criteria=False, name='add', description=_('add repositories based on search parameters'))
        add_command.add_option(id_option)
        self.add_command(add_command)

        remove_command = SearchCommand(self.remove, criteria=False, name='remove', description=_('remove repositories based on search parameters'))
        remove_command.add_option(id_option)
        self.add_command(remove_command)
Exemplo n.º 6
0
Arquivo: event.py Projeto: omps/pulp
    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)
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
    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)
Exemplo n.º 9
0
Arquivo: event.py Projeto: omps/pulp
    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)
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'role', 'manage user roles')

        self.context = context
        self.prompt = context.prompt # for easier access

        # Common Options
        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)
        list_command.add_option(PulpCliFlag('--details', 'if specified, all the role information is displayed'))
        list_command.add_option(PulpCliOption('--fields', 'comma-separated list of role fields; if specified, only the given fields will displayed', required=False))
        self.add_command(list_command)
Exemplo n.º 12
0
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        super(EmailSection, self).__init__(context, 'email',
                                           _('manage email listeners'))

        m = _("text of the email's subject")
        subject_option = PulpCliOption('--subject', m, required=True)

        m = _('this is a comma separated list of email addresses that should '
              'receive these notifications. Do not include spaces.')
        addresses_option = PulpCliOption('--addresses', m, required=True,
                                         parse_func=parsers.csv)

        create_command = PulpCliCommand('create', _('create a listener'),
                                        self.create)
        create_command.add_option(self.event_types_option)
        create_command.add_option(subject_option)
        create_command.add_option(addresses_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(subject_option))
        update_command.add_option(self._copy_flip_required(addresses_option))
        update_command.add_option(self._copy_flip_required(self.event_types_option))
        self.add_command(update_command)
Exemplo n.º 13
0
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        super(RestApiSection, self).__init__(context, 'http',
                                             _('manage http listeners'))

        m = _('full URL to invoke to send the event info')
        url_option = PulpCliOption('--url', m, required=True)

        m = _('optional username to be passed as basic auth credentials when '
              'the HTTP call is invoked.')
        username_option = PulpCliOption('--username', m, required=False)

        m = _('optional password to be passed as basic auth credentials when '
              'the HTTP call is invoked.')
        password_option = PulpCliOption('--password', m, required=False)

        create_command = PulpCliCommand('create', _('create a listener'),
                                        self.create)
        create_command.add_option(self.event_types_option)
        create_command.add_option(url_option)
        create_command.add_option(username_option)
        create_command.add_option(password_option)
        self.add_command(create_command)

        update_command = PulpCliCommand('update', _('update a listener'),
                                        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._copy_flip_required(url_option))
        update_command.add_option(username_option)
        update_command.add_option(password_option)
        self.add_command(update_command)
Exemplo n.º 14
0
    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)
Exemplo n.º 15
0
Arquivo: event.py Projeto: omps/pulp
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        super(RestApiSection, self).__init__(context, 'http',
                                             _('manage http listeners'))

        m = _('full URL to invoke to send the event info')
        url_option = PulpCliOption('--url', m, required=True)

        m = _('optional username to be passed as basic auth credentials when '
              'the HTTP call is invoked.')
        username_option = PulpCliOption('--username', m, required=False)

        m = _('optional password to be passed as basic auth credentials when '
              'the HTTP call is invoked.')
        password_option = PulpCliOption('--password', m, required=False)

        create_command = PulpCliCommand('create', _('create a listener'),
                                        self.create)
        create_command.add_option(self.event_types_option)
        create_command.add_option(url_option)
        create_command.add_option(username_option)
        create_command.add_option(password_option)
        self.add_command(create_command)

        update_command = PulpCliCommand('update', _('update a listener'),
                                        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._copy_flip_required(url_option))
        update_command.add_option(username_option)
        update_command.add_option(password_option)
        self.add_command(update_command)
Exemplo n.º 16
0
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        super(RestApiSection, self).__init__(context, "http", _("manage http listeners"))

        m = _("full URL to invoke to send the event info")
        url_option = PulpCliOption("--url", m, required=True)

        m = _("optional username to be passed as basic auth credentials when " "the HTTP call is invoked.")
        username_option = PulpCliOption("--username", m, required=False)

        m = _("optional password to be passed as basic auth credentials when " "the HTTP call is invoked.")
        password_option = PulpCliOption("--password", m, required=False)

        create_command = PulpCliCommand("create", _("create a listener"), self.create)
        create_command.add_option(self.event_types_option)
        create_command.add_option(url_option)
        create_command.add_option(username_option)
        create_command.add_option(password_option)
        self.add_command(create_command)

        update_command = PulpCliCommand("update", _("update a listener"), 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._copy_flip_required(url_option))
        update_command.add_option(username_option)
        update_command.add_option(password_option)
        self.add_command(update_command)
Exemplo n.º 17
0
Arquivo: auth.py Projeto: omps/pulp
    def __init__(self, context):
        PulpCliSection.__init__(
            self, 'permission',
            'manage granting, revoking and listing permissions for resources')

        self.context = context
        self.prompt = context.prompt  # for easier access

        # List Command
        list_command = PulpCliCommand(
            'list', 'lists permissions for a particular resource', self.list)
        list_command.add_option(
            PulpCliOption('--resource',
                          'uniquely identifies a resource',
                          required=True))
        self.add_command(list_command)

        # Grant Command
        usage_description = 'you can specify either login or role-id in this command; both cannot be specified at the same time'
        grant_command = PulpCliCommand(
            'grant',
            'grants resource permissions to given user or given role',
            self.grant,
            usage_description=usage_description)
        grant_command.add_option(
            PulpCliOption(
                '--resource',
                'resource REST API path whose permissions are being manipulated',
                required=True))
        grant_command.add_option(
            PulpCliOption(
                '--login',
                'login of the user to which access to given resource is being granted',
                required=False))
        grant_command.add_option(
            PulpCliOption(
                '--role-id',
                'id of the role to which access to given resource is being granted',
                required=False))
        grant_command.add_option(
            PulpCliOption(
                '-o',
                'type of permissions being granted, valid permissions: create, read, update, delete, execute',
                required=True,
                allow_multiple=True))
        self.add_command(grant_command)

        # Revoke Command
        revoke_command = PulpCliCommand(
            'revoke',
            'revokes resource permissions from given user or given role',
            self.revoke,
            usage_description=usage_description)
        revoke_command.add_option(
            PulpCliOption(
                '--resource',
                'resource REST API path whose permissions are being manipulated',
                required=True))
        revoke_command.add_option(
            PulpCliOption(
                '--login',
                'login of the user from which access to given resource is being revoked',
                required=False))
        revoke_command.add_option(
            PulpCliOption(
                '--role-id',
                'id of the role from which access to given resource is being revoked',
                required=False))
        revoke_command.add_option(
            PulpCliOption(
                '-o',
                'type of permissions being revoked, valid permissions: create, read, update, delete, execute',
                required=True,
                allow_multiple=True))
        self.add_command(revoke_command)
Exemplo n.º 18
0
Arquivo: auth.py Projeto: omps/pulp
    def __init__(self, context):
        PulpCliSection.__init__(self, 'role', 'manage user roles')

        self.context = context
        self.prompt = context.prompt  # for easier access

        # Common Options
        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)
        list_command.add_option(
            PulpCliFlag('--details',
                        'if specified, all the role information is displayed'))
        list_command.add_option(
            PulpCliOption(
                '--fields',
                'comma-separated list of role fields; if specified, only the given fields will displayed',
                required=False))
        self.add_command(list_command)
Exemplo n.º 19
0
    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))
Exemplo n.º 20
0
Arquivo: event.py Projeto: omps/pulp
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        super(EmailSection, self).__init__(context, 'email',
                                           _('manage email listeners'))

        m = _("text of the email's subject")
        subject_option = PulpCliOption('--subject', m, required=True)

        m = _('this is a comma separated list of email addresses that should '
              'receive these notifications. Do not include spaces.')
        addresses_option = PulpCliOption('--addresses',
                                         m,
                                         required=True,
                                         parse_func=parsers.csv)

        create_command = PulpCliCommand('create', _('create a listener'),
                                        self.create)
        create_command.add_option(self.event_types_option)
        create_command.add_option(subject_option)
        create_command.add_option(addresses_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(subject_option))
        update_command.add_option(self._copy_flip_required(addresses_option))
        update_command.add_option(
            self._copy_flip_required(self.event_types_option))
        self.add_command(update_command)
Exemplo n.º 21
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'permission', 'manage granting, revoking and listing permissions for resources')

        self.context = context
        self.prompt = context.prompt # for easier access

        # List Command
        list_command = PulpCliCommand('list', 'lists permissions for a particular resource', self.list)
        list_command.add_option(PulpCliOption('--resource', 'uniquely identifies a resource', required=True))
        self.add_command(list_command)

        # Grant Command
        usage_description = 'you can specify either login or role-id in this command; both cannot be specified at the same time'
        grant_command = PulpCliCommand('grant', 'grants resource permissions to given user or given role', self.grant, usage_description=usage_description)
        grant_command.add_option(PulpCliOption('--resource', 'resource REST API path whose permissions are being manipulated', required=True))
        grant_command.add_option(PulpCliOption('--login', 'login of the user to which access to given resource is being granted', required=False))
        grant_command.add_option(PulpCliOption('--role-id', 'id of the role to which access to given resource is being granted', required=False))
        grant_command.add_option(PulpCliOption('-o', 'type of permissions being granted, valid permissions: create, read, update, delete, execute', required=True, allow_multiple=True))
        self.add_command(grant_command)

        # Revoke Command
        revoke_command = PulpCliCommand('revoke', 'revokes resource permissions from given user or given role', self.revoke, usage_description=usage_description)
        revoke_command.add_option(PulpCliOption('--resource', 'resource REST API path whose permissions are being manipulated', required=True))
        revoke_command.add_option(PulpCliOption('--login', 'login of the user from which access to given resource is being revoked', required=False))
        revoke_command.add_option(PulpCliOption('--role-id', 'id of the role from which access to given resource is being revoked', required=False))
        revoke_command.add_option(PulpCliOption('-o', 'type of permissions being revoked, valid permissions: create, read, update, delete, execute', required=True, allow_multiple=True))
        self.add_command(revoke_command)
Exemplo n.º 22
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'user', 'manage users')

        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, validate_func=validators.id_validator_allow_dots)
        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))
Exemplo n.º 23
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'consumer', 'consumer lifecycle (list, update, etc.) commands')

        self.context = context
        self.prompt = context.prompt # for easier access

        # Common Options
        consumer_id_option = PulpCliOption('--consumer-id', 'uniquely identifies the consumer; only alphanumeric, -, and _ allowed', required=True)
        name_option = PulpCliOption('--display-name', 'user-readable display name for the consumer', required=False)
        description_option = PulpCliOption('--description', 'user-readable description for the consumer', required=False)

        # Update Command
        update_command = PulpCliCommand('update', 'changes metadata on an existing consumer', self.update)
        update_command.add_option(consumer_id_option)
        update_command.add_option(name_option)
        update_command.add_option(description_option)
        d =  'adds/updates/deletes notes to programmatically identify the consumer; '
        d += 'key-value pairs must be separated by an equal sign (e.g. key=value); multiple notes can '
        d += 'be changed by specifying this option multiple times; notes are deleted by '
        d += 'specifying "" as the value'
        update_command.add_option(PulpCliOption('--note', d, required=False, allow_multiple=True))
        self.add_command(update_command)

        # Unregister Command
        unregister_command = PulpCliCommand('unregister', 'unregisters a consumer', self.unregister)
        unregister_command.add_option(PulpCliOption('--consumer-id', 'identifies the consumer to be unregistered', required=True))
        self.add_command(unregister_command)

        # List Command
        list_command = PulpCliCommand('list', 'lists summary of consumers registered to the Pulp server', self.list)
        list_command.add_option(PulpCliFlag('--details', 'if specified, all the consumer information is displayed'))
        list_command.add_option(PulpCliFlag('--bindings', 'if specified, the bindings information is displayed'))
        list_command.add_option(PulpCliOption('--fields', 'comma-separated list of consumer fields; if specified, only the given fields will displayed', required=False))
        self.add_command(list_command)

        # Search Command
        self.add_command(CriteriaCommand(self.search))

        # Bind Command
        bind_command = PulpCliCommand('bind', 'binds a consumer to a repository distributor for consuming published content', self.bind)
        bind_command.add_option(PulpCliOption('--consumer-id', 'consumer id', required=True))
        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)

        # Unbind Command
        unbind_command = PulpCliCommand('unbind', 'unbinds a consumer from a repository distributor', self.unbind)
        unbind_command.add_option(PulpCliOption('--consumer-id', 'consumer id', required=True))
        unbind_command.add_option(PulpCliOption('--repo-id', 'repository id', required=True))
        unbind_command.add_option(PulpCliOption('--distributor-id', 'distributor id', required=True))
        self.add_command(unbind_command)
        
        # History Retrieval Command
        history_command = PulpCliCommand('history', 'lists history of a consumer', self.history)
        history_command.add_option(PulpCliOption('--consumer-id', 'consumer id', required=True))
        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")'
        history_command.add_option(PulpCliOption('--event-type', d, required=False))
        history_command.add_option(PulpCliOption('--limit', 'limits displayed history entries to the given amount (must be greater than zero)', required=False))
        history_command.add_option(PulpCliOption('--sort', 'indicates the sort direction ("ascending" or "descending") based on the entry\'s timestamp', required=False))
        history_command.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))
        history_command.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))
        self.add_command(history_command)
Exemplo n.º 24
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'group', _('repository group commands'))

        self.context = context
        self.prompt = context.prompt # for easier access

        self.add_subsection(RepoGroupMemberSection(context))

        # Common Options
        id_option = PulpCliOption('--group-id', _('uniquely identifies the repo group; only alphanumeric, -, and _ allowed'), required=True)
        name_option = PulpCliOption('--display-name', _('user-readable display name for the repo group'), required=False)
        description_option = PulpCliOption('--description', _('user-readable description for the repo group'), required=False)

        # Create Command
        create_command = PulpCliCommand('create', _('creates a new repository 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 repo 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 repository group'), self.delete)
        delete_command.add_option(id_option)
        self.add_command(delete_command)

        # List Command
        list_command = PulpCliCommand('list', _('lists summary of repo groups registered to the Pulp server'), self.list)
        list_command.add_option(PulpCliFlag('--details', _('if specified, all the repo group information is displayed')))
        list_command.add_option(PulpCliOption('--fields', _('comma-separated list of repo 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))
Exemplo n.º 25
0
    def __init__(self, context):
        """
        @param context:
        @type  context: pulp.client.extensions.core.ClientContext
        """
        PulpCliSection.__init__(self, 'repo', _('repository lifecycle (create, delete, configure, etc.) commands'))

        self.context = context
        self.prompt = context.prompt # for easier access

        # Common Options
        id_option = PulpCliOption('--repo-id', _('uniquely identifies the repository; only alphanumeric, -, and _ allowed'), required=True)
        name_option = PulpCliOption('--display-name', _('user-readable display name for the repository'), required=False)
        description_option = PulpCliOption('--description', _('user-readable description for the repository'), required=False)

        # Create Command
        create_command = PulpCliCommand('create', _('creates a new repository'), 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 repository'), 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 repository'), self.delete)
        delete_command.add_option(id_option)
        self.add_command(delete_command)

        # List Command
        list_command = PulpCliCommand('list', _('lists repositories on the Pulp server'), self.list)
        list_command.add_option(PulpCliFlag('--summary', _('if specified, only a minimal amount of repository information is displayed')))
        list_command.add_option(PulpCliOption('--fields', _('comma-separated list of repository fields; if specified, only the given fields will displayed'), required=False))
        list_command.add_option(PulpCliFlag('--importers', _('if specified, importer configuration is displayed')))
        list_command.add_option(PulpCliFlag('--distributors', _('if specified, the list of distributors and their configuration is displayed')))
        self.add_command(list_command)

        # Search Command
        self.add_command(SearchCommand(self.search))

        # Subsections
        self.add_subsection(ImporterSection(context))
        self.add_subsection(SyncSection(context))
        self.add_subsection(RepoGroupSection(context))
        self.create_subsection('units', _('list/search for RPM-related content in a repository'))
Exemplo n.º 26
0
Arquivo: auth.py Projeto: omps/pulp
    def __init__(self, context):
        PulpCliSection.__init__(self, 'user', 'manage users')

        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,
            validate_func=validators.id_validator)
        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))
Exemplo n.º 27
0
    def __init__(self, context):
        PulpCliSection.__init__(self, 'permission', 'permission lifecycle (list, grant, revoke, etc.) commands')

        self.context = context
        self.prompt = context.prompt # for easier access

        # List Command
        list_command = PulpCliCommand('list', 'lists permissions for a particular resource', self.list)
        list_command.add_option(PulpCliOption('--resource', 'uniquely identifies a resource', required=True))
        self.add_command(list_command)
        
        # Grant Command
        grant_command = PulpCliCommand('grant', 'grants resource permissions to given user or given role', self.grant)
        grant_command.add_option(PulpCliOption('--resource', 'resource REST API path whose permissions are being manipulated', required=True))
        grant_command.add_option(PulpCliOption('--login', 'login of the user to which access to given resource is being granted', required=False))
        grant_command.add_option(PulpCliOption('--role-id', 'id of the role to which access to given resource is being granted', required=False))
        grant_command.add_option(PulpCliOption('-o', 'type of permissions being granted, valid permissions: create, read, update, delete, execute', required=True, allow_multiple=True))
        self.add_command(grant_command)
        
        # Revoke Command
        revoke_command = PulpCliCommand('revoke', 'revokes resource permissions from given user or given role', self.revoke)
        revoke_command.add_option(PulpCliOption('--resource', 'resource REST API path whose permissions are being manipulated', required=True))
        revoke_command.add_option(PulpCliOption('--login', 'login of the user from which access to given resource is being revoked', required=False))
        revoke_command.add_option(PulpCliOption('--role-id', 'id of the role from which access to given resource is being revoked', required=False))
        revoke_command.add_option(PulpCliOption('-o', 'type of permissions being revoked, valid permissions: create, read, update, delete, execute', required=True, allow_multiple=True))
        self.add_command(revoke_command)