diff options
author | Alexandre Garnier <zigarn@users.noreply.github.com> | 2016-12-07 17:00:14 +0100 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2016-12-10 11:21:31 -0800 |
commit | 9c5fa68ff77a523349a2ecf3e6824742051aeed5 (patch) | |
tree | 93c7adf0d9592d6634adf62ac5c6e17600c39df9 | |
parent | 33ab2e00b00dd6ef1a6255ea2201a958a51bedb7 (diff) | |
download | ansible-modules-extras-9c5fa68ff77a523349a2ecf3e6824742051aeed5.tar.gz |
Fix python 2.4 compatibility
`start` keyword of `enumerate` is only available since python 2.6
Cherrypicked from 0f7abad38f3b4558400fe20eb3742603f64b939c
-rw-r--r-- | system/known_hosts.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/system/known_hosts.py b/system/known_hosts.py index 0c9f24f4..cb39d35d 100644 --- a/system/known_hosts.py +++ b/system/known_hosts.py @@ -133,8 +133,8 @@ def enforce_state(module, params): try: outf=tempfile.NamedTemporaryFile(dir=os.path.dirname(path)) if inf is not None: - for line_number, line in enumerate(inf, start=1): - if found_line==line_number and (replace_or_add or state=='absent'): + for line_number, line in enumerate(inf): + if found_line==(line_number + 1) and (replace_or_add or state=='absent'): continue # skip this line to replace its key outf.write(line) inf.close() |