C#Wc@sdZddlZddlZddlZddlZddlmZddlmZddl m Z ddl m Z m Z mZddlmZddlmZmZmZmZdd lmZmZmZdd lmZdd lmZdd lmZdd l m!Z!ddl"m#Z#da%dZ&dZ'dZ(dZ)dZ*ej+da,ej+dZ-ej+da.defdYZ/de/fdYZ0de/fdYZ1de/fdYZ2de/fd YZ3d!e/fd"YZ4d#e/fd$YZ5d%e/fd&YZ6d'e/fd(YZ7d)e/fd*YZ8d+e/fd,YZ9d-Z:d.Z;d/Z<d0Z=d1Z>e?d2Z@d3ZAd4ZBd5d6ZCd7ZDd8ZEd9ZFdS(:s Name service selection screens iN(t InstallEngine(tINSTALL_LOGGER_NAME(tSystemConfiguration(tNO_LEADING_ZEROStfind_dnst find_domain(t IPAddress(t_tSC_GROUP_NETWORKtSCI_HELPt group_check(t BaseScreent SkipExceptiont UIMessage(t EditField(t textwidth(tListItem(t ScrollWindow(t WindowAreaiiiiis^[A-Z0-9\-_]+$s^[A-Z0-9\-_]{0,63}$s^[A-Z0-9\-_]{1,63}$t NameServicecBsbeZdZdZdZd ZdZedZedZ edZ d d d Z d Z RS( s"Allow user to select name service s %siiiis*Enter either a host name or an IP address.s1An IP address must be of the form xxx.xxx.xxx.xxxs/IP address segments may not have leading zeros.cCstdkr"tjtdantt|j|d|_d|_ t j j |_ |j j dtdtd|_d|j_d|j_t|j_t|j_d|j_d|j_t|j_d|j_dS(Ns .sysconfigs#DEVELOPER: define intro in subclasst class_typetnot_found_is_erri(tLOGGERtNonetloggingt getLoggerRtsuperRt__init__tintrot scroll_regionRt get_instancetdoctget_descendantsRtTruetsctalt_nameservicet sc_ldap_pb_dntFalsetdnstlisttsc_dns_nameservertsc_ldap_searchbasetsc_ypcmd_broadcasttsc_nis_ypserverst sc_nis_domain(tselftmain_wint nameservicetscreen((snameservice.pyRMs         cCs)tj|j_d|jj|jdS(sl paint screen with opening paragraph and blank line Returns the row (y-offset) after the blank line ii(Rt BORDER_WIDTHt center_wint border_sizet add_paragraphR(R-((snameservice.pyt_paint_openingss(iiN(t__name__t __module__t__doc__t HELP_FORMATt SCROLL_SIZER1tHOSTNAME_SCREEN_LENRt MSG_HOST_NAMEt MSG_IP_FMTtMSG_NO_LEADING_ZEROSRRR5(((snameservice.pyRAs   &t NSDNSChoosercBsZeZedZedefZdZedZdZdZ dZ dZ RS(sDNS Name Services/%s/name_service.txts%stDNScCsZtt|j|tjdtd|_t|j_ d|j_ t |_ dS(Nsin NSDNSChooser initsDIndicates whether or not the system should use the DNS name service.tfiles( RR?RRtdebugRRR'R"t dns_searchtsc_ns_switch_defaultR!tfirst_screen_visit(R-R.((snameservice.pyRs   c Csttr'|jjdkr'tn|j}tjdtdtdg}t ddd|dt |d }|j |d |_ |j |_t|d |j|_xXt|D]J\}}t d t|d |t}t|d |jd |d |qW|jj|jj|j|jrR|jjdd tn;|jjrw|jjdd tn|jjd d tdS(s! called upon display of a screen t DefaultFixedsSelecting configuration of DNSs Configure DNSsDo not configure DNStx_locity_loctscrollable_linesitwindowttexttdata_objt force_to_topN(R RR"t sc_networkR R5RRBRRtlent win_size_ytlinest win_size_xtcolumnsRR2Rt enumerateRtINDENTRR.t do_updatetactivate_objectREtactivate_object_forceR!R&(R-RHtynlisttareatidxtyontwin_area((snameservice.pyt_shows.          cCsdt|_|jjdk|j_tjd|jj|jjr`t|jt |jndS(s7 called when changes submitted by user for all screens ison_change_screen DNS chosen? %sN( R%RERt active_objectR"R&RtinfoRR(R-((snameservice.pyt on_continues    cCst|j_t|_dS(sSet the DNS flag back to false, set first_screen_visit flag back to True, since the user may choose not to revisit the screenN(R%R"R&R!RE(R-((snameservice.pyton_prevs ( R6R7Rt HEADER_TEXTR t HELP_DATAR9tUSER_CHOICE_DNSRR^RaRb(((snameservice.pyR?zs   ! t NSAltChoosercBsxeZedZedefZedededgZd ddgZdZ dZ dZ dZ RS( sAlternate Name Services/%s/name_service.txtRtLDAPtNIScCs)tt|j|td|_dS(NsFrom the list below, select one name service to be used by this system. If the desired name service is not listed, select None. The selected name service may be used in conjunction with DNS.(RRfRRR(R-R.((snameservice.pyRsc Cssttr'|jjdkr'tn|j}tjdtddd|dt t j d}|j |d|_ |j|_t|d|j|_|jtj}xttt j D]c\}}|d7}t|t|d}td||t}t|d|jd |d |qW|jj|jj|j|jjt jj|jj d t!d S( s! called upon display of a screen RFs Selecting alternate name serviceRGiRHRIiRJRKRLRMN("R RR"RNR R5RRBRRORftUSER_CHOICE_LISTRPRQRRRSRR2RRR:RTtminRRURR.RVRWRXt CHOICE_LISTtindexR#R!(R-RHRZtmenu_item_max_widthR[tnsnthiliteR]((snameservice.pyR^s.          cCsttj|jj|j_|jjr|jjd ksI|jjdkrdd|j_d|j_ qZ|jjdkrd|j_d|j_ qZ|jjdkrZd|j_d|j_ qZnd |j_ |jjd ks|jjdkrd|j_nZ|jjdkr-d|j_d|j_ n-|jjdkrZd|j_d |j_ nt j d |jjd S( s7 called when changes submitted by user for all screens RRAs files dnsRgs files ldapRhs files nistldaptniss'on_change_screen Name Service chosen=%sN( RfRkRR_R"R#R&RRDtsc_ns_switch_hosttsc_ns_switch_netgroupRR`(R-((snameservice.pyRas0        cCs4d|j_d|j_d|j_d|j_dS(saSet the values back to None, since the user may choose a not to configure a name service.N(RR"R#RDRsRr(R-((snameservice.pyRbs   N( R6R7RRcR RdRiRRkRR^RaRb(((snameservice.pyRfs !  ! tNSDomaincBsKeZedZedefZddZdZdZ dZ RS(s Domain Names/%s/domain.txtcCsJtt|j|td|_td|_d|_d|_dS(NsoSpecify the domain for the NIS or LDAP name server. Use the domain name's exact capitalization and punctuation.s Domain Name:t( RRtRRRttitleRt domain_fieldtdomain(R-R.R0((snameservice.pyR s  c Csttr'|jjdkr'tn|jjs<tn|j}ttd|j t |j t d}|j j|j |t td||t |j t ddtd}t|d|j d|jdtd|jjdd |_|jj|j j|jd S( s show domain RFitscrollable_columnsRJRKtvalidatet error_winRLtsc_nis_domainnameN(R RR"RNR R#R5Rjt MAXDOMAINLENRRRRvRUR2tadd_textRRRxtincremental_validate_domainR.t error_lineRwRVRW(R-RHtcolsRZ((snameservice.pyR^+s"      !#  cCst|jjdtdS(Nt allow_empty(tvalidate_domainRwtget_textR%(R-((snameservice.pyRz@scCs|jj}|j|ks=|jjdkr|jj r||_|jjdkrt|}|jj s|jjj| r||j_n|jjrt |jj|jj}|r||j_qqd|jj|j_qn|j|j_ dS(sSet the LDAP/NIS domain. Additionally, if LDAP is chosen, set up the following: - the search base from the domain - the ldap search base - the ldap proxy bind distinguished name (DN) Rgscn=proxyagent,ou=profile,%sN( RwRRxR"R#R)t_convert_to_ldap_domaint startswithR$t_ldap_domain_fixupR|(R-t new_domaintldapdomt fixedbase((snameservice.pyton_change_screenCs$      N( R6R7RRcR RdRRR^RzR(((snameservice.pyRts    t NSDNSServercBsQeZedZedefZdZddZdZ dZ dZ RS(sDNS Server Addressess/%s/dns_server.txticCsDtt|j|td|_td|_t|_dS(Ns[Enter (or update) the IP address of the DNS server(s). At least one IP address is required.sDNS Server IP address:(RRRRRRvR'tdns_server_list(R-R.R0((snameservice.pyRrscCs ttr'|jjdkr'tn|jjs<tn|j}d}d}x\tt j D]K}|j j |j |ttdt|t|j td}|d7}|t|jjkr|jj|dk r|jj|}nd}|r |}n|dkr|}nt|j|krpt|d|j d|dtd|jjd d |j|s8          cCsO|jj|j_|jjtjjdkr?d|j_n d|j_dS(NRttrue( RR_R"RRRRlR*R(R-((snameservice.pyRds  N( R6R7RRcR RdRRRR^R(((snameservice.pyR.s    &tNSNISIPcBsNeZedZedefZdZdZdZdZ dZ RS(sNIS Name Server Informations /%s/nis.txticCs2tt|j|t|_d}d}dS(Ni(RRRR'tnis_server_listR(R-R.RR((snameservice.pyRts c Cs d}d}ttr3|jjdkr3tntjd|jj|jjdkretn|jj t j j dkrtn|jj rtd|_td|_ntd|_td |_|j}xttjD]}|t|jjkr:|jj|dk r:|jj|}nd }|rO|}n|dkrd|}n|jj|j|tt|jtd }|j|}td |||}|jj|j|ttd |||d tjd }t|j|krUt |d |jd|d|jj r0t!nt"d|j#j$dd|j|R<(t host_namet characterterr((snameservice.pyRs cCsf|s dSytj|WnDtk ra}|dtkrOttjnttjnXdS(s[Wrap a call to convert_address and raise a UIMessage with appropriate message text Ni(RRRRR RR>R=(t ip_addressR((snameservice.pyR.scCs|s%|rdSttdnx|jdD]}t|dkrbttdn|jds|jdrttdntj|js5ttdq5q5WdS( s given a domain string, validate it Args: domain - network domain name allow_empty - if False, and domain is blank, failure Raises: UIMessage on failure NsThe domain cannot be blank.t.i?s0Domain labels must have less than 64 characters.t-s9Domain labels should not start or end with hyphens ('-').sInvalid domain( R RtsplitRORtendswithtDOMAIN_LABEL_PATTERNtmatchtupper(RxRtlabel((snameservice.pyR<scCsr|j}|stSytj|WnDtk rm}|dtkr[ttjnttj nXtS(sIncrementally validate the IP Address as the user enters it Arg: edit_field - EditField object for validation Raises: UIMessage on failure i( RR!Rtincremental_checkRRR RR>R=(t edit_fieldRR((snameservice.pyRRs cCs|j}|stS|djrix<|D]4}|j r-|dkr-ttdq-q-WtSytj|WnDtk r}|dt krtt j ntt j nXtS(sIncrementally validate the host as the user enters it Arg: edit_field - EditField object for validation Raises: UIMessage on failure iu-.sMA host name can only contain letters, numbers, periods, and minus signs (-).( RR!RRR RRRRRRR>R<(RRRR((snameservice.pyRcs  scCs]|j}|s+ttd|ntj|jsYttd|ndS(sIncrementally validate EditField as the user enters it Args: edit_field - EditField object for validation etext - text to paste upon error Raises: UIMessage upon finding whitespace and special characters other than hyphens and underscores sThe %s cannot be blank.sInvalid character for %s.N(RR RtNO_WHITE_NO_SPECIAL_PATTERNRR(RRR((snameservice.pyR|s  cCs|j}x|jdD]{}t|dkrIttdn|jdrmttdntj|jsttdqqWdS(sIncrementally validate EditField as a domain as the user enters it Arg: edit_field - EditField object with domain to validate Raises: UIMessage if invalid character typed Ri?s/Domain labels must have less than 64 charactersRs+A domain label may not begin with a hyphen.s"Invalid character for domain name.N( RRROR RRt INCREMENTAL_DOMAIN_LABEL_PATTERNRR(RRxR((snameservice.pyRs cCsAt}x(|jdD]}|jd|qWdj|S(s given a domain in dotted notation, produce an LDAP domain Arg: domain - domain to convert Returns converted for LDAP as string Rsdc=t,(R'RRtjoin(RxtlabelsR((snameservice.pyRs cCsF|j|rdS|jd}|rB|drB|dd|SdS(s if existing LDAP-formatted value, does not have the specified search base, replace it with the specified search base Args: old - the existing LDAP-formatted value new_search_base - the search base to replace it with s,dc=iRN(RRR(toldtnew_search_basetdnsplit((snameservice.pyRs (GR8RRtreRtsolaris_install.engineRtsolaris_install.loggerRt!solaris_install.sysconfig.sc_specRt&solaris_install.sysconfig.network_utilRRRt!solaris_install.sysconfig.ip_utilRtsolaris_install.sysconfig.utilRRR R t&solaris_install.terminalui.base_screenR R R t%solaris_install.terminalui.edit_fieldRtsolaris_install.terminalui.i18nRt$solaris_install.terminalui.list_itemRt(solaris_install.terminalui.scroll_windowRt&solaris_install.terminalui.window_areaRRRRURRR}RtcompileRRRRR?RfRtRRRRRRRRRRRRR!RRRRRRR(((snameservice.pyts`    "9E\QYZ3Y@{