%PDF- %PDF-
Direktori : /snap/core22/2082/lib/python3/dist-packages/cloudinit/net/__pycache__/ |
Current File : //snap/core22/2082/lib/python3/dist-packages/cloudinit/net/__pycache__/renderer.cpython-310.pyc |
o Nhj � @ sZ d dl Z d dlZd dlmZ d dlmZ d dlmZ dd� Zdd� Z G d d � d e j �ZdS )� N)�Optional)�NetworkState)�generate_udev_rulec � � fdd�S )Nc s � | d kS )N�type� ��iface�� match_typer �8/usr/lib/python3/dist-packages/cloudinit/net/renderer.py�<lambda> s z filter_by_type.<locals>.<lambda>r r r r r �filter_by_type � r c r )Nc s � | v o| � S �Nr r �� match_namer r r s z filter_by_attr.<locals>.<lambda>r r r r r �filter_by_attr r r c @ sN e Zd Zddd�Zedefdd��Zej ddede e ddfd d ��ZdS ) �RendererNc C s d S r r )�self�configr r r �__init__ s zRenderer.__init__� network_statec C s^ t �� }| �td��D ]}d|v r*|�d�r*|�dd�}|�t|d |d |d�� q|�� S )z2Given state, emit udev rules to map mac to ifname.�physical�name�mac_address�driverN)r )�io�StringIO�iter_interfacesr �get�writer �getvalue)r �contentr r r r r �_render_persistent_net s ���zRenderer._render_persistent_net� templates�returnc C s dS )zRender network state.Nr )r r r% �targetr r r �render_network_state- s zRenderer.render_network_stater )NN)�__name__� __module__�__qualname__r �staticmethodr r$ �abc�abstractmethodr �dictr( r r r r r s ����r )r- r �typingr �cloudinit.net.network_stater �cloudinit.net.udevr r r �ABCr r r r r �<module> s