"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "salt/states/file.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

file.py  (salt-3002.1):file.py  (salt-3002.2)
skipping to change at line 5301 skipping to change at line 5301
} }
if not name: if not name:
return _error(ret, "Must provide name to file.keyvalue") return _error(ret, "Must provide name to file.keyvalue")
if key is not None and value is not None: if key is not None and value is not None:
if type(key_values) is dict: if type(key_values) is dict:
return _error( return _error(
ret, "file.keyvalue can not combine key_values with key and valu e" ret, "file.keyvalue can not combine key_values with key and valu e"
) )
key_values = {str(key): value} key_values = {str(key): value}
elif type(key_values) is not dict:
elif not isinstance(key_values, dict) or not key_values:
msg = "is not a dictionary"
if not key_values:
msg = "is empty"
return _error( return _error(
ret, "file.keyvalue key and value not supplied and key_values empty" ret, "file.keyvalue key and value not supplied and key_values " + ms g,
) )
# try to open the file and only return a comment if ignore_if_missing is # try to open the file and only return a comment if ignore_if_missing is
# enabled, also mark as an error if not # enabled, also mark as an error if not
file_contents = [] file_contents = []
try: try:
with salt.utils.files.fopen(name, "r") as fd: with salt.utils.files.fopen(name, "r") as fd:
file_contents = fd.readlines() file_contents = fd.readlines()
except OSError: except OSError:
ret["comment"] = "unable to open {n}".format(n=name) ret["comment"] = "unable to open {n}".format(n=name)
 End of changes. 2 change blocks. 
2 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)