
    x[h                         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Zde
fdZdee	   fdZy)    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                     t        j                  d      } i }| s|S t        j                  d|       D ]J  \  }}}|t        v s|dv rt        t        |            }n|dk(  r|j                  d      }||t        |   <   L |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_s        B/usr/lib/python3/dist-packages/cloudinit/sources/helpers/akamai.pyget_dmi_configr%      s     !!";<IC
 $=yI /UA""}SZ(C().C %&/ J    c                  4    t        j                  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   )vendors    r$   is_on_akamair,   (   s!    
 45F)))r&   c                  ,    t        j                  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$   get_local_instance_idr/   1   s    
 344r&   )r   typingr   r   r   r   	cloudinitr   r   strr   r%   r,   r/   r.   r&   r$   <module>r3      sh    	 - -  

# S%c	"223 .*d *5x} 5r&   