__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import logging
from typing import Any, Dict, Optional, Tuple
from uaclient import api, event_logger, exceptions, messages, system, util
from uaclient.entitlements.base import UAEntitlement
from uaclient.entitlements.entitlement_status import (
ApplicabilityStatus,
ApplicationStatus,
)
LOG = logging.getLogger(util.replace_top_level_logger_name(__name__))
event = event_logger.get_event_logger()
class LandscapeEntitlement(UAEntitlement):
name = "landscape"
title = messages.LANDSCAPE_TITLE
description = messages.LANDSCAPE_DESCRIPTION
help_doc_url = messages.urls.LANDSCAPE_HOME_PAGE
help_text = messages.LANDSCAPE_HELP_TEXT
def enable_steps(self) -> int:
return 1
def disable_steps(self) -> int:
return 1
def _perform_enable(self, progress: api.ProgressWrapper) -> bool:
cmd = ["landscape-config"] + self.extra_args
if not progress.is_interactive() and "--silent" not in cmd:
cmd += ["--silent"]
LOG.debug("Executing: %r", cmd)
progress.progress(
util.redact_sensitive_logs(
messages.EXECUTING_COMMAND.format(command=" ".join(cmd))
)
)
try:
system.subp(cmd, pipe_stdouterr=not progress.is_interactive())
except exceptions.ProcessExecutionError as e:
LOG.exception(e)
if not progress.is_interactive():
progress.emit("info", e.stderr.strip())
raise exceptions.LandscapeConfigFailed(
stdout=e.stdout.strip(), stderr=e.stderr.strip()
)
return False
return True
def _perform_disable(self, progress: api.ProgressWrapper) -> bool:
cmd = ["landscape-config", "--disable"]
progress.progress(
messages.EXECUTING_COMMAND.format(command=" ".join(cmd))
)
try:
system.subp(cmd)
except exceptions.ProcessExecutionError as e:
LOG.error(e)
progress.emit("info", str(e).strip())
progress.emit("info", messages.LANDSCAPE_CONFIG_REMAINS)
return True
def application_status(
self,
) -> Tuple[ApplicationStatus, Optional[messages.NamedMessage]]:
if (
self.are_required_packages_installed()
and system.is_systemd_unit_active("landscape-client")
):
return (ApplicationStatus.ENABLED, None)
else:
return (
ApplicationStatus.DISABLED,
messages.LANDSCAPE_SERVICE_NOT_ACTIVE,
)
def applicability_status(
self,
) -> Tuple[ApplicabilityStatus, Optional[messages.NamedMessage]]:
applicability_status = super().applicability_status()
if applicability_status[0] == ApplicabilityStatus.INAPPLICABLE:
affordance = self.entitlement_cfg["entitlement"].get(
"affordances", {}
)
affordance_series = affordance.get("series", None)
current_series = system.get_release_info().series
if (
self.affordance_check_series
and affordance_series is not None
and current_series not in affordance_series
):
return (
ApplicabilityStatus.INAPPLICABLE,
messages.LANDSCAPE_INAPPLICABLE,
)
return applicability_status
def enabled_warning_status(
self,
) -> Tuple[bool, Optional[messages.NamedMessage]]:
# This check wrongly gives warning when non-root
# This will become obsolete soon: #2864
if util.we_are_currently_root():
try:
system.subp(
["landscape-config", "--is-registered", "--silent"]
)
except exceptions.ProcessExecutionError:
return (
True,
messages.LANDSCAPE_NOT_REGISTERED,
)
return False, None
def process_contract_deltas(
self,
orig_access: Dict[str, Any],
deltas: Dict[str, Any],
allow_enable: bool = False,
verbose: bool = True,
) -> bool:
# overriding allow_enable to always be False for this entitlement
# effectively prevents enableByDefault from ever happening
return super().process_contract_deltas(
orig_access, deltas, allow_enable=False, verbose=verbose
)
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 8.73 KB | 0644 |
|
| anbox.py | File | 3.06 KB | 0644 |
|
| base.py | File | 46.74 KB | 0644 |
|
| cc.py | File | 1013 B | 0644 |
|
| cis.py | File | 1.15 KB | 0644 |
|
| entitlement_status.py | File | 3.28 KB | 0644 |
|
| esm.py | File | 4.48 KB | 0644 |
|
| esm_legacy.py | File | 703 B | 0644 |
|
| fips.py | File | 25.99 KB | 0644 |
|
| landscape.py | File | 4.4 KB | 0644 |
|
| livepatch.py | File | 14.12 KB | 0644 |
|
| realtime.py | File | 7.11 KB | 0644 |
|
| repo.py | File | 26.64 KB | 0644 |
|
| ros.py | File | 1.97 KB | 0644 |
|