URL: https://github.com/freeipa/freeipa/pull/1606
Author: amitkumar50
 Title: #1606: Uninstalling IPA requires on being in a existent working 
directory
Action: opened

PR body:
"""
Presently freeipa tests current working directory with os.getcwd()
which throws exception when called on non-existant directory.
Solution can be to call
os.chdir("/root") and set self.cwd variable accordingly.

Tests done:
//console-1
`# mkdir test-delete`
`# cd test-delete`

`# rm -rf /root/test-delete //From console-2`

`# ipa-server-install --uninstall`
  ..successful..

`# cd /root`
`# ipa-server-install`
  ..successful..

Still need to address installation of ipa-server from deleted dir.
Can handle in seperate PR.

Resolves: https://pagure.io/freeipa/issue/7416
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1606/head:pr1606
git checkout pr1606
From 0667b0dc7e37e59b248cbc5883a9efc320566e2a Mon Sep 17 00:00:00 2001
From: amitkuma <amitk...@redhat.com>
Date: Wed, 21 Feb 2018 18:13:11 +0530
Subject: [PATCH] Uninstalling IPA requires on being in a existent working
 directory

Presently freeipa tests current working directory with os.getcwd()
which throws exception when called on non-existant directory.
Solution can be to call
os.chdir("/root") and set self.cwd variable accordingly.

Tests done:
//console-1
# mkdir test-delete
# cd test-delete

# rm -rf /root/test-delete //From console-2

# ipa-server-install --uninstall
  ..successful..

# cd /root
# ipa-server-install
  ..successful..

Still need to address installation of ipa-server from deleted dir.
Can handle in seperate PR.

Resolves: https://pagure.io/freeipa/issue/7416
---
 ipaserver/install/certs.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py
index 1579d5c09c..698aca232f 100644
--- a/ipaserver/install/certs.py
+++ b/ipaserver/install/certs.py
@@ -126,9 +126,9 @@ def __init__(self, realm, nssdir, fstore=None,
 
         try:
             self.cwd = os.path.abspath(os.getcwd())
-        except OSError as e:
-            raise RuntimeError(
-                "Unable to determine the current directory: %s" % str(e))
+        except OSError:
+            os.chdir("/root")
+            self.cwd = os.path.abspath(os.getcwd())
 
         self.cacert_name = get_ca_nickname(self.realm)
 
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to