From 64c072b7b3deb1800c242b365e277591f056093d Mon Sep 17 00:00:00 2001 From: Jason Gerard DeRose Date: Wed, 14 Jan 2009 22:10:09 -0700 Subject: Updated hostgroup plugins module to where it can at least be imported --- TODO | 17 +++++++++++++++++ ipalib/plugins/f_hostgroup.py | 34 ++++++++++++++++------------------ 2 files changed, 33 insertions(+), 18 deletions(-) diff --git a/TODO b/TODO index 64a9f097..2e3dcde4 100644 --- a/TODO +++ b/TODO @@ -54,6 +54,19 @@ CRUD base classes: * The Retrieve method should add in the common Flag('all') option for retrieving all attributes. + * We probably need some LDAP centric crud method base classes, like + LDAPCreate, etc. Or other options it to have an LDAPObject base class and + have the crud Method plugins rely more on their corresponding Object plugin. + + +Existing plugins: + + * Many existing plugins that are doing crud-type operations aren't using the + Object + Method way of defining their parameters, and are therefore defining + the exact same parameter several times in a module. This should be fixed + one way or another... if there are deficiencies in the crud base classes, + they need to be improved. + Command Line interface: @@ -61,6 +74,10 @@ Command Line interface: * Make possible Enum values self-documenting + * All "comma-separated list of..." parameters should really be changed to + multivalue and have a flag that tells the CLI whether a multivalue should + be parsed as comma-separated. + Improve ease of plugin writting - make "from ipalib import *" import everything a plugin writter will need diff --git a/ipalib/plugins/f_hostgroup.py b/ipalib/plugins/f_hostgroup.py index 3e14b09a..c365c918 100644 --- a/ipalib/plugins/f_hostgroup.py +++ b/ipalib/plugins/f_hostgroup.py @@ -21,12 +21,10 @@ Frontend plugins for groups of hosts """ -from ipalib import frontend -from ipalib import crud -from ipalib.frontend import Param -from ipalib import api -from ipalib import errors -from ipalib import ipa_types +from ipalib import api, crud, errors +from ipalib import Object, Command # Plugin base classes +from ipalib import Str # Parameter types + hostgroup_filter = "groupofnames)(!(objectclass=posixGroup)" @@ -43,18 +41,18 @@ def get_members(members): return members -class hostgroup(frontend.Object): +class hostgroup(Object): """ Host Group object. """ takes_params = ( - Param('description', + Str('description', doc='A description of this group', ), - Param('cn', + Str('cn', cli_name='name', primary_key=True, - normalize=lambda value: value.lower(), + normalizer=lambda value: value.lower(), ) ) api.register(hostgroup) @@ -220,14 +218,14 @@ class hostgroup_show(crud.Get): api.register(hostgroup_show) -class hostgroup_add_member(frontend.Command): +class hostgroup_add_member(Command): 'Add a member to a group.' takes_args = ( - Param('group', primary_key=True), + Str('group', primary_key=True), ) takes_options = ( - Param('groups?', doc='comma-separated list of host groups to add'), - Param('hosts?', doc='comma-separated list of hosts to add'), + Str('groups?', doc='comma-separated list of host groups to add'), + Str('hosts?', doc='comma-separated list of hosts to add'), ) def execute(self, cn, **kw): """ @@ -288,14 +286,14 @@ class hostgroup_add_member(frontend.Command): api.register(hostgroup_add_member) -class hostgroup_remove_member(frontend.Command): +class hostgroup_remove_member(Command): 'Remove a member from a group.' takes_args = ( - Param('group', primary_key=True), + Str('group', primary_key=True), ) takes_options = ( - Param('hosts?', doc='comma-separated list of hosts to add'), - Param('groups?', doc='comma-separated list of groups to remove'), + Str('hosts?', doc='comma-separated list of hosts to add'), + Str('groups?', doc='comma-separated list of groups to remove'), ) def execute(self, cn, **kw): """ -- cgit