OS : Linux
PHP Version : 7.4.33
Software : Apache/2.4.6 (CentOS) PHP/7.4.33
Information System : Linux apprendre2 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
Disable Function : oB]c @ s d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m Z d d l m Z e j e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d e j f d YZ e e j f f g Z d Z d S( sr This file contains code used to gather the user data passed to an instance on rootbox / hyperone cloud platforms iN( t log( t sources( t util( t EventTypes /etc/hostsc C s= t j t d t } | r, t j d t St j d t S( Nt quiets5 /etc/hosts exists - setting manage_etc_hosts to Falses= /etc/hosts does not exists - setting manage_etc_hosts to True( R t load_filet ETC_HOSTSt Truet LOGt debugt False( t hosts( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt get_manage_etc_hosts s c C sS | j d } t | d d >t | d d >t | d d >t | d S( Nt .i i i i i i i ( t splitt int( t addrt parts( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt ip2int" s c C sE d j g t d d d d D] } t | | d >?d @ ^ q S( NR i ii i ( t joint ranget str( R t i( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt int2ip( s c C s t j d g | S( s Uses the prefered cloud-init subprocess def of util.subp and runs arping. Breaking this to a separate function for later use in mocking and unittests t arping( R t subp( t cmd( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt _sub_arp, s c C sT d } | j d k r d } n x/ | D]' } t d d | | d | d g q% Wd S( Ns -St fedorat centost rhels -ss -ct 2t sourcet destination( R R R ( t nameR ( t itemst distrot source_paramt item( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt gratuitous_arp5 s c C s d } g t j j D]0 \ } } | j d d j d k r | ^ q } x | D] } y2 t j d | d t d d d g } | r Pn WqV t k r } | j t j k r q qV t j k r t j t d | qV XqV W| s t j t d t S| S( Nt LABELt t CLOUDMDt devicet callbackt mtypet vfatt fats- Failed to mount %s when looking for user datas$ Failed to load metadata and userdata( t NoneR t blkidR# t gett uppert mount_cbt read_user_data_callbackt OSErrort errnot ENOENTt MountFailedErrort logexcR R ( t rbx_datat devt bdatat devicesR+ t err( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt get_mdA s, * c C s i d d 6g t | D] \ } } i d d 6d j t | d 6| d j d 6g | d D]V } i d d 6| d d 6| d d d 6d d 6| d d d 6| d d d d 6^ q_ d 6^ q d 6S( s Generate network configuration @param netadps: A list of network adapter settings @returns: A dict containing network config i t versiont physicalt types eth{}R" t macaddresst mac_addresst ipt statict addresst networkt netmaskt autot controlt gatewayt dnst nameserverst dns_nameserverst subnetst config( t enumeratet formatR t lower( t netadpsR t netadpRF ( ( sH /usr/lib/python2.7/site-packages/cloudinit/sources/DataSourceRbxCloud.pyt generate_network_config] s c C sS t j d t j d t j j | d d t } t j d t j j | d d t } d | k sr d | k r t j t d d/ S| j d i j d } | j d i j d g } d/ } | j d i j d r | d d d } n t | d } i | d 6i | d d d 6| d d d 6g d 6d 6g | d D]} } | d D]l } | d d t t | d d d t t | d d d g D] } i | d d 6| d 6^ qqTqFd 6i t d 6t d 6i i | d 6| d! 6d" g d# 6| d$ 6t d% 6| d&