Merge pull request #26529 from mnalt/fix_freebsdservice_module_for_missing_rcconf

bugfix: fix service.enable for missing rc.conf
This commit is contained in:
Justin Findlay 2015-08-20 16:53:08 -06:00
commit dfd8c457bd

View File

@ -162,7 +162,7 @@ def _switch(name, # pylint: disable=C0103
edited = True
if not edited:
# Ensure that the file ends in a \n
if nlines[-1][-1] != '\n':
if len(nlines) > 1 and nlines[-1][-1] != '\n':
nlines[-1] = '{0}\n'.format(nlines[-1])
nlines.append('{0}="{1}"\n'.format(rcvar, val))