3 \�me� � @ sN d dl Z d dlZd dlmZmZ e je�ZG dd� dejj j �Zddd�ZdS )� N)�subp�utilc s8 e Zd Zd� fdd� Zdd� Zddd�Zd d � Z� ZS ) �RendererNc s t t| �j� d S )N)�superr �__init__)�self�config)� __class__� �/usr/lib/python3.6/netbsd.pyr s zRenderer.__init__c C s� | j � r*| jdd� | jddj| j � �� xb| jj� D ]T\}}t|t�r6|jd�d |jd� }|jd�}|rz|d | 7 }| jd | |� q6W d S )N�dhcpcdZYESZdhcpcd_flags� Zaddressz netmask �netmask�mtuz mtu %dZ ifconfig_)�dhcp_interfaces�set_rc_config_value�joinZinterface_configurations�items� isinstance�dict�get)r Zdevice_name�vZ net_configr r r r �write_config s zRenderer.write_configFc C sF |st jd� d S tjdddgdd� | j� rBtjdddgdd� d S )Nz netbsd generate postcmd disabledZservice�networkZrestartT)Zcapturer )�LOG�debugr r )r Zrunr r r �start_services s zRenderer.start_servicesc C s |dkr| j d|� d S )Nz0.0.0.0Zdefaultroute)r )r r r Zgatewayr r r � set_route&