Fix python 2.4 compatibility
`start` keyword of `enumerate` is only available since python 2.6
This commit is contained in:
parent
65491cc839
commit
0f7abad38f
1 changed files with 2 additions and 2 deletions
|
@ -145,8 +145,8 @@ def enforce_state(module, params):
|
||||||
try:
|
try:
|
||||||
outf=tempfile.NamedTemporaryFile(dir=os.path.dirname(path))
|
outf=tempfile.NamedTemporaryFile(dir=os.path.dirname(path))
|
||||||
if inf is not None:
|
if inf is not None:
|
||||||
for line_number, line in enumerate(inf, start=1):
|
for line_number, line in enumerate(inf):
|
||||||
if found_line==line_number and (replace_or_add or state=='absent'):
|
if found_line==(line_number + 1) and (replace_or_add or state=='absent'):
|
||||||
continue # skip this line to replace its key
|
continue # skip this line to replace its key
|
||||||
outf.write(line)
|
outf.write(line)
|
||||||
inf.close()
|
inf.close()
|
||||||
|
|
Loading…
Reference in a new issue