o
    wÚ7eÈ  ã                   @   s€   d dl Z d dlmZmZmZmZ d dlmZ dddddd	d
œZdee	ee
e	f f fdd„Zde
fdd„Zdee	 fdd„ZdS )é    N)ÚAnyÚDictÚOptionalÚUnion)ÚdmiÚallow_local_stageÚallow_init_stageÚ
allow_dhcpÚ
allow_ipv4Ú
allow_ipv6Úpreferred_mac_prefixes)ÚalsÚaisÚdhcpÚv4Úv6ÚpmpÚreturnc                  C   sn   t  d¡} i }| s|S t d| ¡D ]#\}}}|tv r4|dv r%tt|ƒƒ}n	|dkr.| d¡}||t| < q|S )zH
    Parses flags from dmi data and updates self.ds_cfg accordingly
    zbaseboard-serial-numberz([a-z0-9]+)=(.*?)(;|$)Ú01r   ú,)r   Úread_dmi_dataÚreÚfindallÚDMI_OVERRIDE_MAPÚboolÚintÚsplit)Ú	dmi_flagsÚretÚkeyÚvalueÚ_© r"   úB/usr/lib/python3/dist-packages/cloudinit/sources/helpers/akamai.pyÚget_dmi_config   s   

€r$   c                  C   s   t  d¡} | dv S )zo
    Reads the BIOS vendor from dmi data to determine if we are running in the
    Akamai Connected Cloud.
    zsystem-manufacturer)ÚLinodeÚAkamai©r   r   )Úvendorr"   r"   r#   Úis_on_akamai(   s   
r)   c                   C   s
   t  d¡S )zo
    Returns the instance id read from dmi data without requiring the metadata
    service to be reachable
    zsystem-serial-numberr'   r"   r"   r"   r#   Úget_local_instance_id1   s   
r*   )r   Útypingr   r   r   r   Ú	cloudinitr   r   Ústrr   r$   r)   r*   r"   r"   r"   r#   Ú<module>   s    ú
	