|
|
@ -182,6 +182,7 @@ def sensu_check(module, path, name, state='present', backup=False):
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
import simplejson as json
|
|
|
|
import simplejson as json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
stream = open(path, 'r')
|
|
|
|
stream = open(path, 'r')
|
|
|
|
config = json.load(stream.read())
|
|
|
|
config = json.load(stream.read())
|
|
|
@ -276,6 +277,7 @@ def sensu_check(module, path, name, state='present', backup=False):
|
|
|
|
if changed and not module.check_mode:
|
|
|
|
if changed and not module.check_mode:
|
|
|
|
if backup:
|
|
|
|
if backup:
|
|
|
|
module.backup_local(path)
|
|
|
|
module.backup_local(path)
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
stream = open(path, 'w')
|
|
|
|
stream = open(path, 'w')
|
|
|
|
stream.write(json.dumps(config, indent=2) + '\n')
|
|
|
|
stream.write(json.dumps(config, indent=2) + '\n')
|
|
|
|