def report_item_to_dict(report_item): return dict( severity=report_item.severity, code=report_item.code, info=report_item.info, forceable=None if report_item.forceable is None else report_codes.FORCE, report_text=build_report_message(report_item), )
def wait_for_local_node_started(stop_at, interval): try: while True: time.sleep(interval) node_status = lib_pacemaker.get_local_node_status( utils.cmd_runner()) if is_node_fully_started(node_status): return 0, "Started" if datetime.datetime.now() > stop_at: return 1, "Waiting timeout" except LibraryError as e: return 1, "Unable to get node status: {0}".format("\n".join( [build_report_message(item) for item in e.args]))