[Freeipa-devel] Asking for help to add new options
Petr Viktorin
pviktori at redhat.com
Wed May 14 10:01:42 UTC 2014
On 05/14/2014 11:21 AM, thierry bordaz wrote:
> Hello,
>
> Quite beginner in freeipa land, I am trying to add options to
> 'user-add' sub-command but desperately failing to make it work.
> I did the following modification:
>
> diff --git a/ipalib/plugins/user.py b/ipalib/plugins/user.py
> index 9b21200..0c36e35 100644
> --- a/ipalib/plugins/user.py
> +++ b/ipalib/plugins/user.py
> @@ -365,6 +365,20 @@ class user(LDAPObject):
> csv=True,
> flags=['no_search'],
> ),
> + Flag('tostage?',
> + doc=_('Create user in staging container'),
> + flags=('no_search', 'virtual_attribute'),
> + cli_name='to_stage',
> + default=False,
> + ),
> + Str('uidstaged?',
> + pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$',
> + pattern_errmsg='may only include letters, numbers,
> _, -, . and $',
> + maxlength=255,
> + cli_name='from_staged',
> + label=_('Activate the User currently in the staging
> container'),
> + normalizer=lambda value: value.lower(),
> + ),
> )
>
> def _normalize_and_validate_email(self, email, config=None):
> @@ -436,12 +450,16 @@ class user_add(LDAPCreate):
> msg_summary = _('Added user "%(value)s"')
>
> has_output_params = LDAPCreate.has_output_params +
> user_output_params
> +
> + #internal_options = ['tostage', 'uidstaged']
>
> takes_options = LDAPCreate.takes_options + (
> Flag('noprivate',
> cli_name='noprivate',
> doc=_('Don\'t create user private group'),
> ),
> +
> +
> )
>
>
> The command 'ipa user-add --help' succeeds giving me the correct
> help message. But when I try to add the user it fails:
>
> ipa user-add foo --to-stage --first=foo --last=foo
> ipa: ERROR: Unknown option: tostage
>
>
> This seems to occur because the frontend find this is a 'remaining'
> option.. but what does it means ?
> I tried to add the new options as internal options, or with
> different names, but it gives the same results.
> I know it is a very novice question, but I have really no idea I
> should fix it. Anyone know what I am missing ?
>
> regards
> thierry
Hi,
Adding these options works for me; I think the most likely reason is
you're still using the old version. Did you install the changed file
properly? If you're just copying the .py file to /usr/lib, remember to
restart Apache.
--
Petr³
More information about the Freeipa-devel
mailing list