trigger.changemgmt — Change management library

Abstract interface to bounce windows and moratoria.

class trigger.changemgmt.BounceStatus(str)

Class for bounce window statuses.

Objects stringify to ‘red’, ‘green’, or ‘yellow’, and can be compared against those strings. Objects can also be compared against each other. ‘red’ > ‘yellow’ > ‘green’.

class trigger.changemgmt.BounceWindow(status_by_hour)

Build a bounce window based on a list of 24 BounceStatus objects.

Although the query API is generic and could accomodate any sort of bounce window policy, this constructor knows only about AOL’s bounce windows, which operate on US Eastern time (worldwide), always change on hour boundaries, and are the same every day. If that ever changes, only this class will need to be updated.

End-users are not expected to create new BounceWindow objects; instead, use site_bounce() or NetDevice.site.bounce to get an object, then query its methods.

next_ok(status, when=None)

Return the next time at or after the specified time (default now) that it the bounce status will be at equal to or less than the given status. For example, next_ok(‘yellow’) will return the time that the bounce window becomes yellow or green. Returns UTC time.

status(when=None)

Return a BounceStatus object for the specified time, or for now.

trigger.changemgmt.site_bounce(site, oncallid=None)

Return the bounce window for the given site.

Previous topic

trigger.acl — ACL parsing library

Next topic

trigger.cmds — Command execution library

This Page