Skip to content

Commit

Permalink
Fix passwords.yml generation when parent directory doesn't exist
Browse files Browse the repository at this point in the history
Fixes an issue where generation of passwords.yml for Kolla Ansible
could fail if the directory containing the file does not exist. This is
typical in a multiple environment setup, when creating a new
environment.

Story: 2010293
Task: 46275
Closes-Bug: #2015093
Change-Id: I9dce73a8a205c0c0ad02eba3a10e02b82f5b191d
  • Loading branch information
markgoddard authored and mmalchuk committed Apr 13, 2023
1 parent a2f9801 commit 5287083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ansible/roles/kolla-ansible/library/kolla_passwords.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

from ansible.module_utils.basic import *

import os
import os.path
import shutil
import tempfile
Expand Down Expand Up @@ -154,6 +155,8 @@ def kolla_passwords(module):
checksum_temp_file = module.sha1(temp_file_path)
changed = checksum_dest != checksum_temp_file
else:
os.makedirs(os.path.dirname(module.params['dest']),
exist_ok=True)
changed = True

# Encrypt the file.
Expand Down
8 changes: 8 additions & 0 deletions releasenotes/notes/fix-kolla-passwords-f1b5d051c494b4d8.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
fixes:
- |
Fixes an issue where generation of ``passwords.yml`` for Kolla Ansible
could fail if the directory containing the file does not exist. This is
typical in a multiple environment setup, when creating a new environment.
See `story 2010293 <https://storyboard.openstack.org/#!/story/2010293>`_
for details.

0 comments on commit 5287083

Please sign in to comment.