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
)
This commit is contained in:
parent
456425f37a
commit
655f7e027f
|
@ -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…
Reference in New Issue