Skip to content

Commit 8f40f8c

Browse files
authored
os_password has to be a string (#1685)
Signed-off-by: Christian Berendt <[email protected]>
1 parent 3b4f516 commit 8f40f8c

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

osism/tasks/openstack.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,13 +221,19 @@ def get_cloud_password(cloud):
221221

222222
password = decrypted_secrets.get(password_key)
223223

224-
if password and isinstance(password, str):
225-
logger.info(f"Successfully loaded password for cloud '{cloud}'")
226-
return password
224+
if password is not None:
225+
# Convert password to string and strip whitespace
226+
password_str = str(password).strip()
227+
if password_str:
228+
logger.info(f"Successfully loaded password for cloud '{cloud}'")
229+
return password_str
230+
else:
231+
logger.warning(
232+
f"Password key '{password_key}' is empty after conversion"
233+
)
234+
return None
227235
else:
228-
logger.warning(
229-
f"Password key '{password_key}' not found or invalid type in secrets file"
230-
)
236+
logger.warning(f"Password key '{password_key}' not found in secrets file")
231237
return None
232238

233239
except Exception as exc:

0 commit comments

Comments
 (0)