Bug 726715

Summary: Importing /etc/auto.master does not detect and import /etc/auto.direct.
Product: Red Hat Enterprise Linux 6 Reporter: Gowrishankar Rajaiyan <grajaiya>
Component: ipaAssignee: Rob Crittenden <rcritten>
Status: CLOSED ERRATA QA Contact: Chandrasekar Kannan <ckannan>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.2CC: benl, dpal, jgalipea, mkosek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ipa-2.1.1-1.el6 Doc Type: Bug Fix
Doc Text:
Cause: When importing automaster maps auto.direct mounted on /- was ignored because it was considered a duplicate. Consequence: Direct maps needed to be manually added. Fix: An exception is made for the auto.direct map when importing so its keys can be added. Result: Importing direct maps works.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-06 18:25:10 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gowrishankar Rajaiyan 2011-07-29 15:16:50 UTC
Description of problem:


Version-Release number of selected component (if applicable):
ipa-server-2.0.99-5.20110728T0521zgit1b09ca5.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. # ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
---------------------------
/etc/auto.direct:


2. I do not have "/- /etc/auto.direct" in auto.master since it gets created by default while adding an automountlocation.

# cat /etc/auto.master | grep -v "#"
/ipashare 	/etc/auto.pune

# cat /etc/auto.direct 
/share 	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man

# cat /etc/auto.pune 
*       -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp


3. # ipa automountlocation-import pune /etc/auto.master 
Imported maps:
Added auto.pune

Imported keys:
Added /ipashare to auto.master
Added * to auto.pune


Actual results:
Importing /etc/auto.master does not detect and import /etc/auto.direct

# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
/ipashare	/etc/auto.pune
---------------------------
/etc/auto.direct:             <<<<<<<<<<<<
---------------------------
/etc/auto.pune:
*	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp


Expected results:
Should detect and import /etc/auto.direct

Additional info:
The only work-around I could figure out is

# ipa automountkey-del pune auto.master --key="/-" --info=auto.direct
--------------------------
Deleted automount key "/-"
--------------------------

# ipa automountmap-del pune auto.direct
-----------------------------------
Deleted automount map "auto.direct"
-----------------------------------

# cat /etc/auto.master | grep -v "#"
/- 	/etc/auto.direct
/ipashare 	/etc/auto.pune


# ipa automountlocation-import pune /etc/auto.master 
Imported maps:
Added auto.direct
Added auto.pune

Imported keys:
Added /- to auto.master
Added /ipashare to auto.master
Added * to auto.pune
Added /share to auto.direct            <<<<<<<<<<<<


# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
/ipashare	/etc/auto.pune
---------------------------
/etc/auto.direct:
/share	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man       <<<<<<<<<<<<<<<<
---------------------------
/etc/auto.pune:
*	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp

Comment 2 Rob Crittenden 2011-07-29 20:02:25 UTC
https://fedorahosted.org/freeipa/ticket/1551

Comment 3 Martin Kosek 2011-08-05 09:01:31 UTC
I don't think this is a bug? In automountlocation-import operation we import all maps/keys that are in given /etc/auto.master file. However, mapping "/- auto.direct" was not in auto.master in the first case and thus it was not loaded. When you added the mapping "/- auto.direct" to /etc/auto.master, the import of auto.direct map worked.

It seems inconsistent to me to import auto.direct file contents since it does not have a mapping in the imported auto.master file. After all, autofs didn't consider /etc/auto.direct when running from the local files either, did it?

Comment 4 Gowrishankar Rajaiyan 2011-08-05 10:29:15 UTC
# cat /etc/auto.master 
/- 	/etc/auto.direct 	
/ipashare 	/etc/auto.pune 


# ipa automountlocation-import pune /etc/auto.master
ipa: ERROR: key /- already exists

Since the error message is key "/-" already exists by default I removed "/-     /etc/auto.direct" key from /etc/auto.master and tried importing again.

Since the location already had the direct map in it created by default I expect /etc/auto.direct to be imported automatically.

Comment 5 Rob Crittenden 2011-08-05 12:42:28 UTC
Ok, the error here is that the contents of a map were ignored if the map already existed in IPA. We should make an exception for auto.direct since we pre-create it in each location. The error is not that a file not mentioned in auto.master was not imported.

Comment 6 Martin Kosek 2011-08-05 13:12:10 UTC
What if there are already some automountkeys in auto.direct if we add the exception? We would have to either overwrite the old automountkeys or ignore the colliding imported ones.

Comment 7 Rob Crittenden 2011-08-05 13:15:24 UTC
I think the rule now (and we're hitting it) is to ignore duplicates. So if we only ignore /- as a duplicate I think we'll be ok. Note that there can be multiple /- in an auto.master, we should handle that too.

Comment 8 Rob Crittenden 2011-08-19 17:53:08 UTC
master: e856310d7512cafbb394dfdf861658dc6a81d93d

ipa-2-1: 2e9d614cabfb556aedb6ca805593dfcf3fa811cd

Comment 10 Rob Crittenden 2011-11-01 00:39:37 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: When importing automaster maps auto.direct mounted on /- was ignored because it was considered a duplicate.
Consequence: Direct maps needed to be manually added.
Fix: An exception is made for the auto.direct map when importing so its keys can be added.
Result: Importing direct maps works.

Comment 11 Gowrishankar Rajaiyan 2011-11-02 07:55:26 UTC
Case 1: with "/-	/etc/auto.direct" in /etc/auto.master

[root@jetfire ~]# ipa automountlocation-add pune
-------------------------------
Added automount location "pune"
-------------------------------
  Location: pune
[root@jetfire ~]# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
---------------------------
/etc/auto.direct:
[root@jetfire ~]# 

[root@jetfire ~]# cat /etc/auto.master
/-		/etc/auto.direct
/ipashare	/etc/auto.pune
[root@jetfire ~]# 

[root@jetfire ~]# cat /etc/auto.direct 
/share  -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/usr/share/man
[root@jetfire ~]# 

[root@jetfire ~]# cat /etc/auto.pune 
*       -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/tmp
[root@jetfire ~]# 
[root@jetfire ~]# 

[root@jetfire ~]# ipa automountlocation-import pune /etc/auto.master 
Imported maps:
Added auto.pune

Imported keys:
Added /ipashare to auto.master
Added * to auto.pune
Added /share to auto.direct

[root@jetfire ~]# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
/ipashare	/etc/auto.pune
---------------------------
/etc/auto.direct:
/share	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man
---------------------------
/etc/auto.pune:
*	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp
[root@jetfire ~]# 



#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

Case 2: with multiple master maps "/-"

[root@jetfire ~]# cat /etc/auto.master 
/-		/etc/auto_test2_direct
/-		/etc/auto.direct
/ipashare	/etc/auto.pune

[root@jetfire ~]# cat /etc/auto_test2_direct 
/etc/auto_test2_direct  -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/usr/share/man2

[root@jetfire ~]# cat /etc/auto.direct 
/share  -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/usr/share/man

[root@jetfire ~]# cat /etc/auto.pune 
*       -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/tmp



[root@jetfire ~]# ipa automountlocation-import pune /etc/auto.master 
Imported maps:
Added auto_test2_direct
Added auto.pune

Imported keys:
Added /- to auto.master
Added /ipashare to auto.master
Added * to auto.pune
Added /etc/auto_test2_direct to auto_test2_direct
Added /share to auto.direct

[root@jetfire ~]# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
/-	/etc/auto_test2_direct
/ipashare	/etc/auto.pune
---------------------------
/etc/auto.direct:
/share	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man
---------------------------
/etc/auto_test2_direct:
/etc/auto_test2_direct	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man2
---------------------------
/etc/auto.pune:
*	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp
[root@jetfire ~]#


#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#

Case 3: with already existing values in auto.direct map

[root@jetfire ~]# ipa automountlocation-add pune
-------------------------------
Added automount location "pune"
-------------------------------
  Location: pune


[root@jetfire ~]# ipa automountkey-add pune
Map: auto.direct
Key: /shanks
Mount information: -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534  bumblebee.lab.eng.pnq.redhat.com:/home/shanks
-----------------------------
Added automount key "/shanks"
-----------------------------
  Key: /shanks
  Mount information: -rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534     bumblebee.lab.eng.pnq.redhat.com:/home/shanks


[root@jetfire ~]# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
---------------------------
/etc/auto.direct:
/shanks	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/home/shanks


[root@jetfire ~]# ipa automountlocation-import pune /etc/auto.master 
Imported maps:
Added auto_test2_direct
Added auto.pune

Imported keys:
Added /- to auto.master
Added /ipashare to auto.master
Added * to auto.pune
Added /etc/auto_test2_direct to auto_test2_direct
Added /share to auto.direct


[root@jetfire ~]# ipa automountlocation-tofiles pune
/etc/auto.master:
/-	/etc/auto.direct
/-	/etc/auto_test2_direct
/ipashare	/etc/auto.pune
---------------------------
/etc/auto.direct:
/shanks	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534	bumblebee.lab.eng.pnq.redhat.com:/home/shanks
/share	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man
---------------------------
/etc/auto_test2_direct:
/etc/auto_test2_direct	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/usr/share/man2
---------------------------
/etc/auto.pune:
*	-rw,fsid=0,insecure,no_root_squash,sync,anonuid=65534,anongid=65534 bumblebee.lab.eng.pnq.redhat.com:/tmp
[root@jetfire ~]# 



Verified. Version: ipa-server-2.1.3-7.el6.x86_64

Comment 12 errata-xmlrpc 2011-12-06 18:25:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2011-1533.html