[Freeipa-devel] [freeipa PR#179][synchronized] Fix for handling CalledProcessError in authconfig

2017-01-17 Thread Akasurde
   URL: https://github.com/freeipa/freeipa/pull/179
Author: Akasurde
 Title: #179: Fix for handling CalledProcessError in authconfig
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/179/head:pr179
git checkout pr179
From 76df5889ddc0559134bdc184340941d87699d021 Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde 
Date: Mon, 24 Oct 2016 10:50:03 +0530
Subject: [PATCH] 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 
---
 ipaplatform/redhat/authconfig.py | 18 +++---
 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 7b06d58..db92016 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 .
 
+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 @@ def execute(self, update=True):
 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 @@ def backup(self, path):
 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 b27b065..aaf71e2 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()
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#179][synchronized] Fix for handling CalledProcessError in authconfig

2017-01-12 Thread Akasurde
   URL: https://github.com/freeipa/freeipa/pull/179
Author: Akasurde
 Title: #179: Fix for handling CalledProcessError in authconfig
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/179/head:pr179
git checkout pr179
From ddc7f2032eebbd88bc1d6da2d0bebab5c6c6c15f Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde 
Date: Mon, 24 Oct 2016 10:50:03 +0530
Subject: [PATCH] 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 
---
 ipaplatform/redhat/authconfig.py | 19 ---
 ipaplatform/redhat/paths.py  |  1 +
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py
index 7b06d58..a3bd46b 100644
--- a/ipaplatform/redhat/authconfig.py
+++ b/ipaplatform/redhat/authconfig.py
@@ -3,6 +3,7 @@
 #  Tomas Babej 
 #
 # Copyright (C) 2007-2014  Red Hat
+# Copyright (C) 2016  FreeIPA Contributors
 # see file 'COPYING' for use and warranty information
 #
 # This program is free software; you can redistribute it and/or modify
@@ -18,11 +19,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .
 
+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 +89,16 @@ def execute(self, update=True):
 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 +111,7 @@ def backup(self, path):
 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 b27b065..aaf71e2 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()
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

[Freeipa-devel] [freeipa PR#179][synchronized] Fix for handling CalledProcessError in authconfig

2017-01-03 Thread Akasurde
   URL: https://github.com/freeipa/freeipa/pull/179
Author: Akasurde
 Title: #179: Fix for handling CalledProcessError in authconfig
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/179/head:pr179
git checkout pr179
From 6a4e15cb5a88b4d90dd59cdfaf2de5b6112fcf41 Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde 
Date: Mon, 24 Oct 2016 10:50:03 +0530
Subject: [PATCH] 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 
---
 ipaplatform/redhat/authconfig.py | 20 
 ipaplatform/redhat/paths.py  |  1 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py
index 7b06d58..bf7f578 100644
--- a/ipaplatform/redhat/authconfig.py
+++ b/ipaplatform/redhat/authconfig.py
@@ -2,7 +2,7 @@
 #  Alexander Bokovoy 
 #  Tomas Babej 
 #
-# Copyright (C) 2007-2014  Red Hat
+# Copyright (C) 2007-2016  Red Hat, Inc.
 # see file 'COPYING' for use and warranty information
 #
 # This program is free software; you can redistribute it and/or modify
@@ -18,11 +18,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see .
 
+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 @@ def execute(self, update=True):
 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 @@ def backup(self, path):
 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 b27b065..aaf71e2 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()
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code