diff options
author | Abhijeet Kasurde <akasurde@redhat.com> | 2016-10-24 10:50:03 +0530 |
---|---|---|
committer | Martin Babinsky <mbabinsk@redhat.com> | 2017-01-18 08:51:38 +0100 |
commit | 6d52c0fe6acb09f3b8525840dfacc3f0885eac37 (patch) | |
tree | 86fd08615b5e9a245def2c1e63b8ac7b7eafb34f | |
parent | 49855ca9dea9241ccd88e3a89b499b6fed4493c9 (diff) | |
download | freeipa-6d52c0fe6acb09f3b8525840dfacc3f0885eac37.tar.gz freeipa-6d52c0fe6acb09f3b8525840dfacc3f0885eac37.tar.xz freeipa-6d52c0fe6acb09f3b8525840dfacc3f0885eac37.zip |
Fix for handling CalledProcessError in authconfig
NIS configuration error should be hidden from user
while running ipa-client-install
Fixes https://fedorahosted.org/freeipa/ticket/5244
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
Reviewed-By: Stanislav Laznicka <slaznick@redhat.com>
-rw-r--r-- | ipaplatform/redhat/authconfig.py | 18 | ||||
-rw-r--r-- | ipaplatform/redhat/paths.py | 1 |
2 files changed, 16 insertions, 3 deletions
diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py index 7b06d583d..db9201662 100644 --- a/ipaplatform/redhat/authconfig.py +++ b/ipaplatform/redhat/authconfig.py @@ -18,11 +18,14 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +from ipaplatform.paths import paths from ipapython import ipautil +from ipapython.admintool import ScriptError import os FILES_TO_NOT_BACKUP = ['passwd', 'group', 'shadow', 'gshadow'] + class RedHatAuthConfig(object): """ AuthConfig class implements system-independent interface to configure @@ -85,10 +88,16 @@ class RedHatAuthConfig(object): self.add_option("update") args = self.build_args() - ipautil.run(["/usr/sbin/authconfig"] + args) + try: + ipautil.run([paths.AUTHCONFIG] + args) + except ipautil.CalledProcessError: + raise ScriptError("Failed to execute authconfig command") def backup(self, path): - ipautil.run(["/usr/sbin/authconfig", "--savebackup", path]) + try: + ipautil.run([paths.AUTHCONFIG, "--savebackup", path]) + except ipautil.CalledProcessError: + raise ScriptError("Failed to execute authconfig command") # do not backup these files since we don't want to mess with # users/groups during restore. Authconfig doesn't seem to mind about @@ -101,4 +110,7 @@ class RedHatAuthConfig(object): pass def restore(self, path): - ipautil.run(["/usr/sbin/authconfig", "--restorebackup", path]) + try: + ipautil.run([paths.AUTHCONFIG, "--restorebackup", path]) + except ipautil.CalledProcessError: + raise ScriptError("Failed to execute authconfig command") diff --git a/ipaplatform/redhat/paths.py b/ipaplatform/redhat/paths.py index b27b065ad..aaf71e2d3 100644 --- a/ipaplatform/redhat/paths.py +++ b/ipaplatform/redhat/paths.py @@ -33,6 +33,7 @@ class RedHatPathNamespace(BasePathNamespace): if sys.maxsize > 2**32: LIBSOFTHSM2_SO = BasePathNamespace.LIBSOFTHSM2_SO_64 PAM_KRB5_SO = BasePathNamespace.PAM_KRB5_SO_64 + AUTHCONFIG = '/usr/sbin/authconfig' paths = RedHatPathNamespace() |