From 4361cd02422d8a6b30d67bb6869af9c67f7ec9c0 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Thu, 20 Jan 2011 15:07:43 -0500 Subject: Rename INTERNAL to NO_CLI for commands we hide from the cli. Also make i18n_messages and json_metadata NO_CLI. ticket 821 --- ipalib/cli.py | 6 +++--- ipalib/frontend.py | 4 ++-- ipalib/plugins/aci.py | 14 +++++++------- ipalib/plugins/batch.py | 2 +- ipalib/plugins/dns.py | 6 +++--- ipalib/plugins/internal.py | 4 +++- ipalib/plugins/permission.py | 4 ++-- ipalib/plugins/privilege.py | 4 ++-- ipalib/plugins/pwpolicy.py | 12 ++++++------ 9 files changed, 29 insertions(+), 27 deletions(-) diff --git a/ipalib/cli.py b/ipalib/cli.py index dfc577c39..2cd3a97c3 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -656,7 +656,7 @@ class help(frontend.Local): # build help topics for c in self.Command(): - if c.INTERNAL: + if c.NO_CLI: continue topic = self._get_module_topic(c.module) @@ -715,7 +715,7 @@ class help(frontend.Local): mcl = max(len(s) for s in (self.Command)) for cname in self.Command: cmd = self.Command[cname] - if cmd.INTERNAL: + if cmd.NO_CLI: continue print '%s %s' % (to_cli(cmd.name).ljust(mcl), cmd.summary) else: @@ -886,7 +886,7 @@ class cli(backend.Executioner): return (key, argv) = (argv[0], argv[1:]) name = from_cli(key) - if name not in self.Command or self.Command[name].INTERNAL: + if name not in self.Command or self.Command[name].NO_CLI: raise CommandError(name=key) cmd = self.Command[name] if not isinstance(cmd, frontend.Local): diff --git a/ipalib/frontend.py b/ipalib/frontend.py index eeed3980c..567edfd17 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -220,8 +220,8 @@ class HasParam(Plugin): that consider arbitrary ``api.env`` values. """ # HasParam is the base class for most frontend plugins, that make it to users - # This flag should be used by UI components to make the plugin unaccessible - INTERNAL = False + # This flag indicates that the command should not be available in the cli + NO_CLI = False def _get_param_iterable(self, name, verb='takes'): """ diff --git a/ipalib/plugins/aci.py b/ipalib/plugins/aci.py index 176495385..7f9b0f216 100644 --- a/ipalib/plugins/aci.py +++ b/ipalib/plugins/aci.py @@ -356,7 +356,7 @@ class aci(Object): """ ACI object. """ - INTERNAL = True + NO_CLI = True label = _('ACIs') @@ -428,7 +428,7 @@ class aci_add(crud.Create): """ Create new ACI. """ - INTERNAL = True + NO_CLI = True msg_summary = _('Created ACI "%(value)s"') takes_options = ( @@ -482,7 +482,7 @@ class aci_del(crud.Delete): """ Delete ACI. """ - INTERNAL = True + NO_CLI = True has_output = output.standard_boolean msg_summary = _('Deleted ACI "%(value)s"') @@ -523,7 +523,7 @@ class aci_mod(crud.Update): """ Modify ACI. """ - INTERNAL = True + NO_CLI = True has_output_params = ( Str('aci', label=_('ACI'), @@ -594,7 +594,7 @@ class aci_find(crud.Search): have ipausers as a memberof. There may be other ACIs that apply to members of that group indirectly. """ - INTERNAL = True + NO_CLI = True msg_summary = ngettext('%(count)d ACI matched', '%(count)d ACIs matched', 0) def execute(self, term, **kw): @@ -752,7 +752,7 @@ class aci_show(crud.Retrieve): """ Display a single ACI given an ACI name. """ - INTERNAL = True + NO_CLI = True has_output_params = ( Str('aci', @@ -792,7 +792,7 @@ class aci_rename(crud.Update): """ Rename an ACI. """ - INTERNAL = True + NO_CLI = True has_output_params = ( Str('aci', label=_('ACI'), diff --git a/ipalib/plugins/batch.py b/ipalib/plugins/batch.py index f6f662f28..a5907791d 100644 --- a/ipalib/plugins/batch.py +++ b/ipalib/plugins/batch.py @@ -54,7 +54,7 @@ from ipalib.text import _ from ipapython.version import API_VERSION class batch(Command): - INTERNAL = True + NO_CLI = True takes_args = ( List('methods?', diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index 6d2109741..69c38b26c 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -471,7 +471,7 @@ class dnsrecord_add_record(dnsrecord_mod_record): """ Add records to DNS resource. """ - INTERNAL = True + NO_CLI = True def update_old_entry_callback(self, entry_attrs, old_entry_attrs): for (a, v) in entry_attrs.iteritems(): @@ -509,7 +509,7 @@ class dnsrecord_delentry(LDAPDelete): """ Delete DNS record entry. """ - INTERNAL = True + NO_CLI = True api.register(dnsrecord_delentry) @@ -621,7 +621,7 @@ class dns_is_enabled(Command): """ Checks if any of the servers has the DNS service enabled. """ - INTERNAL = True + NO_CLI = True has_output = output.standard_value base_dn = 'cn=masters,cn=ipa,cn=etc,%s' % api.env.basedn diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index 89b2b4dd1..215131f07 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -35,7 +35,7 @@ class json_metadata(Command): """ Export plugin meta-data for the webUI. """ - INTERNAL = False + NO_CLI = True takes_args = ( @@ -74,6 +74,8 @@ class json_metadata(Command): api.register(json_metadata) class i18n_messages(Command): + NO_CLI = True + messages={ "login": {"header" :_("Logged In As")}, "button":{ diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py index 43bb2634d..d3e0fd50a 100644 --- a/ipalib/plugins/permission.py +++ b/ipalib/plugins/permission.py @@ -368,7 +368,7 @@ class permission_add_member(LDAPAddMember): """ Add members to a permission. """ - INTERNAL = True + NO_CLI = True api.register(permission_add_member) @@ -377,6 +377,6 @@ class permission_remove_member(LDAPRemoveMember): """ Remove members from a permission. """ - INTERNAL = True + NO_CLI = True api.register(permission_remove_member) diff --git a/ipalib/plugins/privilege.py b/ipalib/plugins/privilege.py index 124b7fc55..13e2b284e 100644 --- a/ipalib/plugins/privilege.py +++ b/ipalib/plugins/privilege.py @@ -127,7 +127,7 @@ class privilege_add_member(LDAPAddMember): """ Add members to a privilege """ - INTERNAL=True + NO_CLI=True api.register(privilege_add_member) @@ -136,7 +136,7 @@ class privilege_remove_member(LDAPRemoveMember): """ Remove members from a privilege """ - INTERNAL=True + NO_CLI=True api.register(privilege_remove_member) diff --git a/ipalib/plugins/pwpolicy.py b/ipalib/plugins/pwpolicy.py index f009a0c96..caf918c7a 100644 --- a/ipalib/plugins/pwpolicy.py +++ b/ipalib/plugins/pwpolicy.py @@ -70,7 +70,7 @@ class cosentry(LDAPObject): """ Class of Service object used for linking policies with groups """ - INTERNAL = True + NO_CLI = True container_dn = 'cn=costemplates,%s' % api.env.container_accounts object_class = ['top', 'costemplate', 'extensibleobject', 'krbcontainer'] @@ -113,7 +113,7 @@ api.register(cosentry) class cosentry_add(LDAPCreate): - INTERNAL = True + NO_CLI = True def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): # check for existence of the group @@ -129,13 +129,13 @@ api.register(cosentry_add) class cosentry_del(LDAPDelete): - INTERNAL = True + NO_CLI = True api.register(cosentry_del) class cosentry_mod(LDAPUpdate): - INTERNAL = True + NO_CLI = True def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): self.obj.check_priority_uniqueness(*keys, **options) @@ -145,13 +145,13 @@ api.register(cosentry_mod) class cosentry_show(LDAPRetrieve): - INTERNAL = True + NO_CLI = True api.register(cosentry_show) class cosentry_find(LDAPSearch): - INTERNAL = True + NO_CLI = True api.register(cosentry_find) -- cgit