OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
uaclient
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
03/17/2025 09:32:20 AM
rwxr-xr-x
📄
__init__.py
0 bytes
08/08/2024 02:00:59 PM
rw-r--r--
📁
__pycache__
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
actions.py
14.25 KB
09/06/2024 06:58:57 PM
rw-r--r--
📁
api
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
apt.py
34.27 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
apt_news.py
8.32 KB
08/08/2024 02:00:59 PM
rw-r--r--
📁
cli
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📁
clouds
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
config.py
17.36 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
contract.py
29.96 KB
08/08/2024 08:21:51 PM
rw-r--r--
📄
contract_data_types.py
9.89 KB
08/08/2024 02:00:59 PM
rw-r--r--
📁
daemon
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
data_types.py
10.48 KB
08/08/2024 08:21:51 PM
rw-r--r--
📄
defaults.py
2.52 KB
09/06/2024 06:58:57 PM
rw-r--r--
📁
entitlements
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
event_logger.py
8.06 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
exceptions.py
17.17 KB
09/06/2024 11:58:19 PM
rw-r--r--
📁
files
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
gpg.py
836 bytes
08/08/2024 02:00:59 PM
rw-r--r--
📁
http
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
livepatch.py
12.85 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
lock.py
4.42 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
log.py
4.69 KB
08/08/2024 02:00:59 PM
rw-r--r--
📁
messages
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
secret_manager.py
648 bytes
08/08/2024 02:00:59 PM
rw-r--r--
📄
security_status.py
25.48 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
snap.py
7.09 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
status.py
28.42 KB
08/08/2024 02:00:59 PM
rw-r--r--
📄
system.py
26.03 KB
09/06/2024 11:58:19 PM
rw-r--r--
📁
timer
-
10/28/2024 08:41:34 AM
rwxr-xr-x
📄
types.py
308 bytes
08/08/2024 02:00:59 PM
rw-r--r--
📄
upgrade_lts_contract.py
3.54 KB
08/08/2024 08:21:51 PM
rw-r--r--
📄
util.py
15.45 KB
08/08/2024 08:21:51 PM
rw-r--r--
📄
version.py
2.62 KB
09/06/2024 11:58:19 PM
rw-r--r--
📄
yaml.py
840 bytes
08/08/2024 02:00:59 PM
rw-r--r--
Editing: version.py
Close
""" Client version related functions """ import os.path from math import inf from typing import Optional from uaclient.apt import ( get_apt_cache_time, get_pkg_candidate_version, version_compare, ) from uaclient.defaults import CANDIDATE_CACHE_PATH, UAC_RUN_PATH from uaclient.exceptions import ProcessExecutionError from uaclient.system import subp __VERSION__ = "34" PACKAGED_VERSION = "34~18.04" def get_version() -> str: """Return the packaged version as a string Prefer the binary PACKAGED_VESION set by debian/rules to DEB_VERSION. If unavailable, check for a .git development environments: a. If run in our upstream repo `git describe` will gives a leading XX.Y so return the --long version to allow daily build recipes to count commit offset from upstream's XX.Y signed tag. b. If run in a git-ubuntu pkg repo, upstream tags aren't visible, believe __VERSION__ is correct - there is and MUST always be a test to make sure it matches debian/changelog """ if not PACKAGED_VERSION.startswith("@@PACKAGED_VERSION"): return PACKAGED_VERSION topdir = os.path.dirname(os.path.dirname(__file__)) if os.path.exists(os.path.join(topdir, ".git")): cmd = ["git", "describe", "--abbrev=8", "--match=[0-9]*", "--long"] try: out, _ = subp(cmd) return out.strip() except ProcessExecutionError: pass return __VERSION__ def get_last_known_candidate() -> Optional[str]: # If we can't determine when the cache was updated for the last time, # We always assume it was as recent as possible - thus `inf`. last_apt_cache_update = get_apt_cache_time() or inf if ( not os.path.exists(CANDIDATE_CACHE_PATH) or os.stat(CANDIDATE_CACHE_PATH).st_mtime < last_apt_cache_update ): candidate_version = None try: candidate_version = get_pkg_candidate_version("ubuntu-pro-client") if candidate_version: os.makedirs(UAC_RUN_PATH, exist_ok=True) with open(CANDIDATE_CACHE_PATH, "w") as f: f.write(candidate_version) return candidate_version except Exception: if candidate_version is not None: return candidate_version try: with open(CANDIDATE_CACHE_PATH, "r") as f: return f.read().strip() except Exception: pass return None def check_for_new_version() -> Optional[str]: candidate = get_last_known_candidate() if candidate and version_compare(candidate, get_version()) > 0: return candidate return None