Merge "Handle secret strings correctly"
This commit is contained in:
commit
2747edfca2
@ -240,7 +240,7 @@ class DeployStackAction(templates.ProcessTemplatesAction):
|
||||
# CA to be trusted by the overcloud.
|
||||
try:
|
||||
with open(local_ca_path, 'rb') as ca_file:
|
||||
return ca_file.read()
|
||||
return ca_file.read().decode('utf-8')
|
||||
except IOError:
|
||||
# If the file wasn't found it means that the undercloud's TLS
|
||||
# was explicitly disabled or another CA is being used. So we'll
|
||||
|
@ -482,7 +482,7 @@ class DeployStackActionTest(base.TestCase):
|
||||
self.assertIn('CAMap', my_params)
|
||||
self.assertIn('undercloud-ca', my_params['CAMap'])
|
||||
self.assertIn('content', my_params['CAMap']['undercloud-ca'])
|
||||
self.assertEqual(b'FAKE CA CERT',
|
||||
self.assertEqual('FAKE CA CERT',
|
||||
my_params['CAMap']['undercloud-ca']['content'])
|
||||
|
||||
def test_set_tls_parameters_ca_found_camap_provided(self):
|
||||
@ -491,7 +491,7 @@ class DeployStackActionTest(base.TestCase):
|
||||
my_params = {}
|
||||
my_env = {
|
||||
'parameter_defaults': {
|
||||
'CAMap': {'overcloud-ca': {'content': b'ANOTER FAKE CERT'}}}}
|
||||
'CAMap': {'overcloud-ca': {'content': 'ANOTER FAKE CERT'}}}}
|
||||
with tempfile.NamedTemporaryFile() as ca_file:
|
||||
# Write test data
|
||||
ca_file.write(b'FAKE CA CERT')
|
||||
@ -503,11 +503,11 @@ class DeployStackActionTest(base.TestCase):
|
||||
self.assertIn('CAMap', my_params)
|
||||
self.assertIn('undercloud-ca', my_params['CAMap'])
|
||||
self.assertIn('content', my_params['CAMap']['undercloud-ca'])
|
||||
self.assertEqual(b'FAKE CA CERT',
|
||||
self.assertEqual('FAKE CA CERT',
|
||||
my_params['CAMap']['undercloud-ca']['content'])
|
||||
self.assertIn('overcloud-ca', my_params['CAMap'])
|
||||
self.assertIn('content', my_params['CAMap']['overcloud-ca'])
|
||||
self.assertEqual(b'ANOTER FAKE CERT',
|
||||
self.assertEqual('ANOTER FAKE CERT',
|
||||
my_params['CAMap']['overcloud-ca']['content'])
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ def create_cephx_key():
|
||||
# https://github.com/ceph/ceph-deploy/blob/master/ceph_deploy/new.py#L21
|
||||
key = os.urandom(16)
|
||||
header = struct.pack("<hiih", 1, int(time.time()), 0, len(key))
|
||||
return base64.b64encode(header + key)
|
||||
return base64.b64encode(header + key).decode('utf-8')
|
||||
|
||||
|
||||
def get_snmpd_readonly_user_password(mistralclient):
|
||||
@ -123,7 +123,7 @@ def get_snmpd_readonly_user_password(mistralclient):
|
||||
|
||||
|
||||
def create_keystone_credential():
|
||||
return base64.urlsafe_b64encode(os.urandom(32))
|
||||
return base64.urlsafe_b64encode(os.urandom(32)).decode('utf-8')
|
||||
|
||||
|
||||
def create_ssh_keypair(comment=None, bits=2048):
|
||||
@ -147,4 +147,4 @@ def create_rndc_key_secret():
|
||||
passlib.pwd.genword(length=_MIN_PASSWORD_SIZE).encode('utf-8'),
|
||||
msg=passlib.pwd.genword(length=_MIN_PASSWORD_SIZE).encode('utf-8'),
|
||||
digestmod=hashlib.sha256)
|
||||
return base64.b64encode(h.digest())
|
||||
return base64.b64encode(h.digest()).decode('utf-8')
|
||||
|
@ -85,8 +85,8 @@ def put_user_env(swift, container_name, env):
|
||||
|
||||
def write_json_temp_file(data):
|
||||
"""Writes the provided data to a json file and return the filename"""
|
||||
with tempfile.NamedTemporaryFile(delete=False, mode='w') as temp_file:
|
||||
temp_file.write(json.dumps(data))
|
||||
with tempfile.NamedTemporaryFile(delete=False, mode='wb') as temp_file:
|
||||
temp_file.write(json.dumps(data).encode('utf-8'))
|
||||
return temp_file.name
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user