+
    i"                         ^ RI t ^ RIt^ RIt^ RIHt ^ RIt^ RIHtHt ^ RI	H
t
 ^ RIHtHt ] P                  ! ]4      t ! R R]P"                  P$                  P&                  4      tR# )    N)StringIO)subputil)FreeBSDNetworking)
PER_ALWAYSPER_INSTANCEc                   :  a  ] tR t^t o Rt]tRtRtRt	Rt
. R%OtRR.tRR.tRR	.tRR
.tRtRtRtRt. R&Ot]R'R l4       t]RR/V 3R lR ll4       tR tV 3R lR ltR tR(R ltR tR tR'R ltR tRR/R lt ]!V 3R  lR! l4       t"]!V 3R" lR# l4       t#R$t$V t%R# ))DistrozM
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-userspkginstallremoveupdateupgradeTz/homez/var/dbzdhclient.leases.\w+Nc                    \         P                  P                  R4      pVf   \        P	                  R4       R# \
        P
                  ! RRV.RVR7      # )z
Tell rc to reload its configuration
Note that this only works while we're still in the process of booting.
May raise ProcessExecutionError
RC_PIDNz0Unable to reload rc(8): no RC_PID in Environmentkillz-SIGALRMTcapturercs)osenvirongetLOGwarningr   )clsr   rc_pids   && ;/usr/lib/python3/dist-packages/cloudinit/distros/freebsd.pyreload_initDistro.reload_init7   sE     )>KKJKyy&*f5tMM    r   c                ,   < V ^8  d   QhRS[ RS[ RS[ /# )   actionservice
extra_argsstr)format__classdict__s   "r   __annotate__Distro.__annotate__F   s%     5 55#&5585r    c                   V P                   pRVR.RVR.RVR.RVR.RVR.RVR.RVR.RVR.R	VR.R
VR.RVR.RVR./pWVV,          ,           \        V4      ,           p\        P                  ! VRVR7      # )z
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
stopstartenableenableddisableonestartonestoprestartreloadz
try-reloadstatus	onestatusTr   )init_cmdlistr   )r   r#   r$   r   r%   r8   cmdscmds   &&&$*   r   manage_serviceDistro.manage_serviceE   s     <<Wf%gw'w)++*-++w	*7I.w)';/
 f%Z(88yyd44r    c                    R RRVRV.# )pwusermod-n-G )selfmember_name
group_names   &&&r   _get_add_member_to_group_cmd#Distro._get_add_member_to_group_cmda   s    i{D*EEr    c                    < V ^8  d   QhRS[ /# )r"   return)bool)r(   r)   s   "r   r*   r+   d   s     < <$ <r    c                R   \         P                  ! V4      '       d   \        P                  RV4       R# RRRV.pRRRV.pRRRR	R
RRRRRRRRR/pRRRRRR/pVP	                  4        F  w  rxWu9   dI   V'       dA   \        V\        \        34      '       d%   VP                  WW,          \        V4      .4       KS  Wv9   g   K[  V'       g   Ke  VP                  Wg,          4       VP                  Wg,          4       K  	  RV9   g   RV9   d$   VP                  R4       VP                  R4       MsVP                  RV P                   RV 24      p	VP                  RV	,           4       VP                  R4       VP                  RV	,           4       VP                  R4       \        P                  RV4        \        P                  ! W4R7       TP                  R!R"4      p
T
e   T P                  YR#R$7       R##   \         d    \         P                  ! \        R T4       h i ; i)%zf
Add a user to the system using standard tools

Returns False if user already exists, otherwise True.
z!User %s already exists, skipping.Fr?   useraddrA   homedirz-dgecos-cprimary_groupz-ggroupsrB   shellz-sinactivez-Euidz-uno_user_groupz--no-user-groupsystemz--systemno_log_initz--no-log-initno_create_homez-d/nonexistent/z-mzAdding user %s)	logstringzFailed to create user %spasswdNT)hashed)r   is_userr   infoitems
isinstancer'   intextendappendr   home_dirr   	Exceptionlogexc
set_passwd)rD   namekwargspw_useradd_cmdlog_pw_useradd_cmdpw_useradd_optspw_useradd_flagskeyvalrN   
passwd_vals   &&,        r   add_userDistro.add_userd   s    <<HH8$?	46"ItT: tTTdT4
 .j?
 HC%#*S3*2M2M%%';SX&FG(SS%%&6&;<"))*:*?@ ' v%V);!!"23%%&67jjt}}oQtf,EFG!!$.1!!$'%%dWn5%%d+ 	!4(	IInC ZZ$/
!OODTO:   	KK7>	s   ;G= =)H&c                     \         P                   ! R RVRR.4       R#   \         d    \        P                  ! \        RT4       h i ; i)r?   r@   -pz01-Jan-1970z"Failed to set pw expiration for %sNr   rf   r   rg   r   )rD   users   &&r   expire_passwdDistro.expire_passwd   sA    	IItYdMBC 	KKA4H		    )AFc                    V'       d   R pMRp \         P                   ! RRWR.VRV,          R7       R#   \         d    \        P                  ! \        RT4       h i ; i)	z-Hz-hr?   r@   0zchpasswd for %s)datar[   zFailed to set password for %sNrv   )rD   rw   r\   r]   hash_opts   &&&& r   rh   Distro.set_passwd   s\    HH	IIy$#6+d2
  	KK<dC	s	   $5 )Ac                     \         P                   ! R RVRR.4       R#   \         d    \        P                  ! \        RT4       h i ; i)r?   r@   z-wnoz)Failed to lock password login for user %sNrv   rD   ri   s   &&r   lock_passwdDistro.lock_passwd   sA    	IItYdD9: 	KKH$O	rz   c                2    \         P                  R V4       R# )zRDragonfly BSD/FreeBSD password lock is not reversible, ignoring unlock for user %sN)r   debugr   s   &&r   unlock_passwdDistro.unlock_passwd   s    		*	
r    c                b   \        4       p\        P                  ! V P                  4      P	                  4        FB  pVP                  \        P                  ! R RV,          V4      4       VP                  R4       KD  	  \        P                  ! V P                  V P                  4       \        P                  ! V P                  VP                  4       4        \        P                  RV4       \        P                  ! RV P                  .4       R#   \        P                   d    \        P                   ! \        RT4        \        P                  ! T P                  T P                  4        R#   \"         d,    \        P                   ! \        RT P                  4         R# i ; ii ; i)z	^default:zdefault:lang=%s:
zRunning cap_mkdb for %scap_mkdbzFailed to apply locale %szFailed to restore %s backupN)r   r   load_text_filelogin_conf_fn
splitlineswriteresubcopylogin_conf_fn_bak
write_filegetvaluer   r   r   ProcessExecutionErrorrg   IOError)rD   localeout_fnnewconflines   &&&  r   apply_localeDistro.apply_locale   s7   *''(:(:;FFHDMM|%86%A4H MM$	 I 			$$$d&<&<= 	**G,<,<,>?	II/8IIz4#5#567)) 	KK8&A		$00$2D2DE 68J8J 	s*   8D 1F.+E441F*%F.)F**F.c                
    RR/# )zBReturn environment vars used in FreeBSD package_command
operationsASSUME_ALWAYS_YESYESrC   )rD   s   &r   _get_pkg_cmd_environDistro._get_pkg_cmd_environ   s     $U++r    forcec               ~    V P                   P                  R V P                  R.V'       d   \        M\        R7       R# )zupdate-sourcesr   )freqN)_runnerrunpackage_commandr   r   )rD   r   s   &$r   update_package_sourcesDistro.update_package_sources   s1      J$,	 	 	
r    c                >   < V ^8  d   QhRS[ RS[ RS[ RS[ RS[ RS[/# )r"   path
lease_filepid_file	interfaceconfig_filerJ   )r'   r9   )r(   r)   s   "r   r*   r+      sE     	
 	
	
	
 	
 		

 	
 
	
r    c                D    V R VRV.V'       d   RWC.,           # V.,           # )z-lru   rP   rC   )r   r   r   r   r   s   &&&&&r   build_dhclient_cmdDistro.build_dhclient_cmd   s5     dJh7.9T;*
 	
@I{
 	
r    c                $   < V ^8  d   QhRS[ RR/# )r"   devicerJ   Nr&   )r(   r)   s   "r   r*   r+      s     3 3C 3D 3r    c                8    \         P                   ! R RV .4       R# )
camcontrolejectN)r   )r   s   &r   eject_mediaDistro.eject_media   s    		<&12r    rC   )r?   groupadd)z^{username}::z^{username}:\*:z^{username}:\*LOCKED\*:)N)F)&__name__
__module____qualname____firstlineno____doc__r   networking_clsusr_lib_execr   r   ci_sudoers_fngroup_add_cmd_prefixpkg_cmd_install_prefixpkg_cmd_remove_prefixpkg_cmd_update_prefixpkg_cmd_upgrade_prefixprefer_fqdnre   dhclient_lease_directorydhclient_lease_file_regex#shadow_empty_locked_passwd_patternsclassmethodr   r<   rG   rr   rx   rh   r   r   r   r   r   staticmethodr   r   __static_attributes____classdictcell__)r)   s   @r   r
   r
      s     'N#L%M.BM1#Y/"H-"H-#Y/KH  ) 6+' N N 5>B5 5 56F< <| 
8,

e 
 	
 	
 3 3r    r
   )loggingr   r   ior   cloudinit.distros.bsd	cloudinitr   r   cloudinit.distros.networkingr   cloudinit.settingsr   r   	getLoggerr   r   distrosbsdBSDr
   rC   r    r   <module>r      sO     	 	     : 7!j3Y""&& j3r    