From 655f7e027f834edb54566fbddfb1f6b5d9692abc Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Mon, 28 Oct 2019 11:53:20 +0100 Subject: [PATCH] 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 5f138b57e311625b9ae67b61644f27b288afd188) --- .../ansible_plugins/modules/paunch.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/tripleo_ansible/ansible_plugins/modules/paunch.py b/tripleo_ansible/ansible_plugins/modules/paunch.py index 5594ee522..0b26939f5 100644 --- a/tripleo_ansible/ansible_plugins/modules/paunch.py +++ b/tripleo_ansible/ansible_plugins/modules/paunch.py @@ -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()