HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-82-83 6.8.0-1047-aws #50~22.04.1-Ubuntu SMP Thu Feb 19 21:15:28 UTC 2026 x86_64
User: www-data (33)
PHP: 7.4.29
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //lib/ubuntu-advantage/license_check.py
"""
Try to auto-attach in a GCP instance. This should only work
if the instance has a new UA license attached to it
"""
import logging

from uaclient.cli import setup_logging
from uaclient.config import UAConfig
from uaclient.jobs.license_check import gcp_auto_attach

LOG = logging.getLogger("ua_lib.license_check")

if __name__ == "__main__":
    cfg = UAConfig()
    # The ua-license-check logger should log everything to its file
    setup_logging(
        logging.CRITICAL,
        logging.DEBUG,
        log_file=cfg.license_check_log_file,
        logger=LOG,
    )
    # Make sure the ua-license-check logger does not generate double logging
    LOG.propagate = False
    # The root logger should log any error to the timer log file
    setup_logging(
        logging.CRITICAL, logging.ERROR, log_file=cfg.license_check_log_file
    )
    gcp_auto_attach(cfg=cfg)