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

Commit deea8ec

Browse files
Kuniwakahelal
authored andcommitted
Support both Python 2 and 3 (#48)
1 parent adf3564 commit deea8ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

callback/changes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
try:
88
from ansible.plugins.callback import CallbackBase
99
except ImportError:
10-
print "Fallback to Ansible 1.x compatibility"
10+
print("Fallback to Ansible 1.x compatibility")
1111
CallbackBase = object
1212

1313
class CallbackModule(CallbackBase):
@@ -47,8 +47,8 @@ def write_changed_to_file(self, host, res, name=None):
4747
try:
4848
with open(self.change_file, 'at') as the_file:
4949
the_file.write(js.dumps(changed_data) + "\n")
50-
except Exception, e:
51-
print "Ansible callback idempotency: Write to file failed '%s' error:'%s'" % (self.change_file, e)
50+
except Exception as e:
51+
print("Ansible callback idempotency: Write to file failed '{0}' error:'{1}'".format(self.change_file, e))
5252
exit(1)
5353

5454
def on_any(self, *args, **kwargs):
@@ -110,4 +110,4 @@ def playbook_on_play_start(self, name):
110110
pass
111111

112112
def playbook_on_stats(self, stats):
113-
print "Call back end"
113+
print("Call back end")

0 commit comments

Comments
 (0)