When user does not pass a name of parent map in
automountmap-add-indirect command, auto.master is used as
a default. However, when auto.master does not exist in a given
location, we raise NotFound error with a name of a location instead
of a name of the missing automount map.

https://fedorahosted.org/freeipa/ticket/2387

>From e39b385e63490abc97bf19c04b616da01d09f5df Mon Sep 17 00:00:00 2001
From: Martin Kosek <[email protected]>
Date: Thu, 15 Mar 2012 16:10:05 +0100
Subject: [PATCH] Improve automount indirect map error message

When user does not pass a name of parent map in
automountmap-add-indirect command, auto.master is used as
a default. However, when auto.master does not exist in a given
location, we raise NotFound error with a name of a location instead
of a name of the missing automount map.

https://fedorahosted.org/freeipa/ticket/2387
---
 ipalib/plugins/automount.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py
index 31c143d8418a9101a14e39ab752bb229e4219094..9df400d2ec87088b9f9f41240bec7226cb5f7a22 100644
--- a/ipalib/plugins/automount.py
+++ b/ipalib/plugins/automount.py
@@ -845,6 +845,10 @@ class automountmap_add_indirect(LDAPCreate):
                     automountkey=options['key'], **kw
                 )
             else: # adding to auto.master
+                # Ensure auto.master exists
+                self.api.Command['automountmap_show'](
+                    keys[0], options['parentmap']
+                )
                 options['automountinformation'] = keys[1]
                 self.api.Command['automountkey_add'](
                     keys[0], u'auto.master',
-- 
1.7.7.6

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to