3 \me @ sx d dl Z d dlZd dlZd dlmZ d dlZd dlmZmZ d dl m Z d dlmZ e j eZG dd dejjjZdS ) N)StringIO)subputil)FreeBSDNetworking)PER_INSTANCEc @ s e Zd ZdZeZdZdZdZdZ dddgZ d d gZd dgZd dgZ d d gZdZdZed+ddZeddeeedddZdd Zdd Zdd Zd,ddZd d! Zd-d"d#Zd$d% Zd&d' Zeeeeeeed(d)d*ZdS ).DistrozY Distro subclass for FreeBSD. (N.B. DragonFlyBSD inherits from this class.) z/usr/local/libz/etc/login.confz/etc/login.conf.origz,/usr/local/etc/sudoers.d/90-cloud-init-userspwgroupaddZpkgZinstallremoveupdateZupgradeTz /usr/homeNc C s8 t jjd}|dkr"tjd dS tjdd|gd|dS )z Tell rc to reload its configuration Note that this only works while we're still in the process of booting. May raise ProcessExecutionError ZRC_PIDNz0Unable to reload rc(8): no RC_PID in Environmentkillz-SIGALRMT)capturercs)osenvirongetLOGZwarningr )clsr Zrc_pid r /usr/lib/python3.6/freebsd.pyreload_init( s zDistro.reload_init)r )actionservice extra_argsc G sx | j }|dg|dg|dg|dg|dg|dg|dg|dg|dg|dg|d g|d gd}||| t| }tj|d|d S )a Perform the requested action on a service. This handles FreeBSD's 'service' case. The FreeBSD 'service' is closer in features to 'systemctl' than SysV init's 'service', so we override it. May raise ProcessExecutionError stopstartenableenableddisableonestartonestoprestartstatus onestatus)r r r r r r r! r" reloadz try-reloadr# r$ T)r r )init_cmdlistr )r r r r r r&