From 314e6a91876183d2f666ba349ecb73d55af60435 Mon Sep 17 00:00:00 2001 From: Oleksandr Poliatykin Date: Sun, 5 Jan 2020 00:08:26 +0100 Subject: [PATCH] Fixed python code to be python3 compatible. Fix compatibility for latest Ansible 2.9.2 --- library/minecraft_server_file.py | 4 ++-- tasks/process_controll/systemd/main.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/minecraft_server_file.py b/library/minecraft_server_file.py index a242b1f..acbb134 100755 --- a/library/minecraft_server_file.py +++ b/library/minecraft_server_file.py @@ -149,7 +149,7 @@ def __init__(self, module): # Convert all values to strings. The default booleans in # server.properties are represented by "true" and "false" instead of # Python's "True" and "False", so convert them explicitly. - for name, value in properties.iteritems(): + for name, value in properties.items(): properties[name] = ( str(value).lower() if isinstance(value, bool) else str(value) ) @@ -169,7 +169,7 @@ def __init__(self, module): else: self.newlines.append(line) - for name, value in properties.iteritems(): + for name, value in properties.items(): self.newlines.append("{}={}\n".format(name, value)) self._content_changed = True diff --git a/tasks/process_controll/systemd/main.yml b/tasks/process_controll/systemd/main.yml index cf17719..3f972c6 100644 --- a/tasks/process_controll/systemd/main.yml +++ b/tasks/process_controll/systemd/main.yml @@ -1,6 +1,6 @@ --- - include: Ubuntu.yml - when: ansible_distribution == 'Ubuntu' and ansible_distribution_version | version_compare('16.04', '<') + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version('16.04', '<') - name: install units template: