[Freeipa-devel] Asking for help to add new options

thierry bordaz tbordaz at redhat.com
Wed May 14 09:21:17 UTC 2014


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20140514/6154bb2e/attachment.htm>


More information about the Freeipa-devel mailing list