D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
lib
/
python3.6
/
site-packages
/
cloudinit
/
sources
/
helpers
/
Filename :
akamai.py
back
Copy
import re from typing import Any, Dict, Optional, Union from cloudinit import dmi # dmi data can override DMI_OVERRIDE_MAP = { "als": "allow_local_stage", "ais": "allow_init_stage", "dhcp": "allow_dhcp", "v4": "allow_ipv4", "v6": "allow_ipv6", "pmp": "preferred_mac_prefixes", } def get_dmi_config() -> Dict[str, Union[bool, str]]: """ Parses flags from dmi data and updates self.ds_cfg accordingly """ dmi_flags = dmi.read_dmi_data("baseboard-serial-number") ret: Dict[str, Any] = {} if not dmi_flags: return ret # parse the value into individual flags, then set them in our config # based on the short name lookup table for key, value, _ in re.findall(r"([a-z0-9]+)=(.*?)(;|$)", dmi_flags): if key in DMI_OVERRIDE_MAP: if value in "01": value = bool(int(value)) elif key == "pmp": value = value.split(",") ret[DMI_OVERRIDE_MAP[key]] = value return ret def is_on_akamai() -> bool: """ Reads the BIOS vendor from dmi data to determine if we are running in the Akamai Connected Cloud. """ vendor = dmi.read_dmi_data("system-manufacturer") return vendor in ("Linode", "Akamai") def get_local_instance_id() -> Optional[str]: """ Returns the instance id read from dmi data without requiring the metadata service to be reachable """ return dmi.read_dmi_data("system-serial-number")
Name
Size
Last Modified
Owner
Permissions
Actions
__pycache__
Dir
April 24 2025 3:40:45
root
0755
vmware
Dir
April 24 2025 3:40:45
root
0755
__init__.py
0
KB
December 04 2023 11:47:40
root
0644
akamai.py
1.445
KB
December 04 2023 11:47:40
root
0644
azure.py
42.89
KB
December 04 2023 11:47:40
root
0644
cloudsigma.py
2.747
KB
December 04 2023 11:47:40
root
0644
digitalocean.py
7.067
KB
December 04 2023 11:47:40
root
0644
ec2.py
8.585
KB
December 04 2023 11:47:40
root
0644
hetzner.py
0.82
KB
December 04 2023 11:47:40
root
0644
netlink.py
11.717
KB
December 04 2023 11:47:40
root
0644
openstack.py
25.614
KB
December 04 2023 11:47:40
root
0644
upcloud.py
6.479
KB
December 04 2023 11:47:40
root
0644
vultr.py
7.152
KB
December 04 2023 11:47:40
root
0644
2017 © D7net | D704T team