Skip to content

Commit

Permalink
fix scope of python import (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahelal committed Sep 22, 2017
1 parent 50aa2e7 commit adf3564
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions callback/changes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import json
import os
import errno
import json as js
if not hasattr(js, 'dumps'):
js = js.json

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

try:
with open(self.change_file, 'at') as the_file:
the_file.write(json.dumps(changed_data) + "\n")
the_file.write(js.dumps(changed_data) + "\n")
except Exception, e:
print "Ansible callback idempotency: Write to file failed '%s' error:'%s'" % (self.change_file, e)
exit(1)
Expand Down

0 comments on commit adf3564

Please sign in to comment.