Re: [Freeipa-devel] [PATCH 0031] Fix replica deletion when there's no RUVs on the server

2016-06-03 Thread Martin Basti



On 13.05.2016 15:48, Stanislav Laznicka wrote:

Fix.

On 05/13/2016 03:43 PM, Stanislav Laznicka wrote:
Got distracted with the code, beautifying replacement of previous 
patch attached.


On 05/13/2016 03:30 PM, Stanislav Laznicka wrote:

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

Please see the patch attached.












ACK

Pushed to:
master: 72f5c52d8cca32d8de5e8e0228d8ad3246efda48
ipa-4-3: 66be65c477ff029737adf89202a5c555092b5157

-- 
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

Re: [Freeipa-devel] [PATCH 0031] Fix replica deletion when there's no RUVs on the server

2016-05-13 Thread Stanislav Laznicka
Got distracted with the code, beautifying replacement of previous patch 
attached.


On 05/13/2016 03:30 PM, Stanislav Laznicka wrote:

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

Please see the patch attached.




From fb06c6afc9e2d1d84de7c6119b76a9a5de008d06 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka 
Date: Fri, 13 May 2016 15:13:21 +0200
Subject: [PATCH] fixes premature sys.exit in ipa-replica-manage del

Deletion of a replica would fail should there
be no RUVs on the server

https://fedorahosted.org/freeipa/ticket/5307
---
 install/tools/ipa-replica-manage | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 14e768965601cef08f13792bb5cd086534199538..fb317de915a6350fe53b139dc86e29707401d23f 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -465,9 +465,12 @@ def get_rid_by_host(realm, sourcehost, host, dirman_passwd, nolookup=False):
 """
 try:
 servers = get_ruv(realm, sourcehost, dirman_passwd, nolookup)
-except (NoRUVsFound, RuntimeError) as e:
+except RuntimeError as e:
 print(e)
-sys.exit(0 if isinstance(e, NoRUVsFound) else 1)
+sys.exit(1)
+except NoRUVsFound:
+print(e)
+servers = []
 for (netloc, rid) in servers:
 if '%s:389' % host == netloc:
 return int(rid)
@@ -962,10 +965,6 @@ def del_master_managed(realm, hostname, options):
 #And pick new CA master.
 ensure_last_services(api.Backend.ldap2, hostname, masters, options)
 
-# Save the RID value before we start deleting
-rid = get_rid_by_host(realm, options.host, hostname,
-  options.dirman_passwd, options.nolookup)
-
 # 5. Remove master entry. Topology plugin will remove replication agreements.
 try:
 api.Command.server_del(hostname_u)
-- 
2.5.5

-- 
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

Re: [Freeipa-devel] [PATCH 0031] Fix replica deletion when there's no RUVs on the server

2016-05-13 Thread Stanislav Laznicka

Fix.

On 05/13/2016 03:43 PM, Stanislav Laznicka wrote:
Got distracted with the code, beautifying replacement of previous 
patch attached.


On 05/13/2016 03:30 PM, Stanislav Laznicka wrote:

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

Please see the patch attached.








From 3655cc590ba7d1fb4cf3d2b25fd54e21be3e91fa Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka 
Date: Fri, 13 May 2016 15:13:21 +0200
Subject: [PATCH] fixes premature sys.exit in ipa-replica-manage del

Deletion of a replica would fail should there
be no RUVs on the server

https://fedorahosted.org/freeipa/ticket/5307
---
 install/tools/ipa-replica-manage | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 14e768965601cef08f13792bb5cd086534199538..5f5e63708ed1664d6ccda8eb7db9e83c02336f7d 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -465,9 +465,12 @@ def get_rid_by_host(realm, sourcehost, host, dirman_passwd, nolookup=False):
 """
 try:
 servers = get_ruv(realm, sourcehost, dirman_passwd, nolookup)
-except (NoRUVsFound, RuntimeError) as e:
+except RuntimeError as e:
 print(e)
-sys.exit(0 if isinstance(e, NoRUVsFound) else 1)
+sys.exit(1)
+except NoRUVsFound as e:
+print(e)
+servers = []
 for (netloc, rid) in servers:
 if '%s:389' % host == netloc:
 return int(rid)
@@ -962,10 +965,6 @@ def del_master_managed(realm, hostname, options):
 #And pick new CA master.
 ensure_last_services(api.Backend.ldap2, hostname, masters, options)
 
-# Save the RID value before we start deleting
-rid = get_rid_by_host(realm, options.host, hostname,
-  options.dirman_passwd, options.nolookup)
-
 # 5. Remove master entry. Topology plugin will remove replication agreements.
 try:
 api.Command.server_del(hostname_u)
-- 
2.5.5

-- 
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] [PATCH 0031] Fix replica deletion when there's no RUVs on the server

2016-05-13 Thread Stanislav Laznicka

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

Please see the patch attached.
From a8a3d6f6e6b306d84814a0745cb86b973b66d177 Mon Sep 17 00:00:00 2001
From: Stanislav Laznicka 
Date: Fri, 13 May 2016 15:13:21 +0200
Subject: [PATCH] fixes premature sys.exit in ipa-replica-manage del

Deletion of a replica would fail should there
be no RUVs on the server

https://fedorahosted.org/freeipa/ticket/5307
---
 install/tools/ipa-replica-manage | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 14e768965601cef08f13792bb5cd086534199538..53283f2d172786a68bcfdfaf1f2f419ef05fae42 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -467,7 +467,10 @@ def get_rid_by_host(realm, sourcehost, host, dirman_passwd, nolookup=False):
 servers = get_ruv(realm, sourcehost, dirman_passwd, nolookup)
 except (NoRUVsFound, RuntimeError) as e:
 print(e)
-sys.exit(0 if isinstance(e, NoRUVsFound) else 1)
+if isinstance(e, RuntimeError):
+sys.exit(1)
+else:
+return None
 for (netloc, rid) in servers:
 if '%s:389' % host == netloc:
 return int(rid)
@@ -962,10 +965,6 @@ def del_master_managed(realm, hostname, options):
 #And pick new CA master.
 ensure_last_services(api.Backend.ldap2, hostname, masters, options)
 
-# Save the RID value before we start deleting
-rid = get_rid_by_host(realm, options.host, hostname,
-  options.dirman_passwd, options.nolookup)
-
 # 5. Remove master entry. Topology plugin will remove replication agreements.
 try:
 api.Command.server_del(hostname_u)
-- 
2.5.5

-- 
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