Rename INTERNAL to NO_CLI for commands we hide from the cli.

Also make i18n_messages and json_metadata NO_CLI.

ticket 821
This commit is contained in:
Rob Crittenden 2011-01-20 15:07:43 -05:00
parent 35f2f1d720
commit 4361cd0242
9 changed files with 29 additions and 27 deletions

View File

@ -656,7 +656,7 @@ class help(frontend.Local):
# build help topics # build help topics
for c in self.Command(): for c in self.Command():
if c.INTERNAL: if c.NO_CLI:
continue continue
topic = self._get_module_topic(c.module) topic = self._get_module_topic(c.module)
@ -715,7 +715,7 @@ class help(frontend.Local):
mcl = max(len(s) for s in (self.Command)) mcl = max(len(s) for s in (self.Command))
for cname in self.Command: for cname in self.Command:
cmd = self.Command[cname] cmd = self.Command[cname]
if cmd.INTERNAL: if cmd.NO_CLI:
continue continue
print '%s %s' % (to_cli(cmd.name).ljust(mcl), cmd.summary) print '%s %s' % (to_cli(cmd.name).ljust(mcl), cmd.summary)
else: else:
@ -886,7 +886,7 @@ class cli(backend.Executioner):
return return
(key, argv) = (argv[0], argv[1:]) (key, argv) = (argv[0], argv[1:])
name = from_cli(key) 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) raise CommandError(name=key)
cmd = self.Command[name] cmd = self.Command[name]
if not isinstance(cmd, frontend.Local): if not isinstance(cmd, frontend.Local):

View File

@ -220,8 +220,8 @@ class HasParam(Plugin):
that consider arbitrary ``api.env`` values. that consider arbitrary ``api.env`` values.
""" """
# HasParam is the base class for most frontend plugins, that make it to users # 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 # This flag indicates that the command should not be available in the cli
INTERNAL = False NO_CLI = False
def _get_param_iterable(self, name, verb='takes'): def _get_param_iterable(self, name, verb='takes'):
""" """

View File

@ -356,7 +356,7 @@ class aci(Object):
""" """
ACI object. ACI object.
""" """
INTERNAL = True NO_CLI = True
label = _('ACIs') label = _('ACIs')
@ -428,7 +428,7 @@ class aci_add(crud.Create):
""" """
Create new ACI. Create new ACI.
""" """
INTERNAL = True NO_CLI = True
msg_summary = _('Created ACI "%(value)s"') msg_summary = _('Created ACI "%(value)s"')
takes_options = ( takes_options = (
@ -482,7 +482,7 @@ class aci_del(crud.Delete):
""" """
Delete ACI. Delete ACI.
""" """
INTERNAL = True NO_CLI = True
has_output = output.standard_boolean has_output = output.standard_boolean
msg_summary = _('Deleted ACI "%(value)s"') msg_summary = _('Deleted ACI "%(value)s"')
@ -523,7 +523,7 @@ class aci_mod(crud.Update):
""" """
Modify ACI. Modify ACI.
""" """
INTERNAL = True NO_CLI = True
has_output_params = ( has_output_params = (
Str('aci', Str('aci',
label=_('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 have ipausers as a memberof. There may be other ACIs that apply to
members of that group indirectly. members of that group indirectly.
""" """
INTERNAL = True NO_CLI = True
msg_summary = ngettext('%(count)d ACI matched', '%(count)d ACIs matched', 0) msg_summary = ngettext('%(count)d ACI matched', '%(count)d ACIs matched', 0)
def execute(self, term, **kw): def execute(self, term, **kw):
@ -752,7 +752,7 @@ class aci_show(crud.Retrieve):
""" """
Display a single ACI given an ACI name. Display a single ACI given an ACI name.
""" """
INTERNAL = True NO_CLI = True
has_output_params = ( has_output_params = (
Str('aci', Str('aci',
@ -792,7 +792,7 @@ class aci_rename(crud.Update):
""" """
Rename an ACI. Rename an ACI.
""" """
INTERNAL = True NO_CLI = True
has_output_params = ( has_output_params = (
Str('aci', Str('aci',
label=_('ACI'), label=_('ACI'),

View File

@ -54,7 +54,7 @@ from ipalib.text import _
from ipapython.version import API_VERSION from ipapython.version import API_VERSION
class batch(Command): class batch(Command):
INTERNAL = True NO_CLI = True
takes_args = ( takes_args = (
List('methods?', List('methods?',

View File

@ -471,7 +471,7 @@ class dnsrecord_add_record(dnsrecord_mod_record):
""" """
Add records to DNS resource. Add records to DNS resource.
""" """
INTERNAL = True NO_CLI = True
def update_old_entry_callback(self, entry_attrs, old_entry_attrs): def update_old_entry_callback(self, entry_attrs, old_entry_attrs):
for (a, v) in entry_attrs.iteritems(): for (a, v) in entry_attrs.iteritems():
@ -509,7 +509,7 @@ class dnsrecord_delentry(LDAPDelete):
""" """
Delete DNS record entry. Delete DNS record entry.
""" """
INTERNAL = True NO_CLI = True
api.register(dnsrecord_delentry) api.register(dnsrecord_delentry)
@ -621,7 +621,7 @@ class dns_is_enabled(Command):
""" """
Checks if any of the servers has the DNS service enabled. Checks if any of the servers has the DNS service enabled.
""" """
INTERNAL = True NO_CLI = True
has_output = output.standard_value has_output = output.standard_value
base_dn = 'cn=masters,cn=ipa,cn=etc,%s' % api.env.basedn base_dn = 'cn=masters,cn=ipa,cn=etc,%s' % api.env.basedn

View File

@ -35,7 +35,7 @@ class json_metadata(Command):
""" """
Export plugin meta-data for the webUI. Export plugin meta-data for the webUI.
""" """
INTERNAL = False NO_CLI = True
takes_args = ( takes_args = (
@ -74,6 +74,8 @@ class json_metadata(Command):
api.register(json_metadata) api.register(json_metadata)
class i18n_messages(Command): class i18n_messages(Command):
NO_CLI = True
messages={ messages={
"login": {"header" :_("Logged In As")}, "login": {"header" :_("Logged In As")},
"button":{ "button":{

View File

@ -368,7 +368,7 @@ class permission_add_member(LDAPAddMember):
""" """
Add members to a permission. Add members to a permission.
""" """
INTERNAL = True NO_CLI = True
api.register(permission_add_member) api.register(permission_add_member)
@ -377,6 +377,6 @@ class permission_remove_member(LDAPRemoveMember):
""" """
Remove members from a permission. Remove members from a permission.
""" """
INTERNAL = True NO_CLI = True
api.register(permission_remove_member) api.register(permission_remove_member)

View File

@ -127,7 +127,7 @@ class privilege_add_member(LDAPAddMember):
""" """
Add members to a privilege Add members to a privilege
""" """
INTERNAL=True NO_CLI=True
api.register(privilege_add_member) api.register(privilege_add_member)
@ -136,7 +136,7 @@ class privilege_remove_member(LDAPRemoveMember):
""" """
Remove members from a privilege Remove members from a privilege
""" """
INTERNAL=True NO_CLI=True
api.register(privilege_remove_member) api.register(privilege_remove_member)

View File

@ -70,7 +70,7 @@ class cosentry(LDAPObject):
""" """
Class of Service object used for linking policies with groups Class of Service object used for linking policies with groups
""" """
INTERNAL = True NO_CLI = True
container_dn = 'cn=costemplates,%s' % api.env.container_accounts container_dn = 'cn=costemplates,%s' % api.env.container_accounts
object_class = ['top', 'costemplate', 'extensibleobject', 'krbcontainer'] object_class = ['top', 'costemplate', 'extensibleobject', 'krbcontainer']
@ -113,7 +113,7 @@ api.register(cosentry)
class cosentry_add(LDAPCreate): class cosentry_add(LDAPCreate):
INTERNAL = True NO_CLI = True
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
# check for existence of the group # check for existence of the group
@ -129,13 +129,13 @@ api.register(cosentry_add)
class cosentry_del(LDAPDelete): class cosentry_del(LDAPDelete):
INTERNAL = True NO_CLI = True
api.register(cosentry_del) api.register(cosentry_del)
class cosentry_mod(LDAPUpdate): class cosentry_mod(LDAPUpdate):
INTERNAL = True NO_CLI = True
def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
self.obj.check_priority_uniqueness(*keys, **options) self.obj.check_priority_uniqueness(*keys, **options)
@ -145,13 +145,13 @@ api.register(cosentry_mod)
class cosentry_show(LDAPRetrieve): class cosentry_show(LDAPRetrieve):
INTERNAL = True NO_CLI = True
api.register(cosentry_show) api.register(cosentry_show)
class cosentry_find(LDAPSearch): class cosentry_find(LDAPSearch):
INTERNAL = True NO_CLI = True
api.register(cosentry_find) api.register(cosentry_find)