File: //lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyo
�
d�bc @ s� d d l Z d d l Z d d l j j Z d d l j j j Z d d l j j j Z d d l
m Z d d l m
Z
d e f d � � YZ d S( i����N( t
DefaultOSUtil( t NetworkInterfaceCardt
OpenWRTOSUtilc B s� e Z d � Z e d � Z d d d � Z d � Z e d � Z d � Z
d � Z d � Z d � Z
d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d d � Z RS( c C sD t t | � j � d | _ d | _ t j d � | _ t | _ d S( Ns /etc/waagent.conft udhcpcs ^\d+:\s+(\w+):\s+(.*)$(
t superR t __init__t agent_conf_file_patht
dhclient_namet ret compilet ip_command_outputt Truet jit_enabled( t self( ( sI /usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyR s
c C s t j d � d S( Ns! eject is not supported on OpenWRT( t loggert warn( R
t chk_err( ( sI /usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt eject_dvd% s c C s� | j | � } | d k r/ t j d | � d S| d k rY d d | d d d | g } n d d | d d g } t j j d � s� t j d � n | d k r� | j d | g � n | j | d
d j
| � �d S( s5
Create user account with 'username'
s% User {0} already exists, skip useraddNt useradds -ms -ss /bin/ashs -es /homes -ct err_msgs! Failed to create user account:{0}( t
get_userentryt NoneR t infot ost patht existst mkdirt extendt _run_command_raising_OSUtilErrort format( R
t usernamet
expirationt commentt userentryt cmd( ( sI /usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyR ( s c C s | j d | j g � S( Nt pidof( t
_get_dhcp_pidR ( R
( ( sI /usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt get_dhcp_pid= s c C s� | r
d Si } t j d d t d t �\ } } | d k rZ t j d j | | � � i SxZ | j � D]L } | j j | � } | rg | j d � } t
| | j d � � | | <qg qg W| j | d t
j d
� | j | d t
j
d � | S(
s�
Capture NIC state (IPv4 and IPv6 addresses plus link state).
:return: Dictionary of NIC state objects, with the NIC name as key
:rtype: dict(str,NetworkInformationCard)
t s
ip -o linkR t log_cmdi s. Could not fetch NIC link info; status {0}, {1}i i s ip -o -f inet addresss an IPv4 addresss ip -o -f inet6 addresss an IPv6 address( t shellutilt run_get_outputt FalseR t verboseR t
splitlinesR
t matcht groupR t _update_nic_statet add_ipv4t add_ipv6( R
t as_stringt statet statust outputt entryt resultt name( ( sI /usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/openwrt.pyt
get_nic_state@ s !#c
C s� t j | d t �\ } } | d k r+ d Sx� | j � D]r } | j j | � } | r8 | j d � } | | k r� | | | | j d � � q� t j d j | | � � q8 q8 Wd S( s�
Update the state of NICs based on the output of a specified ip subcommand.
:param dict(str, NetworkInterfaceCard) state: Dictionary of NIC state objects
:param str ip_command: The ip command to run
:param handler: A method on the NetworkInterfaceCard class
:param str description: Description of the particular information being added to the state
R i Ni i s'