Skip to content

Commit

Permalink
Merge pull request #515 from gnuoy/issue/514
Browse files Browse the repository at this point in the history
Return deepcopy of test config
  • Loading branch information
coreycb committed Jun 3, 2022
2 parents d5f57e5 + 221032c commit 1ec92a9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions zaza/charm_lifecycle/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

"""Utilities to support running lifecycle phases."""
import collections
import copy
import importlib
import logging
import os
Expand Down Expand Up @@ -407,15 +408,15 @@ def get_charm_config(yaml_file=None, fatal=True, cached=True):
else:
yaml_file = DEFAULT_TEST_CONFIG
if cached and yaml_file in _charm_config:
return _charm_config[yaml_file].copy()
return copy.deepcopy(_charm_config[yaml_file])
try:
with open(yaml_file, 'r') as stream:
content = yaml.safe_load(stream)
_charm_config[yaml_file] = content
if "tests_options" in content:
zaza.global_options.merge(content["tests_options"],
override=True)
return content.copy()
return copy.deepcopy(content)
except OSError:
if not fatal:
charm_name = os.path.basename(os.getcwd())
Expand Down

0 comments on commit 1ec92a9

Please sign in to comment.