v~e2fd?YZ3d@Z4dAefdBYZ5dCefdDYZ6dEefdFYZ7dGefdHYZ8dIe2fdJYZ9dS(KsThe pkg.config module provides a set of classes for managing both 'flat' (single-level) and 'structured' (n-level deep) configuration data that may be stored in memory, on disk, or using an smf(5) service instance. The basic structure of the classes found here is roughly as follows: Configuration Class (e.g. Config) Provides storage and retrieval of property sections and properties via its child property sections. Section Class (e.g. PropertySection) Provides storage and retrieval of property data via its child properties. Property Class Provides storage and retrieval of property data. Generally, consumers should only need to consume the interfaces provided by the Config class or its subclasses. However, any public method or property of the property sections or property objects can be used as well if advanced access or manipulation of configuration data is needed. iN(tmisctportablet ConfigErrorcBseZdZRS(s)Base exception class for property errors.(t__name__t __module__t__doc__(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRCstPropertyConfigErrorcBseZdZdddZRS(s)Base exception class for property errors.cCsDtjj||dk s.|dk s.t||_||_dS(N(t api_errorst ApiExceptiont__init__tNonetAssertionErrortsectiontprop(tselfR R ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR Js N(RRRR R (((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRGstInvalidPropertyNameErrorcBs eZdZdZdZRS(s:Exception class used to indicate an invalid property name.cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR TscCstd|jS(NsProperty name '%s' is not valid. Section names may not contain: tabs, newlines, carriage returns, form feeds, vertical tabs, slashes, backslashes, or non-ASCII characters.(t_R (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__str__Xs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRQs t InvalidPropertyTemplateNameErrorcBs eZdZdZdZRS(sLException class used to indicate an invalid property template name. cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR cscCstd|jS(Ns)Property template name '%s' is not valid.(RR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRgs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR_s tInvalidPropertyValueErrorcBs/eZdZddddddZdZRS(s;Exception class used to indicate an invalid property value.cCsWtj|d|d||dk o.|dk s8t||_||_||_dS(NR R (RR R R tmaximumtminimumtvalue(RRRR R R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR os   cCsk|jdk r td|jS|jdk r@td|jS|jrZtd|jStd|jS(Nsq'%(value)s' is less than the minimum of '%(minimum)s' permitted for property '%(prop)s' in section '%(section)s'.st'%(value)s' is greater than the maximum of '%(maximum)s' permitted for property '%(prop)s' in section '%(section)s'.sKInvalid value '%(value)s' for property '%(prop)s' in section '%(section)s'.s'Invalid value '%(value)s' for %(prop)s.(RR Rt__dict__RR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRws     N(RRRR R R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRls  tPropertyMultiValueErrorcBseZdZdZRS(s`Exception class used to indicate the property in question doesn't allow multiple values.cCs+|jrtd|jStd|jS(NsKProperty '%(prop)s' in section '%(section)s' doesn't allow multiple values.s*Property %s doesn't allow multiple values.(R RRR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs    (RRRR(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRstUnknownPropertyValueErrorcBs)eZdZddddZdZRS(svException class used to indicate that the value specified could not be found in the property's list of values.cCs&tj|d|d|||_dS(NR R (RR R(RR R R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR scCs+|jrtd|jStd|jS(NscValue '%(value)s' not found in the list of values for property '%(prop)s' in section '%(section)s'.s@Value '%(value)s' not found in the list of values for %(prop)s .(R RR(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs    N(RRRR R R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRstInvalidSectionNameErrorcBs eZdZdZdZRS(s9Exception class used to indicate an invalid section name.cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR scCstd|jS(NsSection name '%s' is not valid. Section names may not contain: tabs, newlines, carriage returns, form feeds, vertical tabs, slashes, backslashes, or non-ASCII characters.(RR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs tInvalidSectionTemplateNameErrorcBs eZdZdZdZRS(sBException class used to indicate an invalid section template name.cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR scCstd|jS(Ns(Section template name '%s' is not valid.(RR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs tUnknownPropertyErrorcBseZdZdZRS(s5Exception class used to indicate an invalid property.cCs+|jrtd|jStd|jS(Ns5Unknown property '%(prop)s' in section '%(section)s'.sUnknown property %s(R RRR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs  (RRRR(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRstUnknownSectionErrorcBseZdZdZRS(s4Exception class used to indicate an invalid section.cCstd|jS(NsUnknown property section: %s.(RR (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs(RRRR(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRstPropertycBseZdZejdZdZej Z dej dZ dZ dZ dZdZdZd Zd Zd Zed Zed ZejdZRS(sBase class for properties.s\A[^\t\n\r\f\v\\/]+\ZtcCst|t s#|jj| r5td|ny|jdWn tk rhtd|nX||_||_||_ dS(NR tascii( t isinstancet basestringt_Property__name_retmatchRtencodet ValueErrort_Property__nameRt _value_map(Rtnametdefaultt value_map((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s   cCs&t|tsdSt|j|jS(Ni(R!RtcmpR)(Rtother((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__cmp__scCs9t|tstS|j|jkr)tS|j|jkS(N(R!RtFalseR)R(RR-((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__eq__s cCs9t|tstS|j|jkr)tS|j|jkS(N(R!RtTrueR)R(RR-((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__ne__s cCs"|j|jd|jd|jS(NR*R+(t __class__R)RR((R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__copy__scCs,t|jtr|jSt|jdS(Nsutf-8(R!RtunicodeR(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt __unicode__scCs/t|jtr"|jjdSt|jS(Nsutf-8(R!RR5R%tstr(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs.t|ts*td|jd|ndS(sqRaises an InvalidPropertyValueError if 'value' is not allowed for this property. R RN(R!R"RR)(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt _is_allowed scCsdt|tr`y|jd}Wq`tk r\y|jd}Wq]tk rXq]Xq`Xn|S(NR sutf-8(R!R7R%R&tdecode(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt_transform_strings   cCs|jS(sThe name of the property.(R'(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR)%scCs|jS(sThe value of the property.(t_value(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR*scCst|tr'|jj||}n|dkr<d}n3t|ttfr`t|}n|j|}|j |||_ dS(sSets the property's value.RN( R!R"R(tgetR tbooltintR7R:R8R;(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR/s   N(RRRtretcompileR#R R;Rt EmptyDictR(R R.R0R2R4R6RR8R:tpropertyR)Rtsetter(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs         tPropertyTemplatecBsMeZdZddeddZdZdZdZe dZ RS(s!A class representing a template for a property. These templates are used when loading existing configuration data or when adding new properties to an existing configuration object if the property name found matches the pattern name given for the template. cCs|s tt|t s#| r5td|n||_ytj||_Wn tk rvtd|nX||_ ||_ ||_ ||_ dS(NR ( R R!R"Rt_PropertyTemplate__nameR?R@t_PropertyTemplate__patternt Exceptiont_PropertyTemplate__allowedt_PropertyTemplate__defaultt_PropertyTemplate__prop_typet_PropertyTemplate__value_map(Rt name_patterntallowedR*t prop_typeR+((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR Es        c Cs4|j|jd|jd|jd|jd|jS(NRMR*RNR+(R3RERHRIRJRK(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR4ZscCs|j|sti}|jdk r:|j|ds   tPropBoolcBs5eZdZeejdZejj dZRS(s3Class representing properties with a boolean value.cCs tj||d|d|dS(NR*R+(RR (RR)R*R+((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR }scCst|tr'|jj||}n|dks?|dkrLt|_dSt|tr|jdkrzt|_dS|jdkrt|_dSnt|t r||_dSt d|j d|dS(NRttruetfalseR R( R!R"R(R<R R/R;tlowerR1R=RR)(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs     ( RRRR/RRAR RRRC(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRQzstPropIntcBsbeZdZdddejdZdZedZ edZ e j j dZ RS(s4Class representing a property with an integer value.icCsz|dks$t|tks$t|dksHt|tksHt||_||_tj||d|d|dS(NR*R+(R ttypeR>R t_PropInt__maximumt_PropInt__minimumRR (RR)R*RRR+((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s $$  cCs+tj|}|j|_|j|_|S(N(RR4RWRX(RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR4s  cCs|jS(s2Minimum value permitted for this property or None.(RX(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs|jS(s2Maximum value permitted for this property or None.(RW(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCst|tr'|jj||}n|dks?|dkrHd}nyt|}Wn)tk rtd|jd|nX|j dk r||j krtd|jd|j d|n|j dk r||j krtd|jd|j d|n||_ dS(NRiR RRR( R!R"R(R<R R>RGRR)RRR;(RRtnvalue((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs    N(RRRR RRAR R4RBRRRRRC(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRUs t PropPublishercBs#eZdZejjdZRS(sBClass representing properties with a publisher prefix/alias value.cCst|tr'|jj||}n|dks?|dkrLd|_dSt|t sltj| rtd|j d|n||_dS(NRR R( R!R"R(R<R R;Rtvalid_pub_prefixRR)(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs  (RRRRRRC(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRZst PropDefinedcBsGeZdZejdejdZdZdZe dZ RS(saClass representing properties with that can only have one of a set of pre-defined values.RcCs)||_tj||d|d|dS(NR*R+(t_PropDefined__allowedRR (RR)RMR*R+((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s cCs(tj|}tj|j|_|S(N(RR4tcopyR](RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR4scCstj||t|jdkr)dSx|jD]}||krIPn|dkrz|jdrzt|dkrzPn|dkr|jdrt|dkrPn|d krtjj|rPn|d kr3t|d kr3Pq3q3Wtd |j d |dS(sqRaises an InvalidPropertyValueError if 'value' is not allowed for this property. iNssexec:is ssvc:is s iR R( RR8tlenR]t startswithtostpathtisabsRR)(RRta((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR8s&  cCs|jS(s+A list of allowed values for this property.(R](R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRM s( RRRRtEmptyIRAR R4R8RBRM(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR\s    #tPropListcBs,eZdZdZejjdZRS(svClass representing properties with a list of string values that may contain arbitrary character data. cCsIytj|}Wn/ttfk rDtd|jd|nX|S(saParse the provided python string literal and return the resulting data structure.R R(tastt literal_evalt SyntaxErrorR&RR)(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt _parse_strs  cCst|tr'|jj||}n|dks?|dkrHg}nt|tr|j|}t|tstd|jd|qn:yt |Wn)t k rtd|jd|nXg}x|D]}|dkrd}nNt|t t frt |}n*t|tsCtd|jd|n|j||j|qW|jrd|jkrt| rtd|jd|n||_dS(NRR R(R!R"R(R<R RjtlistRR)titert TypeErrorR=R>R7R8tappendRMR_R;(RRRYtv((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR"s:        % (RRRRjR\RRC(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRfs tPropDictionaryListcBs,eZdZejjdZdZRS(sClass representing properties with a value specified as a list of dictionaries. Each dictionary must contain string key/value pairs, or a string key, with None as a value. cCst|tr'|jj||}n|dks?|dkrHg}nt|tr|j|}t|tstd|jd|qn:yt |Wn)t k rtd|jd|nX|j |g}x|D]z}|dkri}n*t|t s,td|jd|nx%|D]}||s3d||eZdZdejdZdZejj dZRS(sTClass representing a property with a non-negative integer dotsequence value.t0cCs tj||d|d|dS(NR*R+(RR (RR)R*R+((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR CscCs |jjS(N(Rtget_short_version(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRGscCst|tr'|jj||}n|dks?|dkrHd}nt|tjjrf|}nEytjj|d}Wn)tk rt d|j d|nX||_ dS(NRRs5.11R R( R!R"R(R<R tpkgtversiontVersionRGRR)R;(RRRY((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRJs    ( RRRRRAR RRRRC(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR?s tPropertySectioncBseZdZejdZejdZdZ dZ dZ dZ dZ dZd Zd Zd Zed ZRS( sA class representing a section of the configuration that also provides an interface for adding and managing properties and sections for the section.s\A[^\t\n\r\f\v\\/]+\ZcCst|t s/|jj| s/|dkr>t|ny|jdWntk rnt|nX||_td|D|_ dS(Nt CONFIGURATIONR css|]}|j|fVqdS(N(R)(t.0tp((s0/usr/lib/python2.7/vendor-packages/pkg/config.pys us( R!R"t_PropertySection__name_reR$RR%R&t_PropertySection__nameRqt_PropertySection__properties(RR)t properties((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR hs   cCs&t|tsdSt|j|jS(Ni(R!RR,R)(RR-((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR.wscCsC|j|j}x*|jD]}|jtj|qW|S(N(R3Rtget_propertiest add_propertyR^(RtpropsecR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR4|scCs t|jS(N(R5R)(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR6scCs|jS(N(R)(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs,|j|jkst||j|j<|S(shAdds the specified property object to the section. The property must not already exist.(R)RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCstd|jjDS(sQReturns a dictionary of property values indexed by property name.css$|]\}}||jfVqdS(N(R(RtpnameR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pys s(RqRt iteritems(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt get_indexscCs?y|j|SWn)tk r:td|jd|nXdS(s{Returns the property object with the specified name. If not found, an UnknownPropertyError will be raised.R R N(RtKeyErrorRR(RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt get_propertys  cCs |jjS(sNReturns a generator that yields the list of property objects. (Rt itervalues(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs>y|j|=Wn)tk r9td|jd|nXdS(s6Removes any matching property object from the section.R R N(RRRR(RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytremove_propertys  cCs|jS(sThe name of the section.(R(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR)s(RRRR?R@RRReR R.R4R6RRRRRRRBR)(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR]s        tPropertySectionTemplatecBsGeZdZejdZdZdZdZe dZ RS(s1A class representing a template for a section of the configuration. These templates are used when loading existing configuration data or when adding new sections to an existing configuration object if the section name found matches the pattern name given for the template. cCsxt|t s| r)td|n||_ytj||_Wn tk rjtd|nX||_dS(NR ( R!R"Rt_PropertySectionTemplate__nameR?R@t!_PropertySectionTemplate__patternRGt$_PropertySectionTemplate__properties(RRLR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s    cCs"|j|jdtj|jS(NR(R3RR^R(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR4scCsD|j|stt|dg|jD]}tj|^q(S(sqReturns a new PropertySection object based on the template using the given name. R(R$R RRR^(RR)R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRPs cCs|jj|dk S(s{Returns a boolean indicating whether the given name matches the pattern for this template. N(RR$R (RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR$scCs|jS(s9The name (pattern text) of the property section template.(R(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR)s( RRRRReR R4RPR$RBR)(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs   tConfigcBs(eZdZeZdZejejddZ dZ dZ e dZ dZdZe dZdZejd Zd Zd Zd Zd ZdZdZdZdZdZdZejdZdZdZe dZ!e dZ"dZ#RS(sSThe Config class provides basic in-memory management of configuration data.cCs|dks!t|ts!ti|_||_|dkrc|rZt|j}qcd}n||_|j d|dS(sInitializes a Config object. 'definitions' is a dictionary of PropertySection objects indexed by configuration version defining the initial set of property sections, properties, and values for a Config object. 'overrides' is an optional dictionary of property values indexed by section name and property name. If provided, it will be used to override any default values initially assigned during initialization. 'version' is an integer value that will be used to determine which configuration definition to use. If not provided, the newest version found in 'definitions' will be used. it overridesN( R R!R>R t_Config__sectionst_defstmaxtkeyst_versiontreset(Rt definitionsRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s!     cCspd}xc|jD]U\}}|d|j7}x+|D]#}|d|jt|f7}q7W|d7}qW|S(seReturns a unicode object representation of the configuration object. us[%s] u%s = %s s (RR)R5(RtouttsectpropsR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR6 s !cCspd}xc|jD]U\}}|d|j7}x+|D]#}|d|jt|f7}q7W|d7}qW|S(s]Returns a string representation of the configuration object. Rs[%s] s%s = %s s (RR)R7(RRRRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs !c Cs|j||j|y|j|}Wnntk r|j|}g|jD]}t|tsY|j^qY}t |j ||j |nXy|j |SWnIt k r|j|j}|j||d|}|j||SXdS(sReturns the Property object matching the given name for the given PropertySection object, or adds a new one (if it does not already exist) based on class definitions. 'default_type' is an optional parameter specifying the type of property to create if a class definition does not exist for the given property. t default_typeN(t_validate_section_namet_validate_property_namet get_sectionRt_Config__get_section_defRR!RR)tmapRt add_sectionRRt_Config__get_property_defR( RR R)RtsecobjRtelidetsecdeftpropobj((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt_get_matching_property#s$      cCsdS(sbRaises an exception if property name is not valid for this class. N((RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRNscCsdS(saRaises an exception if section name is not valid for this class. N((RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRTscCsy |j|}tj|SWn`tk rxE|jD]7}t|tsXq=n|j|r=|j|Sq=W||SXdS(s|Returns a new Property object for the given name based on class definitions (if available). N(RR^RRR!RDR$RP(RRR)RRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__get_property_defZs cCsx|jj|jtjD]7}t|ts7qn|j|krtj|SqWxT|jj|jtjD]7}t|t sqsn|j |rs|j |SqsWt|S(sReturns a new PropertySection object for the given name based on class definitions (if available). ( RR<RRRAR!RR)R^RR$RP(RR)ts((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__get_section_defps" c Csi|_x|jj|jtjD]}t|ts@q%n|j|j t j |}g|j D]}t|t sl|j ^ql}t |j||j|q%WxJ|jD]<\}}x-|jD]\}} |j||| qWqWdS(s6Returns the configuration object to its default state.N(RRR<RRRAR!RRR)R^RRRRRRt set_property( RRRRRRtsnameRRRv((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__resets "cCs|j||dt}t|jtsHtd|d|d|ntj|j}|j|y ||_Wn;tk r}t |dr|j r||_ nnXt |_ dS(sKAdds the value to the property object matching the given section and name. If the section or property does not already exist, it will be added. Raises InvalidPropertyValueError if the value is not valid for the given property or if the target property isn't a list.RR R RN( RRfR!RRkRR^RnRthasattrR R1t_dirty(RR R)RRtpvalte((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytadd_property_values     cCsQt|tst|j|jks-t|j|j||j|js(Rqt get_sections(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCsLy|j|}Wn&tk r;td|d|nX|j|jS(sReturns the value of the property object matching the given section and name. Raises UnknownPropertyError if it does not exist. Be aware that references to the original value are returned; if the return value is not an immutable object (such as a list), changes to the object will affect the property. If the return value needs to be modified, consumers are advised to create a copy first, and then call set_property() to update the value. Calling set_property() with the updated value is the only way to ensure that changes to a property's value are persistent. R R (RRRRR(RR R)R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs  cCsd|jDS(sReturns a generator that yields a list of tuples of the form (section object, property generator). The property generator yields the list of property objects for the section. css!|]}||jfVqdS(N(R(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pys s(R(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs6y|j|SWn tk r1td|nXdS(sReturns the PropertySection object with the given name. Raises UnknownSectionError if it does not exist. R N(RRR(RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs cCs |jjS(sUReturns a generator that yields the list of property section objects.(RR(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCsVy|j|}Wn&tk r;td|d|nX|j|t|_dS(sRemove the property object matching the given section and name. Raises UnknownPropertyError if it does not exist. R R N(RRRRR1R(RR R)R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs   cCs?|j||j|y|j|}Wn&tk rUtd|d|nX|j|}t|jtst d|d|d|nt j |j}y|j |Wn,t k rt d|d|d|nLXy ||_Wn;tk r1}t|dr+|j r+||_nnXt|_dS(syRemoves the value from the list of values for the property object matching the given section and name. Raises UnknownPropertyError if the property or section does not exist. Raises InvalidPropertyValueError if the value is not valid for the given property or if the target property isn't a list.R R RN(RRRRRRR!RRkRR^tremoveR&RRRR R1R(RR R)RRRRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytremove_property_value s.        cCs>y|j|=Wn tk r0td|nXt|_dS(sRemove the object matching the given section name. Raises UnknownSectionError if it does not exist. R N(RRRR1R(RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytremove_section3s  cCst|_|jd|dS(sDiscards current configuration data and returns the configuration object to its initial state. 'overrides' is an optional dictionary of property values indexed by section name and property name. If provided, it will be used to override any default values initially assigned during reset. RN(R1Rt_Config__reset(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR=s cCs|j||j||j||}y ||_Wn;tk rv}t|drp|j rp||_nnXt|_dS(sSets the value of the property object matching the given section and name. If the section or property does not already exist, it will be added. Raises InvalidPropertyValueError if the value is not valid for the given property.R N( RRRRRRR R1R(RR R)RRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRKs    cCsQxJ|jD]<\}}x-|jD]\}}|j|||q&Wq WdS(s}Sets the values of the property objects matching those found in the provided dictionary. If any section or property does not already exist, it will be added. An InvalidPropertyValueError will be raised if the value is not valid for the given properties. 'properties' should be a dictionary of dictionaries indexed by section and then by property name. As an example: { 'section': { 'property': value } } N(RR(RRR RRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytset_properties]scCs|jS(sReturns the target used for storage and retrieval of configuration data. This can be None, a pathname, or an SMF FMRI. (t_target(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyttargetrscCs|jS(scReturns an integer value used to indicate what set of configuration data is in use.(R(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRzscCsdS(sqSaves the current configuration object to the target provided at initialization. N((R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytwritesN($RRRR/RR RRRAR R6RRRRRRRRRRRRRRRRRRRRRRBRRR(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs:   +          )   t FileConfigcBsMeZdZejejddZejdZejdZdZ RS(s The FileConfig class provides file-based retrieval and storage of non-structured (one-level deep) configuration data. This particular class uses Python's ConfigParser module for configuration storage and management. ConfigParser uses a simple text format that consists of sections, lead by a "[section]" header, and followed by "name = value" entries, with continuations, etc. in the style of RFC 822. Values can be split over multiple lines by beginning continuation lines with whitespace. A sample configuration file might look like this: [pkg] port = 80 inst_root = /export/repo [pub_example_com] feed_description = example.com's software update log cCs,||_tj|d|d|d|dS(sInitializes the object. 'pathname' is the name of the file to read existing configuration data from or to write new configuration data to. If the file does not already exist, defaults are set based on the version provided and the file will be created when the configuration is written. 'definitions' is a dictionary of PropertySection objects indexed by configuration version defining the initial set of property sections, properties, and values for a Config object. 'overrides' is an optional dictionary of property values indexed by section name and property name. If provided, it will be used to override any default values initially assigned during initialization. 'version' is an integer value that will be used to determine which configuration definition to use. If not provided, the version will be based on the contents of the configuration file or the newest version found in 'definitions'. RRRN(RRR (RtpathnameRRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s c Cstj}d|_y"tj|jdddd}WnRtk r}|jtjkraq|jtj krt j |j qnXy|j |Wn1tjtjfk r}t j|jnXy|jdd}||_Wn tjtjtfk rnXtj|d|x|jD]}|dkrNq6nx|j|D]\}}||kr|||krq^n|j||} yt|}Wntk rnXy || _Wq^tk r }t|d r|j r||_ nq^Xq^Wq6Wd S( sReads the specified pathname and populates the configuration object based on the data contained within. The file is expected to be in a ConfigParser-compatible format. cSs|S(N((tx((s0/usr/lib/python2.7/vendor-packages/pkg/config.pytstmodetrbtencodingsutf-8RRRR N(!t ConfigParsertRawConfigParsert optionxformtcodecstopenRtEnvironmentErrorterrnotENOENTtEACCESRtPermissionsExceptiontfilenametreadfpt ParsingErrortMissingSectionHeaderErrortInvalidConfigFiletgetintRtNoSectionErrort NoOptionErrorR&RRtsectionsRsRR7tUnicodeEncodeErrorRRRR ( RRtcptefileRRR R RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyt__readsZ            cCs&|jd||s"t|_ndS(sDiscards current configuration state and returns the configuration object to its initial state. 'overrides' is an optional dictionary of property values indexed by section name and property name. If provided, it will be used to override any default values initially assigned during reset. RN(t_FileConfig__readR/R(RR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs c Cstjj|jr#|j r#dStj}d|_x|jD]v\}}t |t sit |j |j xB|D]:}t |tst |j|j |j t|qWqHW|j d|jddt|jd}zy]tjj|j}tjd|\}}d}ytj|j}Wn+tk rm} | jtjkrnqnnX|rtj|tj|jytj||j|j Wqtk r} | jtj!krqqXntj|t"j#tj$|d/} t%j&| d} |j'| WdQXWdQXtj(||jt)|_Wndt*k r} | jtj+krt,j-| j.n'| jtj/krt,j0| j.nnXWd|rtjj|rtj1|nXdS(slSaves the configuration data using the pathname provided at initialization. NcSs|S(N((R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR(sRRtdirtwbsutf-8(2RaRbtexistsRRRRRRR!RR RR)RtsetR7RR tdirnamettempfiletmkstemptstattOSErrorRRtfchmodtS_IMODEtst_modeRtchowntst_uidtst_gidtEPERMRt PKG_FILE_MODEtfdopenRt EncodedFileRtrenameR/RRRRRtEROFStReadOnlyFileSystemExceptiontunlink( RRR RRtfnRtfdtstRtftef((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs\   '     N( RRRRRAR R RRR(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs Ls4^([A-Za-z][ A-Za-z0-9.-]*,)?[A-Za-z][ A-Za-z0-9-_]*$tSMFInvalidPropertyNameErrorcBs eZdZdZdZRS(s>Exception class used to indicate an invalid SMF property name.cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR escCstdi|jd6td6S(NsProperty name '%(name)s' is not valid. Property names may not contain: tabs, newlines, carriage returns, form feeds, vertical tabs, slashes, or backslashes and must also match the regular expression: %(exp)sR)texp(RR t _SMF_name_re(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRis (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR bs tSMFInvalidSectionNameErrorcBs eZdZdZdZRS(s=Exception class used to indicate an invalid SMF section name.cCs)|dk sttj|d|dS(NR (R R RR (RR ((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR tscCstdi|jd6td6S(NsSection name '%(name)s' is not valid. Section names may not contain: tabs, newlines, carriage returns, form feeds, vertical tabs, slashes, or backslashes and must also match the regular expression: %(exp)sR)R (RR R (R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRxs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRqs t SMFReadErrorcBs eZdZdZdZRS(s~Exception classes used to indicate that an error was encountered while attempting to read configuration data from SMF.cCs5tj||r|st||_||_dS(N(RR R tfmriterrmsg(Rtsvc_fmriR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s  cCstd|jS(NsEUnable to read configuration data for SMF FMRI '%(fmri)s': %(errmsg)s(RR(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs t SMFWriteErrorcBs eZdZdZdZRS(s}Exception classes used to indicate that an error was encountered while attempting to write configuration data to SMF.cCs5tj||r|st||_||_dS(N(RR R RR(RRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s  cCstd|jS(NsFUnable to write configuration data for SMF FMRI '%(fmri)s': %(errmsg)s(RR(R((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs (RRRR R(((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRs t SMFConfigc BsweZdZejeZdZej dej d d Z dZ dZ ej dZej dZdZRS(sThe SMFConfig class provides SMF-based retrieval of non-structured (one-level deep) configuration data. Property groups should be named after property sections. Properties with list-based values should be stored using SMF list properties.tgeneralt restartertfstautofstntptnetworktstartdt manifestfileststarttstopttm_common_nameicCs5||_||_tj|d|d|d|dS(suInitializes the object. 'svc_fmri' is the FMRI of the SMF service to use for property data storage and retrieval. 'definitions' is a dictionary of PropertySection objects indexed by configuration version defining the initial set of property sections, properties, and values for a Config object. 'doorpath' is an optional pathname indicating the location of a door file to be used to communicate with SMF. This is intended for use with an alternative svc.configd daemon. 'overrides' is an optional dictionary of property values indexed by section name and property name. If provided, it will be used to override any default values initially assigned during initialization. 'version' is an integer value that will be used to determine which configuration definition to use. If not provided, the version will be based on the newest version found in 'definitions'. RRRN(t_SMFConfig__doorpathRRR (RRRtdoorpathRR((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyR s  cCs%|jj|s!t|ndS(sbRaises an exception if property name is not valid for this class. N(t_SMFConfig__name_reR$R (RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCs5|jj| s"||jkr1t|ndS(saRaises an exception if section name is not valid for this class. N(R"R$t_SMFConfig__reserved_sectionsR(RR)((s0/usr/lib/python2.7/vendor-packages/pkg/config.pyRscCsd}|jrd|j}nd||jf}tj|\}}|rit|jdtni}d}x|jdD]}|dkr|}n ||7}tj d|r|d7}qn|jdd\} } } | jd d \} } | |j krd}qn| d ks2| d krG| d krGd} n|j | i| || | /sh                  l<278M>!V3