Browse Source

paunch: use utils.load_config()

Use the new function that supports all use cases when loading
configurations. It supports old and new formats, files and directories.

Depends-On: https://review.opendev.org/#/c/701827
Change-Id: Ic10d0c28c1a98708c30a1554489b589dd8f255cd
(cherry picked from commit 5f138b57e3)
changes/41/701741/4
Emilien Macchi 3 months ago
parent
commit
655f7e027f
1 changed files with 1 additions and 15 deletions
  1. +1
    -15
      tripleo_ansible/ansible_plugins/modules/paunch.py

+ 1
- 15
tripleo_ansible/ansible_plugins/modules/paunch.py View File

@@ -150,21 +150,7 @@ class PaunchManager:
log_file=self.log_file)

if self.config:
if os.path.isdir(self.config):
container_configs = {}
config_files = [c_json for c_json in
os.listdir(self.config)
if c_json.startswith('hashed-')
and c_json.endswith('.json')]
for cf in config_files:
with open(os.path.join(self.config, cf), 'r') as f:
c = re.sub('^hashed-', '', os.path.splitext(cf)[0])
container_configs[c] = {}
container_configs[c].update(yaml.safe_load(f))
self.config_yaml = container_configs
else:
with open(self.config, 'r') as f:
self.config_yaml = yaml.safe_load(f)
self.config_yaml = putils_common.load_config(self.config)

if self.action == 'apply':
self.paunch_apply()

Loading…
Cancel
Save