<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 05/14/2014 12:01 PM, Petr Viktorin
wrote:<br>
</div>
<blockquote cite="mid:53733F06.3070101@redhat.com" type="cite">On
05/14/2014 11:21 AM, thierry bordaz wrote:
<br>
<blockquote type="cite">Hello,
<br>
<br>
Quite beginner in freeipa land, I am trying to add options
to
<br>
'user-add' sub-command but desperately failing to make it
work.
<br>
I did the following modification:
<br>
<br>
diff --git a/ipalib/plugins/user.py
b/ipalib/plugins/user.py
<br>
index 9b21200..0c36e35 100644
<br>
--- a/ipalib/plugins/user.py
<br>
+++ b/ipalib/plugins/user.py
<br>
@@ -365,6 +365,20 @@ class user(LDAPObject):
<br>
csv=True,
<br>
flags=['no_search'],
<br>
),
<br>
+ Flag('tostage?',
<br>
+ doc=_('Create user in staging container'),
<br>
+ flags=('no_search', 'virtual_attribute'),
<br>
+ cli_name='to_stage',
<br>
+ default=False,
<br>
+ ),
<br>
+ Str('uidstaged?',
<br>
+
pattern='^[a-zA-Z0-9_.][a-zA-Z0-9_.-]{0,252}[a-zA-Z0-9_.$-]?$',
<br>
+ pattern_errmsg='may only include letters,
numbers,
<br>
_, -, . and $',
<br>
+ maxlength=255,
<br>
+ cli_name='from_staged',
<br>
+ label=_('Activate the User currently in the
staging
<br>
container'),
<br>
+ normalizer=lambda value: value.lower(),
<br>
+ ),
<br>
)
<br>
<br>
def _normalize_and_validate_email(self, email,
config=None):
<br>
@@ -436,12 +450,16 @@ class user_add(LDAPCreate):
<br>
msg_summary = _('Added user "%(value)s"')
<br>
<br>
has_output_params = LDAPCreate.has_output_params +
<br>
user_output_params
<br>
+
<br>
+ #internal_options = ['tostage', 'uidstaged']
<br>
<br>
takes_options = LDAPCreate.takes_options + (
<br>
Flag('noprivate',
<br>
cli_name='noprivate',
<br>
doc=_('Don\'t create user private group'),
<br>
),
<br>
+
<br>
+
<br>
)
<br>
<br>
<br>
The command 'ipa user-add --help' succeeds giving me the
correct
<br>
help message. But when I try to add the user it fails:
<br>
<br>
ipa user-add foo --to-stage --first=foo --last=foo
<br>
ipa: ERROR: Unknown option: tostage
<br>
<br>
<br>
This seems to occur because the frontend find this is a
'remaining'
<br>
option.. but what does it means ?
<br>
I tried to add the new options as internal options, or with
<br>
different names, but it gives the same results.
<br>
I know it is a very novice question, but I have really no
idea I
<br>
should fix it. Anyone know what I am missing ?
<br>
<br>
regards
<br>
thierry
<br>
</blockquote>
<br>
Hi,
<br>
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.
<br>
<br>
</blockquote>
<font face="Times New Roman, Times, serif">Hi Petr,<br>
<br>
</font>
<blockquote><font face="Times New Roman, Times, serif">Thanks for
the info.<br>
I am using the cli, not the web interface and I installed just
copying user.py to
/usr/lib/python2.7/site-packages/ipalib/plugins/user.py.<br>
I believe I am using the new version as the '--help' option
shows the new added options '--to-stage' and '--from-stage'.<br>
Did you succeed to add a user with something like: </font>ipa
user-add foo --to-stage --first=foo --last=foo ?<br>
<br>
may be something bad with my deployment I am using freeipa 3.3.
Did you test on master ?<br>
<br>
regards<br>
thierry<br>
</blockquote>
</body>
</html>