mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
Merge pull request #28666 from jfindlay/r_data
define r_data before using it in file module
This commit is contained in:
commit
4ad5056066
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user