Re: [Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-16 Thread Rob Crittenden

Tomas Babej wrote:

On 04/15/2013 11:58 PM, Rob Crittenden wrote:

Tomas Babej wrote:

On 04/09/2013 11:47 PM, Rob Crittenden wrote:

Tomas Babej wrote:

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas


This will still do some work against a winsync agreement. Do we need
to do that at all? I'm not sure we do.

rob


I removed the nsds5replicahost attribute update for winsync agreements
after discussion.

Updated patch attached.

Tomas


This looks ok. The backup/restore patch added two more calls to
find_ipa_replication_agreements so a rebase is needed. I think these
are the required changes:

diff --git a/ipaserver/install/ipa_restore.py
b/ipaserver/install/ipa_restore.py
index 04d4210..760da0b 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -373,7 +373,10 @@ class Restore(admintool.AdminTool):

 services_cns = [s.single_value('cn') for s in services]

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
+
 for host in hosts:
 self.log.info('Disabling replication agreement on %s
to %s' % (
master, host))
 repl.disable_agreement(host)
@@ -385,7 +388,9 @@ class Restore(admintool.AdminTool):
 except Exception, e:
 self.log.critical("Unable to disable agreement on
%s: %s" %
 (master, e))

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
 for host in hosts:
 self.log.info('Disabling CA replication agreement
on %s to
%s' % (master, host))
 repl.hostnames = [master, host]



I added the calls and rebased the patch. I also found one missed call in
ipa-replica-csmanage.

Updated patch attached.


ACK, pushed to master

rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-16 Thread Tomas Babej

On 04/15/2013 11:58 PM, Rob Crittenden wrote:

Tomas Babej wrote:

On 04/09/2013 11:47 PM, Rob Crittenden wrote:

Tomas Babej wrote:

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas


This will still do some work against a winsync agreement. Do we need
to do that at all? I'm not sure we do.

rob


I removed the nsds5replicahost attribute update for winsync agreements
after discussion.

Updated patch attached.

Tomas


This looks ok. The backup/restore patch added two more calls to 
find_ipa_replication_agreements so a rebase is needed. I think these 
are the required changes:


diff --git a/ipaserver/install/ipa_restore.py 
b/ipaserver/install/ipa_restore.py

index 04d4210..760da0b 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -373,7 +373,10 @@ class Restore(admintool.AdminTool):

 services_cns = [s.single_value('cn') for s in services]

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
+
 for host in hosts:
 self.log.info('Disabling replication agreement on %s 
to %s' % (

master, host))
 repl.disable_agreement(host)
@@ -385,7 +388,9 @@ class Restore(admintool.AdminTool):
 except Exception, e:
 self.log.critical("Unable to disable agreement on 
%s: %s" %

 (master, e))

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
 for host in hosts:
 self.log.info('Disabling CA replication agreement 
on %s to

%s' % (master, host))
 repl.hostnames = [master, host]


I added the calls and rebased the patch. I also found one missed call in 
ipa-replica-csmanage.


Updated patch attached.
>From ae0bddafc68b5a8ed501eaa36042aadabdd5ad16 Mon Sep 17 00:00:00 2001
From: Tomas Babej 
Date: Mon, 8 Apr 2013 14:09:16 +0200
Subject: [PATCH] Update only selected attributes for winsync agreement

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

https://fedorahosted.org/freeipa/ticket/3522
---
 install/tools/ipa-csreplica-manage  |  4 +++-
 install/tools/ipa-replica-manage| 15 ---
 ipaserver/install/ipa_restore.py|  9 +++--
 ipaserver/install/plugins/fix_replica_agreements.py | 13 +
 ipaserver/install/replication.py|  9 ++---
 5 files changed, 33 insertions(+), 17 deletions(-)

diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage
index d70f24e26ef74e965299a172722c80385f70c8e0..4e11ffdefd5c38fc1ab090f38472e3675b700e54 100755
--- a/install/tools/ipa-csreplica-manage
+++ b/install/tools/ipa-csreplica-manage
@@ -262,7 +262,9 @@ def del_master(realm, hostname, options):
 # server not up, just remove it from this server
 replica_names = [options.host]
 else:
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 
 # 5. Remove each agreement
 for r in replica_names:
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 8ab4dc5474752713c7cf9c089e2439a30d8d917e..ecb263813a5ce0e6d5a1e2033e16494a6bc7ce09 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -518,7 +518,10 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
 
 returns: hostname of orphaned server or None
 """
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 
 orphaned = []
 # Connect to each remote server and see what agreements it has
@@ -531,7 +534,11 @@ def check_last_link(delrep

Re: [Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-15 Thread Rob Crittenden

Tomas Babej wrote:

On 04/09/2013 11:47 PM, Rob Crittenden wrote:

Tomas Babej wrote:

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas


This will still do some work against a winsync agreement. Do we need
to do that at all? I'm not sure we do.

rob


I removed the nsds5replicahost attribute update for winsync agreements
after discussion.

Updated patch attached.

Tomas


This looks ok. The backup/restore patch added two more calls to 
find_ipa_replication_agreements so a rebase is needed. I think these are 
the required changes:


diff --git a/ipaserver/install/ipa_restore.py 
b/ipaserver/install/ipa_restore.py

index 04d4210..760da0b 100644
--- a/ipaserver/install/ipa_restore.py
+++ b/ipaserver/install/ipa_restore.py
@@ -373,7 +373,10 @@ class Restore(admintool.AdminTool):

 services_cns = [s.single_value('cn') for s in services]

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
+
 for host in hosts:
 self.log.info('Disabling replication agreement on %s 
to %s' % (

master, host))
 repl.disable_agreement(host)
@@ -385,7 +388,9 @@ class Restore(admintool.AdminTool):
 except Exception, e:
 self.log.critical("Unable to disable agreement on 
%s: %s" %

 (master, e))

-hosts = repl.find_ipa_replication_agreements()
+host_entries = repl.find_ipa_replication_agreements()
+hosts = [rep.single_value('nsds5replicahost', None)
+ for rep in host_entries]
 for host in hosts:
 self.log.info('Disabling CA replication agreement 
on %s to

%s' % (master, host))
 repl.hostnames = [master, host]


___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-10 Thread Tomas Babej

On 04/09/2013 11:47 PM, Rob Crittenden wrote:

Tomas Babej wrote:

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas


This will still do some work against a winsync agreement. Do we need 
to do that at all? I'm not sure we do.


rob

I removed the nsds5replicahost attribute update for winsync agreements 
after discussion.


Updated patch attached.

Tomas
>From 5ed9120a75c70bff792501f1d2d4e166d8357f54 Mon Sep 17 00:00:00 2001
From: Tomas Babej 
Date: Mon, 8 Apr 2013 14:09:16 +0200
Subject: [PATCH] Update only selected attributes for winsync agreement

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

https://fedorahosted.org/freeipa/ticket/3522
---
 install/tools/ipa-replica-manage| 15 ---
 ipaserver/install/plugins/fix_replica_agreements.py | 11 ---
 ipaserver/install/replication.py|  9 ++---
 3 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 636529caaeca222c09d94d3e5539002fcd3139a9..b6261f0c5b34ba26da705d051b600c3e43ed1f44 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -518,7 +518,10 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
 
 returns: hostname of orphaned server or None
 """
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 
 orphaned = []
 # Connect to each remote server and see what agreements it has
@@ -531,7 +534,11 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
 if not force and not ipautil.user_input("Continue to delete?", False):
 sys.exit("Aborted")
 continue
-names = repl.find_ipa_replication_agreements()
+
+entries = repl.find_ipa_replication_agreements()
+names = [rep.single_value('nsds5replicahost', None)
+ for rep in entries]
+
 if len(names) == 1 and names[0] == delrepl.hostname:
 orphaned.append(replica)
 
@@ -611,7 +618,9 @@ def del_master(realm, hostname, options):
 pass
 else:
 # Get list of agreements.
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 else:
 # WINSYNC replica, delete agreement from current host
 winsync = True
diff --git a/ipaserver/install/plugins/fix_replica_agreements.py b/ipaserver/install/plugins/fix_replica_agreements.py
index 472e50217e36152ee04133b11db19ee435efd4ba..3ca24936d63556d4b1287382bc0f870aa62dee1b 100644
--- a/ipaserver/install/plugins/fix_replica_agreements.py
+++ b/ipaserver/install/plugins/fix_replica_agreements.py
@@ -44,9 +44,13 @@ class update_replica_attribute_lists(PreUpdate):
 
 repl = replication.ReplicationManager(api.env.realm, api.env.host,
   None, conn=conn)
-entries = repl.find_replication_agreements()
-self.log.debug("Found %d agreement(s)", len(entries))
-for replica in entries:
+
+# We need to update only IPA replica agreements, not winsync
+ipa_replicas = repl.find_ipa_replication_agreements()
+
+self.log.debug("Found %d agreement(s)", len(ipa_replicas))
+
+for replica in ipa_replicas:
 self.log.debug(replica.single_value('description', None))
 
 self._update_attr(repl, replica,
@@ -58,6 +62,7 @@ class update_replica_attribute_lists(PreUpdate):
 self._update_attr(repl, replica,
 'nsds5ReplicaStripAttrs', replication.STRIP_ATTRS)
 
+
 self.log.debug("Done updating agreements")
 
 return (False, False, [])  # No restart, no apply now, no updates
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index c1ca0aaa6e8217d66b3b5044b0103c755df6bfe5..adb26a83628c7a3a15412432407c03d4f825bc07 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/rep

Re: [Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-09 Thread Rob Crittenden

Tomas Babej wrote:

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas


This will still do some work against a winsync agreement. Do we need to 
do that at all? I'm not sure we do.


rob

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH 0044] Update only selected attributes for winsync agreement

2013-04-08 Thread Tomas Babej

Hi,

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

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

Tomas
>From 9fb51e0167fe99186d5404490770ed5b8f3cfe2b Mon Sep 17 00:00:00 2001
From: Tomas Babej 
Date: Mon, 8 Apr 2013 14:09:16 +0200
Subject: [PATCH] Update only selected attributes for winsync agreement

Trying to insert nsDS5ReplicatedAttributeListTotal and
nsds5ReplicaStripAttrs to winsync agreements caused upgrade errors.
With this patch, these attributes are skipped for winsync agreements.

Made find_ipa_replication_agreements() in replication.py more
corresponding to find_replication_agreements. It returns list of
entries instead of unicode strings now.

https://fedorahosted.org/freeipa/ticket/3522
---
 install/tools/ipa-replica-manage| 15 ---
 ipaserver/install/plugins/fix_replica_agreements.py | 15 ---
 ipaserver/install/replication.py|  9 ++---
 3 files changed, 26 insertions(+), 13 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 636529caaeca222c09d94d3e5539002fcd3139a9..b6261f0c5b34ba26da705d051b600c3e43ed1f44 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -518,7 +518,10 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
 
 returns: hostname of orphaned server or None
 """
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 
 orphaned = []
 # Connect to each remote server and see what agreements it has
@@ -531,7 +534,11 @@ def check_last_link(delrepl, realm, dirman_passwd, force):
 if not force and not ipautil.user_input("Continue to delete?", False):
 sys.exit("Aborted")
 continue
-names = repl.find_ipa_replication_agreements()
+
+entries = repl.find_ipa_replication_agreements()
+names = [rep.single_value('nsds5replicahost', None)
+ for rep in entries]
+
 if len(names) == 1 and names[0] == delrepl.hostname:
 orphaned.append(replica)
 
@@ -611,7 +618,9 @@ def del_master(realm, hostname, options):
 pass
 else:
 # Get list of agreements.
-replica_names = delrepl.find_ipa_replication_agreements()
+replica_entries = delrepl.find_ipa_replication_agreements()
+replica_names = [rep.single_value('nsds5replicahost', None)
+ for rep in replica_entries]
 else:
 # WINSYNC replica, delete agreement from current host
 winsync = True
diff --git a/ipaserver/install/plugins/fix_replica_agreements.py b/ipaserver/install/plugins/fix_replica_agreements.py
index 472e50217e36152ee04133b11db19ee435efd4ba..7ad5081742eb28d41be9f7f0b7700ef27abcf96b 100644
--- a/ipaserver/install/plugins/fix_replica_agreements.py
+++ b/ipaserver/install/plugins/fix_replica_agreements.py
@@ -44,20 +44,29 @@ class update_replica_attribute_lists(PreUpdate):
 
 repl = replication.ReplicationManager(api.env.realm, api.env.host,
   None, conn=conn)
-entries = repl.find_replication_agreements()
-self.log.debug("Found %d agreement(s)", len(entries))
-for replica in entries:
+
+replicas = repl.find_replication_agreements()
+ipa_replicas = repl.find_ipa_replication_agreements()
+
+self.log.debug("Found %d agreement(s)", len(replicas))
+
+for replica in replicas:
 self.log.debug(replica.single_value('description', None))
 
 self._update_attr(repl, replica,
 'nsDS5ReplicatedAttributeList',
 replication.EXCLUDES, template=EXCLUDE_TEMPLATE)
+
+for replica in ipa_replicas:
+self.log.debug(replica.single_value('description', None))
+
 self._update_attr(repl, replica,
 'nsDS5ReplicatedAttributeListTotal',
 replication.TOTAL_EXCLUDES, template=EXCLUDE_TEMPLATE)
 self._update_attr(repl, replica,
 'nsds5ReplicaStripAttrs', replication.STRIP_ATTRS)
 
+
 self.log.debug("Done updating agreements")
 
 return (False, False, [])  # No restart, no apply now, no updates
diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index c1ca0aaa6e8217d66b3b5044b0103c755df6bfe5..adb26a83628c7a3a15412432407c03d4f825bc07 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/inst