Prevent stacktrace on os.path.exists in hosts module

If hfn is None, it will stacktrace in os.path.exists. Change it
to an empty string.
This commit is contained in:
rallytime 2015-04-20 16:21:24 -06:00
parent 2973eb18bc
commit c88a1ea243

View file

@ -29,6 +29,8 @@ def _get_or_create_hostfile():
does not exist.
'''
hfn = __get_hosts_filename()
if hfn is None:
hfn = ''
if not os.path.exists(hfn):
salt.utils.fopen(hfn, 'w').close()
return hfn