aboutsummaryrefslogtreecommitdiff
path: root/kolla_ansible/cmd
diff options
context:
space:
mode:
authorBorne Mace <borne.mace@oracle.com>2018-05-22 16:33:40 -0700
committerBorne Mace <borne.mace@oracle.com>2018-05-22 16:33:40 -0700
commitf1768ef7abb9ef183601c528dbd8bac5b315ad35 (patch)
tree2d8af0cc5de2d2986bfee669685c191a14b047c5 /kolla_ansible/cmd
parent2ca94a62d1e2b9b65943b3d647ee1325e48022dc (diff)
downloadkolla-ansible-f1768ef7abb9ef183601c528dbd8bac5b315ad35.tar.gz
kolla-ansible-f1768ef7abb9ef183601c528dbd8bac5b315ad35.zip
Updated genpwd to work with python35
Due to the changes in hmac.new and how binary strings are dumped in yaml.safe_dump some changes were needed to make sure that we dumped only strings, not binary strings. Change-Id: Ic2fbcf2347023c1e9e666203dfe40dbeaf24ce5f
Diffstat (limited to 'kolla_ansible/cmd')
-rwxr-xr-xkolla_ansible/cmd/genpwd.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/kolla_ansible/cmd/genpwd.py b/kolla_ansible/cmd/genpwd.py
index 20c71ab46..8a0ab5642 100755
--- a/kolla_ansible/cmd/genpwd.py
+++ b/kolla_ansible/cmd/genpwd.py
@@ -46,11 +46,11 @@ def generate_RSA(bits=4096):
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.PKCS8,
encryption_algorithm=serialization.NoEncryption()
- )
+ ).decode()
public_key = new_key.public_key().public_bytes(
encoding=serialization.Encoding.OpenSSH,
format=serialization.PublicFormat.OpenSSH
- )
+ ).decode()
return private_key, public_key
@@ -112,12 +112,12 @@ def main():
passwords[k] = uuidutils.generate_uuid()
elif k in hmac_md5_keys:
passwords[k] = (hmac.new(
- uuidutils.generate_uuid(), '', md5)
- .digest().encode('base64')[:-1])
+ uuidutils.generate_uuid().encode(), ''.encode(), md5)
+ .hexdigest())
elif k in hmac_sha256_keys:
passwords[k] = (hmac.new(
- uuidutils.generate_uuid(), '', sha256)
- .digest().encode('base64')[:-1])
+ uuidutils.generate_uuid().encode(), ''.encode(), sha256)
+ .hexdigest())
else:
passwords[k] = ''.join([
random.SystemRandom().choice(