Merge pull request #28666 from jfindlay/r_data

define r_data before using it in file module
This commit is contained in:
Mike Place 2015-11-06 17:46:26 -07:00
commit 4ad5056066

View File

@ -1427,6 +1427,7 @@ def replace(path,
if filesize is not 0: if filesize is not 0:
# First check the whole file, determine whether to make the replacement # First check the whole file, determine whether to make the replacement
# Searching first avoids modifying the time stamp if there are no changes # Searching first avoids modifying the time stamp if there are no changes
r_data = None
try: try:
# Use a read-only handle to open the file # Use a read-only handle to open the file
with salt.utils.fopen(path, with salt.utils.fopen(path,
@ -1486,6 +1487,7 @@ def replace(path,
except (OSError, IOError) as exc: except (OSError, IOError) as exc:
raise CommandExecutionError("Exception: {0}".format(exc)) raise CommandExecutionError("Exception: {0}".format(exc))
r_data = None
try: try:
# Open the file in write mode # Open the file in write mode
with salt.utils.fopen(path, with salt.utils.fopen(path,