Github user jburwell commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1454#discussion_r59934099 --- Diff: tools/marvin/marvin/lib/utils.py --- @@ -520,4 +520,22 @@ def verifyRouterState(apiclient, routerid, allowedstates): if routers[0].state.lower() not in allowedstates: return [FAIL, "state of the router should be in %s but is %s" % (allowedstates, routers[0].state)] - return [PASS, None] \ No newline at end of file + return [PASS, None] + + + +def wait_until(retry_interval=2, no_of_times=2, callback=None, *callback_args): + """ Utility method to try out the callback method at most no_of_times with a interval of retry_interval, + Will return immediately if callback returns True. The callback method should be written to return a list of values first being a boolean """ + + if callback is None: + return INVALID_INPUT --- End diff -- @abhinandanprateek while it is permissible Python, it is considered an anti-pattern for a Python function to return different types. In this case, it can return a scalar value or a multi-return. Raising a ``ValueError`` is the idiomatic Python approach to handling an invalid parameter value. In addition to ensuring that the function always returns the same type, raising an error in this manner will cause the test to fail fast without callers having the check the return to properly fail.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---