Skip to content

Commit

Permalink
Suppress YAMLLoadWarning (#728)
Browse files Browse the repository at this point in the history
* Explicitly specify yaml.load() to use Loader=FullLoader to suppress
deprecated warning.

* Use safe_load instead of FullLoad.
  • Loading branch information
chanchiwai-ray authored Jul 22, 2022
1 parent 8939617 commit 96d51ee
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charmhelpers/contrib/templating/contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def juju_state_to_yaml(yaml_path, namespace_separator=':',

if os.path.exists(yaml_path):
with open(yaml_path, "r") as existing_vars_file:
existing_vars = yaml.load(existing_vars_file.read())
existing_vars = yaml.safe_load(existing_vars_file.read())
else:
with open(yaml_path, "w+"):
pass
Expand Down
2 changes: 1 addition & 1 deletion tools/charm_helpers_sync/charm_helpers_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def parse_config(conf_file):
if not os.path.isfile(conf_file):
logging.error('Invalid config file: %s.' % conf_file)
return False
return yaml.load(open(conf_file).read())
return yaml.safe_load(open(conf_file).read())


def clone_helpers(work_dir, repo):
Expand Down

0 comments on commit 96d51ee

Please sign in to comment.