Fixed bug in ecs_taskdefinition for new task with forced revision 1. (#20561)

This commit is contained in:
Andrej Svenke 2017-01-24 17:19:22 +01:00 committed by Ryan Brown
parent 034330e52f
commit 491b67f114

View file

@ -255,9 +255,9 @@ def main():
# We cannot reactivate an inactive revision
module.fail_json(msg="A task in family '%s' already exists for revsion %d, but it is inactive" % (family, revision))
elif not existing:
if len(existing_definitions_in_family) == 0 and revision != 1:
if not existing_definitions_in_family and revision != 1:
module.fail_json(msg="You have specified a revision of %d but a created revision would be 1" % revision)
elif existing_definitions_in_family[-1]['revision'] + 1 != revision:
elif existing_definitions_in_family and existing_definitions_in_family[-1]['revision'] + 1 != revision:
module.fail_json(msg="You have specified a revision of %d but a created revision would be %d" % (revision, existing_definitions_in_family[-1]['revision'] + 1))
else:
existing = None