Ñò h'dWc @sûdZddkZddkZddkZddkZddklZlZl Z l Z l Z l Z l Z lZlZlZddklZlZlZlZddklZlZeidƒiZeidƒiZde fd„ƒYZ d „Z!dS( s AI Profile Interface iÿÿÿÿN( tCriteriat AIServerErrort ERROR_TYPEtSERVICE_STATUStEventsGeneratortObjectChangedEventt DeletedEventt CreatedEventt check_authst PROFILE_AUTH(t ai_databasetget_server_instancetlogtMAX_PROFILE_NAME_LEN(tperform_templatingtvalidate_profile_stringtwebservdtProfilecBs=eZdZdZdZdZeegZdddd„Ze d„ƒZ d„Z e d„ƒZ e dd „ƒZ e dd „ƒZed „Zd „Zd „Zed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZd„Zd„Zeeed„Zed„ƒZd„ZRS(sThe Profile interface represents a profile in the AI server. Each specific profile is associated with exactly one AI service. The following event types are possible for a Profile: - CreatedEvent - DeletedEvent - ObjectChangedEvent tinstalltsystemtallcCs ||_||_||_||_||_t|_|djo[d}dt|ƒ}x5|i i d|ƒo|d7}dt|ƒ}q\W||_nM|i |i ƒ|i i d|i ƒo#t titdƒ|i ƒ‚ntt|ƒitttgƒdS(s‘This method creates a new profile for the service, initializing with the specified values. Parameters name: String Optional: This is the name to give to the profile. If no name is provided, then a name will be generated. content: String This is the complete content of an XML system configuration profile file, and will be validated against the service it's being added to. criteria: Criteria object Optional: This is the Criteria used in selecting a profile for use by a client. environment: list Optional: This is the list of environments where this profile should be applied. Return Value None Errors / Exceptions AIServerError The following error types can be raised by this method: - ParsingError This error/exception will be raised should the provided profile content fail to validate against the DTDs in the service. isprofile-tfilter_by_namesDuplicated profile name: '%s'N(t_servicet_contentt_namet _criteriat _environmenttFalset_pendingtNonetstrtservicet get_profilest validate_nametnameRRtDUPLICATE_ENTRYt_tsuperRt__init__RRR(tselfRtcontentR"tcriteriat environmentt profile_numt profile_name((s ../profile.pyR&<s*           c Ksâttƒ||||}t|_|iƒtƒ}tƒ}||d<|i|d<||d<|i|d<|i|d<|i |dtnametag(RRt INVALID_VALUER$t isinstancet basestringRtlenR tAIdbt sanitize_sqlR?R@RAtsett ExceptionR2(R9R"troot((s ../profile.pyR!Ôs(     t,cCsÕ|pttitdƒƒ‚nt|tƒp&ttitdƒt|ƒƒ‚n|i|ƒ}xN|D]F}|ti jo0|ti jo ttitdƒ|ƒ‚qoqoWti |joti S|S(s¶ Convert a 'delim' separated string of environment names into a list of strings. If the 'all' value was given, translate that to all supported environments. s*Profile environment string cannot be emptys(Invalid profile environment string: '%s's/Invalid profile environment value in string: %s( RRRLR$RMRNRtsplitRtSUPPORTED_ENVIRONMENTStENVIRONMENT_ALL(R9tenv_strtdelimtenvlisttenv((s ../profile.pytenv_str_to_listús$     cCsÎ|pttitdƒƒ‚nt|tƒpttitdƒƒ‚nxN|D]F}|tijo0|tijo ttitdƒ|ƒ‚qVqVWti|jo|i tiƒS|i |ƒS(s° Convert a list of environment names into a 'delim' separated string. If the 'all' value is in the list, translate that to all supported environments. s(Profile environment list cannot be emptys!Invalid profile environment list.s-Invalid profile environment value in list: %s( RRRLR$RMR4RRWRXtjoin(R9R[RZR\((s ../profile.pytenv_list_to_strs     cCs|iid|d|ƒS(s This method will match this manifest object against the provided criteria. Parameters criteria: Criteria Criteria object containing the criteria to match match_all: Boolean If True, only profiles matching all the criteria passed in are considered a match Return Value Boolean True will be returned if the criteria matches exactly, otherwise False. Errors / Exceptions AIServerError The following error types can be raised by this method: - InvalidValue This error/exception will be raised should invalid criteria keys or values be specified. t param_critt match_all(R)tmatches(R'tcrit_objRa((s ../profile.pyRb1sc CsÛttƒ|iid|iƒp#ttitdƒ|iƒ‚nt ƒ}t ƒ}||d<|ii|d<|i|dR3R!R]R_RRbRfRitpropertyRR"RkR(R)R*R„R…R”R•R—(((s ../profile.pyR,s:   :6 '&  ) 5 # # _c Csîtƒ}x8|D]0}ti|||dtƒ|d|iƒs    F"ÿÿƒ