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: I917679da22fa09614e73053654df6ce181cf98fe Change-Id: Ic10d0c28c1a98708c30a1554489b589dd8f255cd
This commit is contained in:
parent
a023564172
commit
5f138b57e3
@ -146,21 +146,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
Block a user