U
    L¬÷dÈ  ã                   @   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ee	ee
e	f f dœdd„Ze
dœdd„Zee	 dœdd„ZdS )é    N)ÚAnyÚDictÚOptionalÚUnion)ÚdmiZallow_local_stageZallow_init_stageZ
allow_dhcpZ
allow_ipv4Z
allow_ipv6Zpreferred_mac_prefixes)ZalsZaisZdhcpZv4Zv6Úpmp)Úreturnc                  C   sn   t  d¡} i }| s|S t d| ¡D ]F\}}}|tkr"|dkrJt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]+)=(.*?)(;|$)Z01r   ú,)r   Úread_dmi_dataÚreÚfindallÚDMI_OVERRIDE_MAPÚboolÚintÚsplit)Z	dmi_flagsZ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kS )zo
    Reads the BIOS vendor from dmi data to determine if we are running in the
    Akamai Connected Cloud.
    zsystem-manufacturer)ZLinodeZAkamai©r   r
   )Z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   Z	cloudinitr   r   Ústrr   r   r   r   r   r   r   r   Ú<module>   s   ú
	