Example #1
0
def program_exit(status, msg):
    global vms

    info("Program exit called with status", status, "(",get_exit_code_name(status),")")
    info("Stopping all vms")

    for vm in vms:
        vm.stop().wait()

    # Print status message and exit with appropriate code
    if (status):
        print color.EXIT_ERROR(get_exit_code_name(status), msg)
    else:
        print color.SUCCESS(msg)

    sys.exit(status)
Example #2
0
    def exit(self, status, msg):
        self._exit_status = status
        self.stop()
        print color.INFO(nametag),"Exit called with status", self._exit_status, "(",get_exit_code_name(self._exit_status),")"
        print color.INFO(nametag),"Calling on_exit"
        # Change back to test source
        os.chdir(self._root)
        self._on_exit()
        if status == 0:
            # Print success message and return to caller
            print color.SUCCESS(msg)
            print color.INFO(nametag),"Calling on_exit_success"
            return self._on_exit_success()

        # Print fail message and exit with appropriate code
        print color.EXIT_ERROR(get_exit_code_name(status), msg)
        sys.exit(status)