Here's my version, that just calls the parameter prior to updating the attr. I tested it with:

[r...@ipa ~]# ipa user-mod --setattr uidnumber=555 kfrog
Modified user "kfrog"
  User login: kfrog
  First name: Kermit
  Last name: Frog
  Home directory: /home/kfrog
  Login shell: /bin/sh
  UID: 555
  Groups: ipausers
[r...@ipa ~]# ipa user-mod --setattr uidnumber=frog kfrog
ipa: ERROR: invalid 'uidnumber': must be an integer

Freeipa-devel mailing list
Pushed to Master. ACKed in IRC by rcrit, and based on a pzuna patch reviewd by both myself and rcrit

Since this was a diff to a Patch ACK

Freeipa-devel mailing list

Just ran the details patch on top of this, and the user details page does not work with it.

If you submit the page even with a minor edit to the full name you get an error: 'login' is required.

I've tested it out with the JSON and CURL:  Here is the JSON it is sending:

{"method":"user_mod","params":[["zoe"],{"all":true,"setattr":["cn=Zoe MacLeod","gidnumber=1044896486","title=","displayname=","initials=","uid=","mail=","street=","location=","postalcode=","ou=","carlicense="],"addattr":[],"givenname":"Zoe","sn":"MacPhearson","uidnumber":"1044896486","homedirectory":"/home/zoe","sizelimit":100}],"id":4}

The message 'login' is required is coming from the call I added to
    value = self.params[attr](value)
As it is the message inside RequirementError, which gets called from, specifically:

def validate(self, value):
        Check validity of ``value``.

        :param value: A proposed value for this parameter.
        if value is None:
            if self.required:
                raise RequirementError(name=self.cli_name)

My guess is the correct change is to skip this call if value is null, which seems to be what is happening. But I suspect we are sending in bogus values to setattr. Notice this part of the JSON

"setattr":["cn=Zoe MacLeod","gidnumber=1044896486","title=","displayname=","initials=","uid=","mail=","street=","location=","postalcode=","ou=","carlicense="]

My guess is that the details page shouldn't send any unset values. "uid=" in particular is probably a mistake. REmoving that from the JSON gets us to: an internal error has occurred.

Here's the stack trace:

ipa: ERROR: non-public: TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
File "/home/ayoung/devel/freeipa/ipaserver/", line 206, in wsgi_execute
    result = self.Command[name](*args, **options)
File "/home/ayoung/devel/freeipa/ipalib/", line 401, in __call__
    ret =*args, **options)
  File "/home/ayoung/devel/freeipa/ipalib/", line 674, in run
    return self.execute(*args, **options)
File "/home/ayoung/devel/freeipa/ipalib/plugins/", line 431, in execute
    addset = set(get_attributes(options.get('addattr', [])))
File "/home/ayoung/devel/freeipa/ipalib/plugins/", line 52, in get_attributes
    for attr in attrs:

Again, this is from the __call__ code, which means it is from the code I added, although now I'm not sure which parameter, if any is tripped the code.

I ran the full body of unit tests on the code as commited, and they all pass, as did the set of tests that Rob cobbled up (reminder: Lets get those added) so I don't think the call to self.params[attr](value) is wrong, but that it catches input errors that would have bitten us.

Freeipa-devel mailing list

Reply via email to