def METHOD_NAME(cfg: config.UAConfig) -> int:
    if not state_files.reboot_cmd_marker_file.is_present:
        LOG.debug("Skipping reboot_cmds. Marker file not present")
        notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED)
        return 0
    if not _is_attached(cfg).is_attached:
        LOG.debug("Skipping reboot_cmds. Machine is unattached")
        state_files.reboot_cmd_marker_file.delete()
        notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED)
        return 0
    LOG.debug("Running reboot commands...")
    try:
        with lock.SpinLock(cfg=cfg, lock_holder="pro-reboot-cmds"):
            fix_pro_pkg_holds(cfg)
            refresh_contract(cfg)
            upgrade_lts_contract.process_contract_delta_after_apt_lock(cfg)
            # cleanup state after a succesful run
            state_files.reboot_cmd_marker_file.delete()
            notices.remove(notices.Notice.REBOOT_SCRIPT_FAILED)
    except exceptions.LockHeldError as e:
        LOG.warning("Lock not released. %s", str(e.msg))
        notices.add(notices.Notice.REBOOT_SCRIPT_FAILED)
        return 1
    except exceptions.UbuntuProError as e:
        LOG.error(
            "Error while running commands on reboot: %s, %s", e.msg_code, e.msg
        )
        notices.add(notices.Notice.REBOOT_SCRIPT_FAILED)
        return 1
    except Exception as e:
        LOG.error("Failed running commands on reboot. Error: %s", str(e))
        notices.add(notices.Notice.REBOOT_SCRIPT_FAILED)
        return 1
    LOG.debug("Successfully ran all commands on reboot.")
    return 0