Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server-del: update defaultServerList in cn=default,ou=profile,$BASE #780

Closed
wants to merge 1 commit into from

Conversation

flo-renaud
Copy link
Contributor

@flo-renaud flo-renaud commented May 11, 2017

ipa server-del should remove the server from the entry
cn=default,ou=profile,$BASE
The entry contains an attribute
defaultServerList: srv1.domain.com srv2.domain.com srv3.domain.com

The code calls srvlist = ret.single_value.get('defaultServerList') which means
that srvlist contains a single value (string) containing all the servers
separated by a space, and not a list of attribute values. Because of that,
srvlist[0] corresponds to the first character of the value.
The fix splits srvlist and not srvlist[0].

https://pagure.io/freeipa/issue/6943

@martbab martbab self-assigned this May 11, 2017
mod = [(ldap.MOD_REPLACE, 'defaultServerList', attr)]
conn.conn.modify_s(str(dn), mod)
ret['defaultServerList'] = attr
conn.update_entry(ret)
except (errors.NotFound, ldap.NO_SUCH_ATTRIBUTE,
ldap.TYPE_OR_VALUE_EXISTS):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you now call update_entry instead of raw modify_s, you can replace ldap.NO_SUCH_ATTRIBUTE and ldap.TYPE_OR_VALUE_EXISTS exceptions with errors.MidairCollision and errors.EmptyModlist (see error_handler method of LDAPClient in ipapython/ipaldap.py for more info about raw ldap -> ipalib.errors mapping)

ipa server-del should remove the server from the entry
cn=default,ou=profile,$BASE
The entry contains an attribute
defaultServerList: srv1.domain.com srv2.domain.com srv3.domain.com

The code calls srvlist = ret.single_value.get('defaultServerList') which means
that srvlist contains a single value (string) containing all the servers
separated by a space, and not a list of attribute values. Because of that,
srvlist[0] corresponds to the first character of the value.
The fix splits srvlist and not srvlist[0].

https://pagure.io/freeipa/issue/6943
@flo-renaud
Copy link
Contributor Author

Hi @martbab,
Thank you for the review. I update the PR with your comments.

@martbab martbab added ack Pull Request approved, can be merged pushed Pull Request has already been pushed labels May 19, 2017
@martbab
Copy link
Contributor

martbab commented May 19, 2017

master:

  • a02a0a9 server-del: update defaultServerList in cn=default,ou=profile,$BASE

@martbab martbab closed this May 19, 2017
@flo-renaud flo-renaud deleted the t6943 branch May 22, 2017 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack Pull Request approved, can be merged pushed Pull Request has already been pushed
Projects
None yet
2 participants