ó i'dWc@sldZddlmZddlmZdefd„ƒYZdefd„ƒYZdefd „ƒYZd S( s| boot_spec.py -- library containing class definitions for boot DOC objects, including BootMods, BootEntry, and BootAdm. iÿÿÿÿ(tetree(t DataObjecttBootModscBs_eZdZdZdZdZdZd„Zd„Zd„Z e d„ƒZ e d „ƒZ RS( sc Subclass of DataObject to contain the boot_mods information in the Data Object Cache. t boot_modsttitlettimeouttfirmwarecCs5tt|ƒj|ƒd|_d|_d|_dS(s5 Initialize the DataObject object with name. N(tsuperRt__init__tNoneRRR(tselftname((s boot_spec.pyR,s  cCssd}|jdk r)|d|j7}n|jdk rL|d|j7}n|jdk ro|d|j7}n|S(s5 String representation of a BootMods object. s BootMods: s title="%s"; s timeout=%d; s firmware="%s"N(RR RR(R trep((s boot_spec.pyt__repr__4scCs”tjtjƒ}|jdk r:|jtj|jƒn|jdk rh|jtj t |jƒƒn|j dk r|jtj |j ƒn|S(s5 Method to create the xml boot_mods element. N( RtElementRtBOOT_MODS_LABELRR tsett TITLE_LABELRt TIMEOUT_LABELtstrRtFIRMWARE_LABEL(R telement((s boot_spec.pytto_xml@scCs|jtjkrtStS(s\ Returns True if element has tag: "boot_mods". Returns False otherwise. (ttagRRtTruetFalse(tclsR((s boot_spec.pyt can_handlePscCs—|jtjƒ}|jtjƒ}|jtjƒ}ttjƒ}|dk r]||_n|dk r{t|ƒ|_ n|dk r“||_ n|S(s5 Method to create the DOC boot_mods element. N( tgetRRRRRR RtintRR(RRRRRR((s boot_spec.pytfrom_xmlYs     ( t__name__t __module__t__doc__RRRRRR Rt classmethodRR(((s boot_spec.pyR#s   t BootEntrycBseeZdZdZdZdZdZdZd„Zd„Z d„Z e d „ƒZ e d „ƒZ RS( sj Subclass of DataObject to contain a boot_entry objects information in the Data Object Cache. t boot_entryt default_entryt insert_att title_suffixt kernel_argscCs>tt|ƒj|ƒd|_d|_d|_d|_dS(s5 Initialize the DataObject object with name. N(RR#RR R%R&R'R((R R ((s boot_spec.pyRvs    cCs–d}|jdk r)|d|j7}n|jdk rL|d|j7}n|jdk ro|d|j7}n|jdk r’|d|j7}n|S(s6 String representation of a BootEntry object. s BootEntry: stitle_suffix="%s"; s default=%s; sinsert_at=%s; skernel_args="%s"N(R'R R%R&R((R R ((s boot_spec.pyR scCsØtjtjƒ}|jdk rF|jtjt|jƒj ƒƒn|j dk rn|jtj |j ƒn|j dk r¡tj |tjƒ}|j |_n|jdk rÔtj |tjƒ}|j|_n|S(s6 Method to create the xml boot_entry element. N(RRR#tBOOT_ENTRY_LABELR%R RtDEFAULT_ENTRY_LABELRtlowerR&tINSERT_AT_LABELR't SubElementtTITLE_SUFFIX_LABELttextR(tKERNEL_ARGS_LABEL(R Rt title_elementt kargs_element((s boot_spec.pyRs     cCse|jtjkrtSd}x2|jƒD]$}|jtjkr)|j}q)q)W|dkratStS(s¢ Returns True if element has the tag "boot_entry", and a sub-elemenent that has the tag: "title_suffix". Returns False otherwise. N( RR#R)RR t iterchildrenR.R/R(RRR't subelement((s boot_spec.pyR£s cCs)d}d}|jtjƒ}|jtjƒ}xP|jƒD]B}|jtjkra|j}n|jtj kr=|j}q=q=Wttj ƒ}|dk rª||_ n|dk rÂ||_ n|dk rÚ||_ n|dk r%|jƒdkrt|_q%|jƒdkr%t|_q%n|S(s4 Method to create a DOC boot_entry element. ttruetfalseN(R RR#R*R,R3RR.R/R0R)R&R'R(R+RR%R(RRR'R(R%R&R4R$((s boot_spec.pyR·s,         (RR R!R)R*R,R.R0RR RR"RR(((s boot_spec.pyR#ls  tBootAdmcBsSeZdZdZdZd„Zd„Zd„Zed„ƒZ ed„ƒZ RS(s] Subclass of DataObject to contain the bootadm command in the Data Object Cache. tbootadmtcmdcCs&tt|ƒj|ƒtƒ|_dS(s5 Initialize the DataObject object with name. N(RR7Rtlisttcmd_list(R R ((s boot_spec.pyRÞscCs>d}|jdk r:x"|jD]}|d|7}qWn|S(s4 String representation of a BootAdm object. s BootAdm: s cmd="%s"; N(R;R (R R R9((s boot_spec.pyR äs cCsZtjtjƒ}|jdk rVx2|jD]$}tj|tjƒ}||_q+Wn|S(s3 Method to create the xml bootadm element. N( RRR7tBOOT_ADM_LABELR;R R-t CMD_LABELR/(R RR9t cmd_element((s boot_spec.pyRís  cCs|jtjkrtStS(s[ Returns True if element has tag: "boot_cmd". Returns False otherwise. (RR7R<RR(RR((s boot_spec.pyRúscCsptƒ}x9|jƒD]+}|jtjkr|j|jƒqqWttjƒ}|dk rl||_ n|S(s3 Method to create the DOC bootadm element. N( R:R3RR7R=tappendR/R<R R;(RRR;R4R8((s boot_spec.pyRs   ( RR R!R<R=RR RR"RR(((s boot_spec.pyR7×s   N(R!tlxmlRtsolaris_install.data_objectRRR#R7(((s boot_spec.pyts Ik