summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--system/known_hosts.py4
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()