This is an automated email from the git hooks/post-receive script.
spichugi pushed a commit to branch master
in repository lib389.
commit b732af977effe03089b2ab4bbe33fe1af1d8a1c8
Author: Simon Pichugin <spichugi(a)redhat.com>
Date: Tue Aug 15 10:06:13 2017 +0200
Issue 85 - Remove legacy replication attribute
Bug description: In 389-ds all references to legacy replication
has been removed (except in schema). But if in lib389 a replica
is created it always sets nsds5ReplicaLegacyConsumer: off.
This is no longer needed and confusing.
Fix description: Remove the properties related to legacy
replication attribute. Fix basedn of Replicas object.
Fix replicaLegacy tests.
Reviewed by: mreynolds (Thanks!)
https://pagure.io/lib389/issue/85
---
lib389/properties.py | 3 ---
lib389/replica.py | 13 +++----------
lib389/tests/replicaLegacy_test.py | 10 ++++------
3 files changed, 7 insertions(+), 19 deletions(-)
diff --git a/lib389/properties.py b/lib389/properties.py
index 99d0e13..2a9e174 100644
--- a/lib389/properties.py
+++ b/lib389/properties.py
@@ -161,7 +161,6 @@ REPL_BIND_GROUP = 'nsds5replicabinddngroup'
REPL_BIND_GROUP_INTERVAL = 'nsds5replicabinddngroupcheckinterval'
REPL_REF = 'nsds5ReplicaReferral'
REPL_TOMBSTONE_PURGE_INTERVAL = 'nsds5ReplicaTombstonePurgeInterval'
-REPL_LEGACY_CONS = 'nsds5ReplicaLegacyConsumer'
REPL_CLEAN_RUV = 'nsds5ReplicaCleanRUV'
REPL_ABORT_RUV = 'nsds5ReplicaAbortCleanRUV'
REPL_COUNT_COUNT = 'nsds5ReplicaChangeCount'
@@ -170,7 +169,6 @@ REPL_RELEASE_TIMEOUT = 'nsds5replicaReleaseTimeout'
# The values are from the REST API
REPLICA_SUFFIX = 'suffix'
-REPLICA_LEGACY_CONS = 'ReplicaLegacyConsumer'
REPLICA_PURGE_DELAY = 'ReplicaPurgeDelay'
REPLICA_ROOT = 'ReplicaRoot'
REPLICA_PROTOCOL_TIMEOUT = 'ReplicaProtocolTimeout'
@@ -198,7 +196,6 @@ REPLICA_PROPNAME_TO_ATTRNAME = {REPLICA_SUFFIX: REPL_ROOT,
REPLICA_ROOT: REPL_ROOT,
REPLICA_ID: REPL_ID,
REPLICA_TYPE: REPL_TYPE,
- REPLICA_LEGACY_CONS: REPL_LEGACY_CONS,
REPLICA_PURGE_INTERVAL:
REPL_TOMBSTONE_PURGE_INTERVAL,
REPLICA_PURGE_DELAY: REPL_PURGE_DELAY,
diff --git a/lib389/replica.py b/lib389/replica.py
index a028396..6d24a7a 100644
--- a/lib389/replica.py
+++ b/lib389/replica.py
@@ -174,7 +174,6 @@ class ReplicaLegacy(object):
REPLICA_SUFFIX
REPLICA_ID
REPLICA_TYPE
- REPLICA_LEGACY_CONS
REPLICA_BINDDN
REPLICA_PURGE_DELAY
REPLICA_PRECISE_PURGING
@@ -300,7 +299,6 @@ class ReplicaLegacy(object):
REPLICA_SUFFIX
REPLICA_ID
REPLICA_TYPE
- REPLICA_LEGACY_CONS ['off']
REPLICA_BINDDN [defaultProperties[REPLICATION_BIND_DN]]
REPLICA_PURGE_DELAY
REPLICA_PRECISE_PURGING
@@ -359,7 +357,6 @@ class ReplicaLegacy(object):
properties[prop] = args[prop]
# Now set default values of unset properties
- ReplicaLegacy._set_or_default(REPLICA_LEGACY_CONS, properties, 'off')
ReplicaLegacy._set_or_default(REPLICA_BINDDN, properties,
[defaultProperties[REPLICATION_BIND_DN]])
@@ -806,7 +803,7 @@ class Replica(DSLdapObject):
super(Replica, self).__init__(instance, dn, batch)
self._rdn_attribute = 'cn'
- self._must_attributes = ['cn', REPL_LEGACY_CONS, REPL_TYPE,
+ self._must_attributes = ['cn', REPL_TYPE,
REPL_ROOT, REPL_BINDDN, REPL_ID]
self._create_objectclasses = ['top', 'extensibleObject',
@@ -1259,7 +1256,7 @@ class Replicas(DSLdapObjects):
rtype = REPLICA_RDONLY_TYPE
# Set the properties provided as mandatory parameter
- properties = {'cn': RDN_REPLICA,
+ properties = {'cn': 'replica',
REPL_ROOT: suffix,
REPL_ID: str(replicaID),
REPL_TYPE: str(rtype)}
@@ -1271,10 +1268,6 @@ class Replicas(DSLdapObjects):
raise ValueError("unknown property: %s" % prop)
properties[prop] = args[prop]
- # Now set default values of unset properties
- if REPLICA_LEGACY_CONS not in properties:
- properties[REPL_LEGACY_CONS] = 'off'
-
# Set flags explicitly, so it will be more readable
if role == ReplicaRole.CONSUMER:
properties[REPL_FLAGS] = str(REPLICA_FLAGS_RDONLY)
@@ -1310,7 +1303,7 @@ class Replicas(DSLdapObjects):
# Now create the replica entry
mtents = self._instance.mappingtree.list(suffix=suffix)
- suffix_dn = mtents[0].dn
+ self._basedn = mtents[0].dn
replica = self.create(RDN_REPLICA, properties)
replica._suffix = suffix
diff --git a/lib389/tests/replicaLegacy_test.py b/lib389/tests/replicaLegacy_test.py
index 670b81d..72bd338 100644
--- a/lib389/tests/replicaLegacy_test.py
+++ b/lib389/tests/replicaLegacy_test.py
@@ -399,8 +399,7 @@ def test_setProperties(topology):
log.info("\n\n##########\n### SETPROPERTIES\n############")
# set valid values to SUFFIX_1
- properties = {REPLICA_LEGACY_CONS: 'off',
- REPLICA_BINDDN: NEW_RM_1,
+ properties = {REPLICA_BINDDN: NEW_RM_1,
REPLICA_PURGE_INTERVAL: str(3600),
REPLICA_PURGE_DELAY: str(5 * 24 * 3600),
REPLICA_REFERRAL: "ldap://%s:1234/" % LOCALHOST}
@@ -425,20 +424,20 @@ def test_setProperties(topology):
# check call without suffix/dn/entry raise InvalidArgumentError
with pytest.raises(InvalidArgumentError) as excinfo:
- properties = {REPLICA_LEGACY_CONS: 'off'}
+ properties = {REPLICA_BINDDN: NEW_RM_1}
topology.master.replica.setProperties(properties=properties)
log.info("Exception (expected): %s" % str(excinfo.value))
# check that if we do not provide a valid entry it raises ValueError
with pytest.raises(ValueError) as excinfo:
- properties = {REPLICA_LEGACY_CONS: 'off'}
+ properties = {REPLICA_BINDDN: NEW_RM_1}
topology.master.replica.setProperties(replica_entry="dummy",
properties=properties)
log.info("Exception (expected): %s" % str(excinfo.value))
# check that with an invalid suffix or replica_dn it raise ValueError
with pytest.raises(ValueError) as excinfo:
- properties = {REPLICA_LEGACY_CONS: 'off'}
+ properties = {REPLICA_BINDDN: NEW_RM_1}
topology.master.replica.setProperties(suffix="dummy",
properties=properties)
log.info("Exception (expected): %s" % str(excinfo.value))
@@ -449,7 +448,6 @@ def test_getProperties(topology):
log.info("\n\n############\n### GETPROPERTIES\n###########")
with pytest.raises(NotImplementedError) as excinfo:
- properties = {REPLICA_LEGACY_CONS: 'off'}
topology.master.replica.getProperties(suffix=NEW_SUFFIX_1)
log.info("Exception (expected): %s" % str(excinfo.value))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.