Merge "Use with keyword for opening target file"

This commit is contained in:
Zuul
2019-01-31 18:52:43 +00:00
committed by Gerrit Code Review

View File

@@ -1101,7 +1101,8 @@ class Deploy(command.Command):
raise exceptions.DeploymentError(msg)
target = override_file
data = open(target, 'r').read()
with open(target, 'rb') as fb:
data = fb.read()
if not data.strip():
# since an empty file isn't valid yaml, let's be more specific
msg = (_("hieradata override file (%s) cannot be empty") % target)