oB]c@sddlmZddlmZddlmZddlmZddlmZddlm Z ddl m Z ej eZdejfd YZd S( i(tdistros(t HostnameConf(thelpers(tlog(tutil(t rhel_util(t PER_INSTANCEtDistrocBs eZdZdZdgZdZdZdZdZdZ dZ d Z d Z iid d 6d d6dd6idd6dd6d6d6Z dZd#dZdZd#d#dZdZdZdZd#dZdZdZd Zd!Zed"ZRS($s/etc/sysconfig/clocks /etc/HOSTNAMEtservices/etc/sysconfig/languages/etc/sysconfig/network/configs/etc/sysconfig/network/ifcfg-%ss/etc/resolv.confs!/etc/sysconfig/network/ifroute-%ss /etc/hostnames/etc/locale.confs/etc/localtimesetc/sysconfig/network/configtcontrols%(base)s/network/ifcfg-%(name)stiface_templatess3etc/udev/rules.d/85-persistent-net-cloud-init.rulest netrules_paths!%(base)s/network/ifroute-%(name)stipv4tipv6troute_templatest sysconfigcCsgtjj||||tj||_d|_d|d<|jrcdg|_d|d/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyR2s    cCsa|jr.|s|j}ni|d6}n|s@|j}ni|d6}tj||dS(NtLANGtRC_LANG(Rtsystemd_locale_conf_fntlocale_conf_fntrhutiltupdate_sysconfig_file(Rtlocaletout_fnt locale_cfg((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt apply_locale;s    cCs|jdddd|dS(Ntinstalltargss--auto-agree-with-licensestpkgs(tpackage_command(Rtpkglist((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pytinstall_packagesFscCs|dkrg}nddg}|dkr6d}n|j||rht|trh|j|n%|rt|tr|j|ntjd|}|j|tj|dt dS(Ntzyppers--non-interactivetupgradetupdates%s-%stcapture( tNonetappendt isinstancetstrtlisttextendRtexpand_package_listtsubptFalse(RtcommandR)R*tcmdR,((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyR+Ms       cCs~|j|}|jrAtj|jtj||jn9it|d6}tj|j |tj ||jdS(NtTIMEZONE( t _find_tz_fileRRtdel_filet tz_local_fntsym_linkR5R"R#t clock_conf_fntcopy(Rttzttz_filet clock_cfg((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt set_timezonees cCs&|jjd|jdgdtdS(Nsupdate-sourcestrefreshtfreq(RtrunR+R(R((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pytupdate_package_sourcesuscCs;|r(d|kr(td|jntjj||S(Ntalls1Distro %s can not translate the device name "all"(t RuntimeErrorRRRt_bring_up_interfaces(Rt device_names((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyRNyscCs|jr.|jdr.tj|jS|jritjdg\}}t|rb|S|Sn>y|j|}|j}Wnt k rnX|s|S|SdS(Ns/previous-hostnamethostname( RtendswithRt load_filetstripR9tlent_read_hostname_confRPtIOError(Rtfilenametdefaulttoutt_errtconfRP((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt_read_hostnames    cCs#ttj|}|j|S(N(RRRRtparse(RRWR[((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyRUs cCs4|jr|j}n |j}||j|fS(N(Rtsystemd_hostname_conf_fnthostname_conf_fnR\(Rthost_fn((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt_read_system_hostnames   cCs|jr.|jdr.tj||n|jrYtjddt|gnhd}y|j|}Wntk rnX|st d}n|j |tj|t|ddS(Ns/previous-hostnamet hostnamectls set-hostnameti( RRQRt write_fileR9R5R2RURVRt set_hostname(RRPR%R[((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt_write_hostnames   cCs |j|S(N(t_supported_write_network_config(Rt netconfig((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt_write_network_configscCs|jstjd}|d}t|djdd}|dkrXd|ks||dkrd|kr|dkrdd d g|_qd d dg|_n|jS( s5The preferred ntp client is dependent on the version.tdistiit.itopenSUSEi*tchronyssystemd-timesyncdtntp(t_preferred_ntp_clientsRt system_infotinttsplit(Rt distro_infoRt major_ver((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pytpreferred_ntp_clientss  $N(t__name__t __module__RBR_RR!tnetwork_conf_fntnetwork_script_tpltresolve_conf_fntroute_conf_tplR^R R@trenderer_configsRR2R'R-R+RGRKRNR\RURaRfRitpropertyRu(((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyRs@          N(t cloudinitRt"cloudinit.distros.parsers.hostnameRRRtloggingRtcloudinit.distrosRR"tcloudinit.settingsRt getLoggerRvtLOGR(((s>/usr/lib/python2.7/site-packages/cloudinit/distros/opensuse.pyt s