#!/usr/bin/python3 import logging from datetime import datetime, timedelta, timezone from uaclient import apt from uaclient.apt_news import update_apt_news from uaclient.config import UAConfig from uaclient.daemon import setup_logging def main(cfg: UAConfig): if not cfg.apt_news: return last_update = apt.get_apt_cache_datetime() one_day_ago = datetime.now(timezone.utc) - timedelta(days=1) if last_update is not None and last_update > one_day_ago: return update_apt_news(cfg) if __name__ == "__main__": cfg = UAConfig() setup_logging( logging.INFO, logging.DEBUG, log_file=cfg.log_file, logger=logging.getLogger(), ) main(cfg)
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
apt-esm-json-hook | File | 54.31 KB | 0755 |
|
apt_news.py | File | 721 B | 0644 |
|
auto_attach.py | File | 2.98 KB | 0644 |
|
cloud-id-shim.sh | File | 500 B | 0755 |
|
daemon.py | File | 1.39 KB | 0644 |
|
esm_cache.py | File | 592 B | 0755 |
|
migrate_user_config.py | File | 5.42 KB | 0644 |
|
patch_status_json.py | File | 2.36 KB | 0755 |
|
reboot_cmds.py | File | 5.17 KB | 0644 |
|
timer.py | File | 6.36 KB | 0644 |
|
upgrade_lts_contract.py | File | 3.68 KB | 0755 |
|