3 \�meX: � @ s� d Z ddlZddlZddlZddlmZ ddlmZmZ ddl m Z mZmZm Z mZ ddlmZ ddlmZmZmZmZ ddlmZmZ eje�Zd d iZdZdZed ZdZ ddiZ!edd�Z"G dd� dej#�Z$edd�dd�Z%G dd� de j&�Z'ee( d�dd�Z)e*d�dd�Z+d-e,e(e,e-d �d!d"�Z.d d#�e*e"d$�d%d&�Z/e'e j0ffgZ1d'd(� Z2ed)k�r�ddl3Z3d*Z4e3j5e4d+�Z6e6j7� e8e j9e/� e+� d,��� dS ).a3 Datasource for Oracle (OCI/Oracle Cloud Infrastructure) Notes: * This datasource does not support OCI Classic. OCI Classic provides an EC2 lookalike metadata service. * The UUID provided in DMI data is not the same as the meta-data provided instance-id, but has an equivalent lifespan. * We do need to support upgrade from an instance that cloud-init identified as OpenStack. * Bare metal instances use iSCSI root, virtual machine instances do not. * Both bare metal and virtual machine instances provide a chassis-asset-tag of OracleCloud.com. � N)� namedtuple)�Optional�Tuple)� atomic_helper�dmi�net�sources�util)� NetworkConfig)�cmdline� ephemeral�get_interfaces_by_mac�is_netfail_master)�UrlError�readurl�configure_secondary_nicsFzOracleCloud.comz&http://169.254.169.254/opc/v{version}/z{path}/i(# Z Authorizationz Bearer Oracle�OpcMetadataz version instance_data vnics_datac @ s e Zd ZdZed�dd�ZdS )�KlibcOracleNetworkConfigSourcez�Override super class to lower the applicability conditions. If any `/run/net-*.cfg` files exist, then it is applicable. Even if `/run/initramfs/open-iscsi.interface` does not exist. )�returnc C s t | j�S )zOverride is_applicable)�bool�_files)�self� r �&/usr/lib/python3.6/DataSourceOracle.py� is_applicable8 s z,KlibcOracleNetworkConfigSource.is_applicableN)�__name__� __module__�__qualname__�__doc__r r r r r r r 1 s r )�network_configr c C s d| krdS | d dkr,t jd| d � dS t� }| d dkr�x�dd� | d D �D ]@}|d d krRd|krR|d }|j|�}|s�qRqRt|�rR|d= qRW n�| d dk�rxp| jdi �j� D ]\\}}d |kr�|jd i �jd�}|r�|j|�}|s�q�q�t|�r�|d d= |d= ||d d<