Tweak to the way serial percentages are handled

This commit is contained in:
James Cammarata 2015-10-12 09:00:43 -04:00
parent 63e288354e
commit 82e76e42e5
2 changed files with 5 additions and 2 deletions

View file

@ -226,6 +226,9 @@ class PlaybookExecutor:
if isinstance(play.serial, basestring) and play.serial.endswith('%'): if isinstance(play.serial, basestring) and play.serial.endswith('%'):
serial_pct = int(play.serial.replace("%","")) serial_pct = int(play.serial.replace("%",""))
serial = int((serial_pct/100.0) * len(all_hosts)) serial = int((serial_pct/100.0) * len(all_hosts))
else:
if play.serial is None:
serial = -1
else: else:
serial = int(play.serial) serial = int(play.serial)

View file

@ -87,7 +87,7 @@ class Play(Base, Taggable, Become):
_any_errors_fatal = FieldAttribute(isa='bool', default=False, always_post_validate=True) _any_errors_fatal = FieldAttribute(isa='bool', default=False, always_post_validate=True)
_force_handlers = FieldAttribute(isa='bool', always_post_validate=True) _force_handlers = FieldAttribute(isa='bool', always_post_validate=True)
_max_fail_percentage = FieldAttribute(isa='percent', always_post_validate=True) _max_fail_percentage = FieldAttribute(isa='percent', always_post_validate=True)
_serial = FieldAttribute(isa='percent', default=0, always_post_validate=True) _serial = FieldAttribute(isa='string', always_post_validate=True)
_strategy = FieldAttribute(isa='string', default='linear', always_post_validate=True) _strategy = FieldAttribute(isa='string', default='linear', always_post_validate=True)
# ================================================================================= # =================================================================================