Skip to content
This repository was archived by the owner on Apr 7, 2025. It is now read-only.

Commit adf3564

Browse files
authored
fix scope of python import (#46)
1 parent 50aa2e7 commit adf3564

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

callback/changes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import json
21
import os
32
import errno
3+
import json as js
4+
if not hasattr(js, 'dumps'):
5+
js = js.json
46

57
try:
68
from ansible.plugins.callback import CallbackBase
@@ -44,7 +46,7 @@ def write_changed_to_file(self, host, res, name=None):
4446

4547
try:
4648
with open(self.change_file, 'at') as the_file:
47-
the_file.write(json.dumps(changed_data) + "\n")
49+
the_file.write(js.dumps(changed_data) + "\n")
4850
except Exception, e:
4951
print "Ansible callback idempotency: Write to file failed '%s' error:'%s'" % (self.change_file, e)
5052
exit(1)

0 commit comments

Comments
 (0)