Ñò Ã#xPc @s^ddklZlZddklZlZddklZlZlZddkTddkl Z l Z ddk Z ddk Z e dƒZdZd2Zd3Zd efd „ƒYZeieƒd efd „ƒYZeieƒdefd„ƒYZeieƒdefd„ƒYZeieƒdefd„ƒYZeieƒdefd„ƒYZeieƒdefd„ƒYZeieƒdefd„ƒYZ eie ƒdefd„ƒYZ!eie!ƒdefd„ƒYZ"eie"ƒde#fd„ƒYZ$eie$ƒd efd!„ƒYZ%eie%ƒd"efd#„ƒYZ&eie&ƒd$efd%„ƒYZ'eie'ƒd&efd'„ƒYZ(eie(ƒd(efd)„ƒYZ)eie)ƒd*efd+„ƒYZ*eie*ƒd,e#fd-„ƒYZ+eie+ƒd.efd/„ƒYZ,eie,ƒd0efd1„ƒYZ-eie-ƒdS(4iÿÿÿÿ(tapiterrors(tObjecttCommand(tFlagtStrtIA5Str(t*(t_tngettextNs6 Automount Stores automount(8) configuration for autofs(8) in IPA. The base of an automount configuration is the configuration file auto.master. This is also the base location in IPA. Multiple auto.master configurations can be stored in separate locations. A location is implementation-specific with the default being a location named 'default'. For example, you can have locations by geographic region, by floor, by type, etc. Automount has three basic object types: locations, maps and keys. A location defines a set of maps anchored in auto.master. This allows you to store multiple automount configurations. A location in itself isn't very interesting, it is just a point to start a new automount map. A map is roughly equivalent to a discrete automount file and provides storage for keys. A key is a mount point associated with a map. When a new location is created, two maps are automatically created for it: auto.master and auto.direct. auto.master is the root map for all automount maps for the location. auto.direct is the default map for direct mounts and is mounted on /-. An automount map may contain a submount key. This key defines a mount location within the map that references another map. This can be done either using automountmap-add-indirect --parentmap or manually with automountkey-add and setting info to "-type=autofs :". EXAMPLES: Locations: Create a named location, "Baltimore": ipa automountlocation-add baltimore Display the new location: ipa automountlocation-show baltimore Find available locations: ipa automountlocation-find Remove a named automount location: ipa automountlocation-del baltimore Show what the automount maps would look like if they were in the filesystem: ipa automountlocation-tofiles baltimore Import an existing configuration into a location: ipa automountlocation-import baltimore /etc/auto.master The import will fail if any duplicate entries are found. For continuous operation where errors are ignored, use the --continue option. Maps: Create a new map, "auto.share": ipa automountmap-add baltimore auto.share Display the new map: ipa automountmap-show baltimore auto.share Find maps in the location baltimore: ipa automountmap-find baltimore Create an indirect map with auto.share as a submount: ipa automountmap-add-indirect baltimore --parentmap=auto.share --mount=sub auto.man This is equivalent to: ipa automountmap-add-indirect baltimore --mount=/man auto.man ipa automountkey-add baltimore auto.man --key=sub --info="-fstype=autofs ldap:auto.share" Remove the auto.share map: ipa automountmap-del baltimore auto.share Keys: Create a new key for the auto.share map in location baltimore. This ties the map we previously created to auto.master: ipa automountkey-add baltimore auto.master --key=/share --info=auto.share Create a new key for our auto.share map, an NFS mount for man pages: ipa automountkey-add baltimore auto.share --key=man --info="-ro,soft,rsize=8192,wsize=8192 ipa.example.com:/shared/man" Find all keys for the auto.share map: ipa automountkey-find baltimore auto.share Find all direct automount keys: ipa automountkey-find baltimore --key=/- Remove the man key from the auto.share map: ipa automountkey-del baltimore auto.share --key=man u/-u auto.directtautomountlocationc BseZdZeiiZedƒZedƒZ dgZ dgZ edƒZ edƒZ edddd ed ƒd ed ƒd eƒfZRS(s0 Location container for automount maps. sautomount locationsautomount locationst nscontainertcnsAutomount LocationssAutomount Locationtcli_nametlocationtlabeltLocationtdocsAutomount location name.t primary_key(t__name__t __module__t__doc__Rtenvtcontainer_automountt container_dnRt object_nametobject_name_pluralt object_classtdefault_attributesRtlabel_singularRtTruet takes_params(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR Ès          tautomountlocation_addcBs)eZedƒZedƒZd„ZRS(s Create a new automount location.s$Added automount location "%(value)s"cOs@|iid|ddƒ|iid|dddtƒ|S(Ntautomountmap_addiÿÿÿÿu auto.mastertautomountmap_add_indirectu auto.directtkey(RRtDIRECT_MAP_KEY(tselftldaptdnt entry_attrstkeystoptions((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyt post_callbackås (RRRRt msg_summaryR+(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR às  tautomountlocation_delcBs eZedƒZedƒZRS(sDelete an automount location.s&Deleted automount location "%(value)s"(RRRRR,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR-ös tautomountlocation_showcBseZedƒZRS(sDisplay an automount location.(RRRR(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR.þstautomountlocation_findcBs&eZedƒZedddƒZRS(s!Search for an automount location.s$%(count)d automount location matcheds%%(count)d automount locations matchedi(RRRRR R,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR/s tautomountlocation_tofilescBs&eZedƒZd„Zd„ZRS(s1Generate automount files for a specific location.cOsÀ|ii}|iid|dƒ}g}|iid|ddƒ}|d}|d}h}dg} xq|D]i} | dd} | i| ƒ| idƒ} |iid|d| dƒ}|d}|d||      !  ! c Os:|dd}|dd}|dd}|dd}|idƒxx|D]p}|ddid ƒo+|id |d d|ddfƒqL|id |d d|ddfƒqLWx•|D]}|ddid ƒoqÇn|dd} |id ƒ|id| ƒx9|| D]-} |id | d d| ddfƒq#WqÇW|idƒ|itdƒƒx»|D]³}|id ƒ|id|dƒxˆ|D]€} t| ƒdjoq®nt| ddƒ} | d|ddjo3|id | dd d| dddfƒq®q®WqWdS(NR3R7R)R8R9s/etc/auto.master:R4it-s%s %st automountkeys %s /etc/%ss---------------------------s/etc/%s:ts'maps not connected to /etc/auto.master:R6R'(t print_plaint startswithRtlentDN( R%ttextuiR3R)R*R7R8R9RBRCtkR'((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytoutput_for_cli<sR ""  &  (RRRRRERO(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR0s  *tautomountlocation_importcBsweZedƒZeddedƒdedƒƒfZedddded ƒƒfZd „Zd „Z d „Z RS( s/Import automount files for a specific location.t masterfileRs Master fileRsAutomount master file.s continue?R tcontinuesIContinuous operation mode. Errors are reported but the process continues.cCsy)t|dƒ}|iƒ}|iƒWnOtj oC}|idjo'tidtdƒh|d6ƒ‚q{‚nX|S(NtritreasonsFile %(file)s not foundtfile(topent readlinestclosetIOErrorterrnoRtNotFoundR(R%tfilenametfptmapte((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyt__read_mapfile€s  cOs'|iid|dƒ}hgd6gd6gd6gd6gd6}h}|i|dƒ}xí|D]å}|id ƒoqcn|iƒ}|id ƒo"|di||dgƒqcnt|ƒdjoqcn|idƒ}t|ƒd joqcn|did ƒoB|di d dƒ} t i i |dƒ|d<| ||dtreplacetostpathtbasenametjointunicodeRtDuplicateEntryt DEFAULT_KEYStgettFalseRR?t DEFAULT_MAPStendswith(R%R@R*RR3R7tmasterRBtamtmapfileRCR_R^tlinestconttxR#((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytforwardŽs²)   "      c Osð|dd}|dd}|dd}|dd}|dd}|idƒx|D]} |id| ƒqZW|id ƒ|id ƒx-|D]%} |id | d | d fƒq–W|id ƒt|ƒd joA|idƒx1|D]%} |id| d | d fƒqóWn|idtƒoSt|ƒd jo@|id ƒ|idƒx#|D]} |id| ƒqgWn|idtƒoSt|ƒd jo@|id ƒ|idƒx#|D]} |id| ƒqÍWndS(NR3R7R)RcRbRasImported maps:sAdded %sRHsImported keys:sAdded %s to %siis Ignored keys:sIgnored %s to %sRRsDuplicate maps skipped:s Skipped %ssDuplicate keys skipped:(RIRKRuRv( R%RMR3R)R*R7RcRbRaRBRN((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyROúsN     &  &  ( RRRRRt takes_argsRt takes_optionsRkRRO(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRPos      lt automountmapc Bs³eZdZdZeiiZedƒZ edƒZ dgZ ddgZ e dddd ed ƒd ed ƒd eƒedddd edƒƒfZedƒZedƒZRS(s Automount map object. R s automount mapsautomount mapsR‚R6t descriptionR R^RtMapRsAutomount map name.Rs description?tdesct DescriptionsAutomount Mapss Automount Map(RRRt parent_objectRRRRRRRRRRRRRRR(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR‚/s"          R!cBs eZedƒZedƒZRS(sCreate a new automount map.sAdded automount map "%(value)s"(RRRRR,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR!Ms tautomountmap_delcBs)eZedƒZedƒZd„ZRS(sDelete an automount map.s!Deleted automount map "%(value)s"c OsYy<|id|ddd|iiƒ\}}|i|ƒWntij onXtS(NR4it automounttbase_dn(tfind_entry_by_attrR:Rt delete_entryRR[R(R%R&R'R)R*tdn_R(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR+Zs(RRRRR,R+(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRˆUs  tautomountmap_modcBs eZedƒZedƒZRS(sModify an automount map.s"Modified automount map "%(value)s"(RRRRR,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRŽjs R5cBs&eZedƒZedddƒZRS(sSearch for an automount map.s%(count)d automount map matcheds %(count)d automount maps matchedi(RRRRR R,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR5rs tautomountmap_showcBseZedƒZRS(sDisplay an automount map.(RRRR(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR}sRGcBs[eZedƒZdZeiiZedƒZ edƒZ dgZ dddgZ e ZdZedd d d ed ƒd edƒdd&ƒedd dd edƒƒedd edƒde dedddddgddƒfZdZedƒZedƒZedƒZedƒZed ƒZd!„Zd"„Zd#„Zd'd$„Zd%„ZRS((sAutomount key object.R‚s automount keysautomount keysR‰RGR4RƒRhR R#RtKeyRsAutomount key name.tflagst req_updateRCsMount informationRtrequiredt no_createt no_updatet no_searcht no_outputtexcludetwebuiisAutomount Keyss Automount KeysWThe key,info pair must be unique. A key named %(key)s with info %(info)s already existss key named %(key)s already existss;The automount key %(key)s with info %(info)s does not existc Osû|i}t|ƒ|ijo@y||ii}Wntj otdƒ‚nX|}n|d}|d }|ii|i i |Œ}|ii |ii||ƒ}|i dt ƒo|Sy(|i|dgd|iƒ\}}Wntij oø|i dt ƒod|d|df} nd |d} td |d fd |d f|iƒ} dg} |i| | | tiƒ\} } t| ƒd jo)tidtdƒtd|ƒƒ‚n| otiƒ‚n| d d }nX|S(Ns&Not enough keys and pkey not in kwargsiÿÿÿÿt add_operationRt normalizeR4s-(&(automountkey=%s)(automountinformation=%s))RGs(automountkey=%s)R6iR iRTsPMore than one entry with key %(key)s found, use --info to select specific entry.R#(R;RKt num_parentsRtnametKeyErrort ValueErrorRRR‡tget_dntmake_dn_from_attrRuRvt get_entryt normalize_dnRR[RLRt find_entriest_ldaptSCOPE_ONELEVELRR?tLimitsExceeded(R%R)tkwargsR&tpkeyt parent_keyst parent_dnR'R(tsfiltertbasednt attrs_listtentriesR2((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR ¬sD        ")  )cGsm|d}|i|iƒd}|ii|i|iƒdƒ}tid|ih|d6|d6ƒ‚dS(NiÿÿÿÿiiRTR#RC(R=t rdn_separatorRqRR[tobject_not_found_msg(R%R)R©R#RC((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pythandle_not_foundãs  "  cGs˜|d}|i|iƒd}|ii|i|iƒdƒ}|o+tid|ih|d6|d6ƒ‚n!tid|ih|d6ƒ‚dS(NiÿÿÿÿiiRjR#RC(R=R°RqRRstalready_exists_msgtkey_already_exists_msg(R%R)R©R#RC((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pythandle_duplicate_entryís "    cCs3|tjo|o|ii||fƒS|SdS(N(R$R°Rq(R%R#RC((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytget_pkþscKsöd}|idƒ}|djodS|ii||d|ƒd}t|ƒdjo™|tjoi|idƒ}|ii|||d}t|ƒdjo#|i|||i||ƒƒqÏdSn|i|||i||ƒƒndS(NRGR3iR4(R>RutmethodstfindRKR$RµR¶(R%RR^tkeykwRCR#R¯((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytcheck_key_uniquenesss  #(R’N( RRRRR‡RRRRRRRRRtrdn_is_primary_keyR°RRRvRRœRRR³R´R±R R²RµR>R¶Rº(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRGƒsD                   7  RicBsGeZedƒZedƒZddgZd„Zd„Zd„ZRS(sCreate a new automount key.sAdded automount key "%(value)s"RƒRšcOsB|iddƒ|iddƒ|ii|d|d||S(NRšRƒiþÿÿÿiÿÿÿÿ(tpopR>R:Rº(R%R&R'R(R)R*((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyt pre_callbacksccs#x|iiƒD] }|VqWdS(N(R:tget_ancestor_primary_keys(R%R#((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytget_args%scOsu|d}|iddƒ}|ii||ƒ||iiiR:R¶RRRtsuperRiRE(R%R)R*R#RCR3((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRE)s " ( RRRRR,tinternal_optionsR½R¿RE(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRis      R"cBs„eZedƒZedƒZeieddddedƒƒedddded ƒd ed ƒd d deƒfZd„Z RS(s"Create a new indirect mount point.s(Added automount indirect map "%(value)s"R#R tmountRs Mount points parentmap?t parentmaps Parent mapRs4Name of parent automount map (default: auto.master).tdefaultu auto.mastertautofillc OsT|iddƒ}|idƒ}|iid||Ž}yé|djo’|idƒo"tidddtd ƒƒ‚n|d }|d }||d <|iid ||ƒ|iid||d|d d|ƒnG|iid |d |ƒ|iid|d dd|d |d ƒWn*tj o|iid|Œ‚nX|S(NRÄR#R!u auto.masterRfRRÃterrors:mount point is relative to parent map, cannot begin with /iiR4RRiRGs-fstype=autofs ldap:%sRˆ( R¼R>RRRJRtValidationErrorRt Exception(R%R)R*RÄR#R3RR^((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyREHs.      ( RRRRR,t LDAPCreateRRRRE(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR"5s        tautomountkey_delc BsŠeZedƒZedƒZeieddddedƒdedƒƒed dd ded ƒƒfZd „Zd „Z d„Z RS(sDelete an automount key.s!Deleted automount key "%(value)s"RGR R#RRRsAutomount key name.sautomountinformation?RCsMount informationccsNxG|iD]<}|idjo!|idddddgƒVq |Vq WdS(NRRR˜R™R‘t no_optionR—(RRtclone(R%toption((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyt get_options{s  ccs#x|iiƒD] }|VqWdS(N(R:R¾(R%R#((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR¿„scOs‹||ii|d|iddƒƒf7}|ii|d|iddƒƒ||iiiRRRÁRËRE(R%R)R*R3((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyREˆs "( RRRRR,t LDAPDeleteRRRÏR¿RE(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRËks       tautomountkey_modcBsleZedƒZedƒZdgZeieddddedƒƒfZd„Z d „Z d „Z RS( sModify an automount key.s"Modified automount key "%(value)s"tnewautomountkeysnewautomountinformation?R tnewinfoRsNew mount informationccs#x|iiƒD] }|VqWdS(N(R:R¾(R%R#((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR¿£scOsBd|jo|d|dR:R¶R$R R¢RÁRÑRE( R%R)R*R&R#RCtnew_keytnew_infoR'Rt entry_attrs_tnew_rdnR3((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRE¯s$  ( RRRRR,RÂt LDAPUpdateRRR¿R½RE(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRÑ•s      R1cBs&eZedƒZedddƒZRS(sSearch for an automount key.s%(count)d automount key matcheds %(count)d automount keys matchedi(RRRRR R,(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR1Ðs tautomountkey_showc BsueZedƒZeieddddedƒdedƒƒeddd ded ƒƒfZd „Zd „ZRS( sDisplay an automount key.RGR R#RRRsAutomount key name.sautomountinformation?RCsMount informationccs#x|iiƒD] }|VqWdS(N(R:R¾(R%R#((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR¿êscOs‹||ii|d|iddƒƒf7}|ii|d|iddƒƒ||iiiRRRÁRÝRE(R%R)R*R3((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyREîs "( RRRRt LDAPRetrieveRRR¿RE(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRÝÛs      (u auto.direct(u/-(.tipalibRRRRRRRtipalib.plugins.baseldapRR R&R¥RnRR$RwRtt LDAPObjectR tregisterRÊR RÐR-RÞR.t LDAPSearchR/t LDAPQueryR0RPR‚R!RˆRÜRŽR5RRGRiR"RËRÑR1RÝ(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytsf   a F     ] ¾       ‘  3 ' 8