__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
"""
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__ = "37.1"
PACKAGED_VERSION = "37.1ubuntu0~24.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
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| api | Folder | 0755 |
|
|
| cli | Folder | 0755 |
|
|
| clouds | Folder | 0755 |
|
|
| daemon | Folder | 0755 |
|
|
| entitlements | Folder | 0755 |
|
|
| files | Folder | 0755 |
|
|
| http | Folder | 0755 |
|
|
| messages | Folder | 0755 |
|
|
| timer | Folder | 0755 |
|
|
| __init__.py | File | 0 B | 0644 |
|
| actions.py | File | 14.63 KB | 0644 |
|
| apt.py | File | 35.77 KB | 0644 |
|
| apt_news.py | File | 8.39 KB | 0644 |
|
| config.py | File | 18.91 KB | 0644 |
|
| contract.py | File | 35.88 KB | 0644 |
|
| contract_data_types.py | File | 9.89 KB | 0644 |
|
| data_types.py | File | 13.21 KB | 0644 |
|
| defaults.py | File | 3.19 KB | 0644 |
|
| event_logger.py | File | 8.06 KB | 0644 |
|
| exceptions.py | File | 18.29 KB | 0644 |
|
| gpg.py | File | 836 B | 0644 |
|
| livepatch.py | File | 12.85 KB | 0644 |
|
| lock.py | File | 4.42 KB | 0644 |
|
| log.py | File | 4.9 KB | 0644 |
|
| secret_manager.py | File | 648 B | 0644 |
|
| security_status.py | File | 26.16 KB | 0644 |
|
| snap.py | File | 6.26 KB | 0644 |
|
| status.py | File | 28.53 KB | 0644 |
|
| system.py | File | 28.12 KB | 0644 |
|
| types.py | File | 308 B | 0644 |
|
| update_contract_info.py | File | 1.55 KB | 0644 |
|
| upgrade_lts_contract.py | File | 3.22 KB | 0644 |
|
| util.py | File | 15.45 KB | 0644 |
|
| version.py | File | 2.63 KB | 0644 |
|
| yaml.py | File | 840 B | 0644 |
|