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-server-install, ipa-server-upgrade fixes #460

Closed
wants to merge 9 commits into from
Closed

ipa-server-install, ipa-server-upgrade fixes #460

wants to merge 9 commits into from

Conversation

MartinBasti
Copy link
Contributor

@MartinBasti MartinBasti commented Feb 13, 2017

ipa-server-install --setup-dns now work without BytesWarnings under python3, ipa-server-upgrade should work on IPA side but there are issues on pyldap side.

# The SafeConfigParser class has been renamed to ConfigParser in Py3
from configparser import ConfigParser as SafeConfigParser
else:
from ConfigParser import SafeConfigParser
# pylint: enable=import-error
Copy link
Contributor

Choose a reason for hiding this comment

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

Are the pylint pragmas still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, still needed for pylint-3

@@ -283,8 +283,7 @@ def __setup_replica_keys(self):
while True:
# check if key with this ID exist in softHSM
# id is 16 Bytes long
key_id = "".join(chr(random.randint(0, 255))
for _ in range(0, 16))
key_id = bytes(random.randint(0, 255) for _ in range(0, 16))
Copy link
Contributor

Choose a reason for hiding this comment

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

$ python2 -c 'import random; print(repr(bytes(random.randint(0, 255) for _ in range(0, 16))))'
'<generator object <genexpr> at 0x7f872517f730>'
$ python3 -c 'import random; print(repr(bytes(random.randint(0, 255) for _ in range(0, 16))))'
b'\x11\xd9\xd9\x9c\x98U\xb8w\x17\x8ar\xd6\xc6\x91\xe8\xb4'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

reworked

@MartinBasti MartinBasti changed the title [Py3] ipa-server-install, ipa-server-upgrade fixes ipa-server-install, ipa-server-upgrade fixes May 25, 2017
@stlaz stlaz self-assigned this May 29, 2017
"""
return struct.pack(
"B" * key_id_len, # key_id must be bytes
*(random.randint(0, 255) for _ in range(key_id_len))
Copy link
Contributor

Choose a reason for hiding this comment

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

You should use ipautil.ipa_generate_password() here instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is not password, but ID

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, nvm, saw key which triggered a reaction. LGTM then, need to test it.

@stlaz
Copy link
Contributor

stlaz commented May 30, 2017

python3-pyldap on Fedoras 25/26 is kind of in flames: https://bugzilla.redhat.com/show_bug.cgi?id=1456673. I will see if I can get an upstream version of the package to test this properly.

@stlaz stlaz closed this May 30, 2017
@stlaz stlaz reopened this May 30, 2017
@stlaz stlaz added the ack Pull Request approved, can be merged label May 30, 2017
@MartinBasti MartinBasti removed the ack Pull Request approved, can be merged label May 30, 2017
@@ -744,10 +749,9 @@ def read_replica_info(dir_path, rconfig):

rconfig is a ReplicaConfig object
"""
filename = dir_path + "/realm_info"
fd = open(filename)
filename = os.path.join(dir_path, "/realm_info")
Copy link
Contributor

Choose a reason for hiding this comment

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

One shall not os.path.join() with / (causes ipa-replica-install on DL0 to fail)

DeprecationWarning: The SafeConfigParser class has been renamed
to ConfigParser in Python 3.2. This alias will be removed in
future versions. Use ConfigParser directly instead.

https://fedorahosted.org/freeipa/ticket/4985
ConfigParser.readfd() is deprecated in py3, we can use .read() which is
compatible with py2

https://fedorahosted.org/freeipa/ticket/4985
softhsm works with bytes, so key_id must be byte otherwise we get errors
from bytes and string comparison

https://fedorahosted.org/freeipa/ticket/4985
with py3 urlopen used internally with pyldap doesn't work with raw
filepaths without specifying "file://" prefix. This works on both
py2/py3

https://fedorahosted.org/freeipa/ticket/4985
@stlaz
Copy link
Contributor

stlaz commented May 31, 2017

ACK, I did a sanity testing, if something's wrong, some kind of our CI will hopefully tell us.

@stlaz stlaz added the ack Pull Request approved, can be merged label May 31, 2017
@MartinBasti
Copy link
Contributor Author

master:

  • 2e63ec4 py3: use ConfigParser instead of SafeConfigParser
  • 6e7071d py3: ConfigParser: replace deprecated readfd with read
  • 27f8f9f py3: ipaldap: encode Boolean as bytes
  • d7a9e81 py3: softhsm key_id must be bytes
  • bc9adda py3: LDAP updates: use only bytes/raw values
  • d89de42 py3: schemaupdate: fix BytesWarning
  • b09a941 py3: cainstance: fix BytesWarning
  • c6a57d8 py3: urlfetch: use "file://" prefix with filenames
  • 99771ce py3: update_mod_nss_cipher_suite: ordering doesn't work with None

@MartinBasti MartinBasti added the pushed Pull Request has already been pushed label Jun 1, 2017
@MartinBasti MartinBasti closed this Jun 1, 2017
@MartinBasti MartinBasti deleted the py3-fixes2 branch June 1, 2017 07:25
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
3 participants