Ñò Ã#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"cOsWt|tƒpt‚|iid|ddƒ|iid|dddtƒ|S(Ntautomountmap_addiÿÿÿÿu auto.mastertautomountmap_add_indirectu auto.directtkey(t isinstancetDNtAssertionErrorRRtDIRECT_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.pyR0ös tautomountlocation_showcBseZedƒZRS(sDisplay an automount location.(RRRR(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR1þ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.pyR2s 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(NR6R:R,R;R<s/etc/auto.master:R7it-s%s %st automountkeys %s /etc/%ss---------------------------s/etc/%s:ts'maps not connected to /etc/auto.master:R9R*(t print_plaint startswithRtlenR%( R(ttextuiR6R,R-R:R;R<RERFtkR*((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytoutput_for_cli<sR ""  &  (RRRRRHRQ(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyR3s  *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<| ||dRNt num_parentsRtnametKeyErrort ValueErrorRRR‰tget_dntmake_dn_from_attrRwRxt get_entryt normalize_dnRR]R%Rt find_entriest_ldaptSCOPE_ONELEVELRRBtLimitsExceeded(R(R,tkwargsR)tpkeyt parent_keyst parent_dnR*R+tsfiltertbasednt attrs_listtentriesR5((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ÿÿÿÿiiRVR#RF(R@t rdn_separatorRsRR]tobject_not_found_msg(R(R,R«R#RF((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ÿÿÿÿiiRlR#RF(R@R²RsRRutalready_exists_msgtkey_already_exists_msg(R(R,R«R#RF((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pythandle_duplicate_entryís "    cCs3|tjo|o|ii||fƒS|SdS(N(R'R²Rs(R(R#RF((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(NRJR6iR7(RARwtmethodstfindRNR'R·R¸(R(RR`tkeykwRFR#R±((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pytcheck_key_uniquenesss  #(R”N( RRRRR‰RRRRRRRRRtrdn_is_primary_keyR²RRRxRRžRRRµR¶R³R¢R´R·RAR¸R¼(((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyRJƒsD                   7  RkcBsGeZedƒZedƒZddgZd„Zd„Zd„ZRS(sCreate a new automount key.sAdded automount key "%(value)s"R…RœcOsYt|tƒpt‚|iddƒ|iddƒ|ii|d|d||S(NRœR…iþÿÿÿiÿÿÿÿ(R$R%R&tpopRAR=R¼(R(R)R*R+R,R-((s</usr/lib/python2.6/site-packages/ipalib/plugins/automount.pyt pre_callbacks ccs#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||ƒ||iiisf   a F     ] ¾       ‘  3 ' 8