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))
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()
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()
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'))
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)
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)
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))
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)
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))
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)
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))
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)
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))
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))
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)
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))
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
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)
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)
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
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
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'))
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)
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")) )
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)
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)
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)
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
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))
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))
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
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, 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
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, 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)
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)
def __init__(self, context): PulpCliSection.__init__(self, 'server', _('display info about the server')) self.context = context self.add_command( PulpCliCommand('types', 'lists content types installed on the server', self.types)) self.add_command( PulpCliCommand('importers', 'lists importers installed on the server', self.importers)) self.add_command( PulpCliCommand('distributors', 'lists distributors installed on the server', self.distributors))
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))
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)
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)
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))
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)
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)
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)
def __init__(self, context): d = _('deletes the user\'s session certificate') PulpCliCommand.__init__(self, 'logout', d, self.logout) self.context = context
def __init__(self, context, name, description): PulpCliCommand.__init__(self, name, description, self.status) self.context = context self.prompt = context.prompt
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)
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)
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)