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

ipa-replica-manage del (dl 0): remove server from defaultServerList #784

Closed
wants to merge 1 commit into from

Conversation

flo-renaud
Copy link
Contributor

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

ipa-replica-manage 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/6946

@martbab martbab self-assigned this May 15, 2017
mod = [(ldap.MOD_REPLACE, 'defaultServerList', attr)]
self.conn.modify_s(dn, mod)
ret['defaultServerList'] = attr
self.conn.update_entry(ret)
except errors.NotFound:
pass
except ldap.NO_SUCH_ATTRIBUTE:
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-replica-manage 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/6946
@flo-renaud
Copy link
Contributor Author

Hi @martbab
Thank you for the review. I updated 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:

  • 319a079 ipa-replica-manage del (dl 0): remove server from defaultServerList

@martbab martbab closed this May 19, 2017
@flo-renaud flo-renaud deleted the replicadel branch May 22, 2017 08:46
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