summaryrefslogtreecommitdiffstats
path: root/install
diff options
context:
space:
mode:
authorPetr Viktorin <pviktori@redhat.com>2013-01-21 07:40:42 -0500
committerMartin Kosek <mkosek@redhat.com>2013-03-01 16:59:45 +0100
commitf5c404c65d81d9a28f171fabe7c5749d6c37f102 (patch)
tree2144594e18108034898baf93780e37eb8bbe6027 /install
parent66eaf1220da3e3fccd54b8f6a54f7d116818b024 (diff)
downloadfreeipa-f5c404c65d81d9a28f171fabe7c5749d6c37f102.tar.gz
freeipa-f5c404c65d81d9a28f171fabe7c5749d6c37f102.tar.xz
freeipa-f5c404c65d81d9a28f171fabe7c5749d6c37f102.zip
Replace entry.getValue by entry.single_value
Part of the work for: https://fedorahosted.org/freeipa/ticket/2660
Diffstat (limited to 'install')
-rwxr-xr-xinstall/tools/ipa-csreplica-manage26
-rwxr-xr-xinstall/tools/ipa-managed-entries4
-rwxr-xr-xinstall/tools/ipa-replica-manage38
3 files changed, 40 insertions, 28 deletions
diff --git a/install/tools/ipa-csreplica-manage b/install/tools/ipa-csreplica-manage
index db368c6fa..997bbc4e4 100755
--- a/install/tools/ipa-csreplica-manage
+++ b/install/tools/ipa-csreplica-manage
@@ -217,9 +217,9 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose):
try:
cadn = DN(('cn', 'CA'), DN(ent.dn))
entry = conn.getEntry(cadn, ldap.SCOPE_BASE)
- peers[ent.getValue('cn')] = ['master', '']
+ peers[ent.single_value('cn')] = ['master', '']
except errors.NotFound:
- peers[ent.getValue('cn')] = ['CA not configured', '']
+ peers[ent.single_value('cn')] = ['CA not configured', '']
except Exception, e:
sys.exit("Failed to get data from '%s' while trying to list replicas: %s" % (host, convert_error(e)))
@@ -235,13 +235,19 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose):
entries = repl.find_replication_agreements()
for entry in entries:
- print '%s' % entry.getValue('nsds5replicahost')
+ print '%s' % entry.single_value('nsds5replicahost', None)
if verbose:
- print " last init status: %s" % entry.getValue('nsds5replicalastinitstatus')
- print " last init ended: %s" % str(ipautil.parse_generalized_time(entry.getValue('nsds5replicalastinitend')))
- print " last update status: %s" % entry.getValue('nsds5replicalastupdatestatus')
- print " last update ended: %s" % str(ipautil.parse_generalized_time(entry.getValue('nsds5replicalastupdateend')))
+ print " last init status: %s" % entry.single_value(
+ 'nsds5replicalastinitstatus', None)
+ print " last init ended: %s" % str(
+ ipautil.parse_generalized_time(
+ entry.single_value('nsds5replicalastinitend')))
+ print " last update status: %s" % entry.single_value(
+ 'nsds5replicalastupdatestatus', None)
+ print " last update ended: %s" % str(
+ ipautil.parse_generalized_time(
+ entry.single_value('nsds5replicalastupdateend')))
def del_link(realm, replica1, replica2, dirman_passwd, force=False):
@@ -257,7 +263,7 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
# Find the DN of the replication agreement to remove
replica1_dn = None
for e in repl_list1:
- if e.getValue('nsDS5ReplicaHost') == replica2:
+ if e.single_value('nsDS5ReplicaHost', None) == replica2:
replica1_dn = e.dn
break
@@ -293,7 +299,7 @@ def del_link(realm, replica1, replica2, dirman_passwd, force=False):
# Find the DN of the replication agreement to remove
replica2_dn = None
for e in repl_list:
- if e.getValue('nsDS5ReplicaHost') == replica1:
+ if e.single_value('nsDS5ReplicaHost', None) == replica1:
replica2_dn = e.dn
break
@@ -401,7 +407,7 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
repl1 = get_cs_replication_manager(realm, replica1, dirman_passwd)
entries = repl1.find_replication_agreements()
for e in entries:
- if e.getValue('nsDS5ReplicaHost') == replica2:
+ if e.single_value('nsDS5ReplicaHost', None) == replica2:
sys.exit('This replication agreement already exists.')
repl1.hostnames = [replica1, replica2]
diff --git a/install/tools/ipa-managed-entries b/install/tools/ipa-managed-entries
index 186a816ac..5b56c5589 100755
--- a/install/tools/ipa-managed-entries
+++ b/install/tools/ipa-managed-entries
@@ -129,7 +129,7 @@ def main():
except Exception, e:
root_logger.debug("Search for managed entries failed: %s" % str(e))
sys.exit("Unable to find managed entries at %s" % managed_entry_definitions_dn)
- managed_entries = [entry.getValue('cn') for entry in entries]
+ managed_entries = [entry.single_value('cn') for entry in entries]
if managed_entries:
print "Available Managed Entry Definitions:"
for managed_entry in managed_entries:
@@ -151,7 +151,7 @@ def main():
)
disable_attr = '(objectclass=disable)'
try:
- org_filter = entry.getValue('originfilter')
+ org_filter = entry.single_value('originfilter', None)
disabled = re.search(r'%s' % disable_attr, org_filter)
except KeyError:
sys.exit("%s is not a valid Managed Entry" % def_dn)
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 85535c0e6..61b870873 100755
--- a/install/tools/ipa-replica-manage
+++ b/install/tools/ipa-replica-manage
@@ -162,7 +162,7 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose):
return
else:
for ent in entries:
- peers[ent.getValue('cn')] = ['master', '']
+ peers[ent.single_value('cn')] = ['master', '']
dn = DN(('cn', 'replicas'), ('cn', 'ipa'), ('cn', 'etc'), ipautil.realm_to_suffix(realm))
try:
@@ -171,7 +171,8 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose):
pass
else:
for ent in entries:
- peers[ent.getValue('cn')] = ent.getValue('ipaConfigString').split(':')
+ config_string = ent.single_value('ipaConfigString')
+ peers[ent.single_value('cn')] = config_string.split(':')
if not replica:
for k, p in peers.iteritems():
@@ -207,13 +208,18 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose):
return
for entry in entries:
- print '%s: %s' % (entry.getValue('nsds5replicahost'), ent_type)
+ print '%s: %s' % (entry.single_value('nsds5replicahost', None), ent_type)
if verbose:
- print " last init status: %s" % entry.getValue('nsds5replicalastinitstatus')
- print " last init ended: %s" % str(ipautil.parse_generalized_time(entry.getValue('nsds5replicalastinitend')))
- print " last update status: %s" % entry.getValue('nsds5replicalastupdatestatus')
- print " last update ended: %s" % str(ipautil.parse_generalized_time(entry.getValue('nsds5replicalastupdateend')))
+ print " last init status: %s" % entry.single_value(
+ 'nsds5replicalastinitstatus', None)
+ print " last init ended: %s" % str(ipautil.parse_generalized_time(
+ entry.single_value('nsds5replicalastinitend')))
+ print " last update status: %s" % entry.single_value(
+ 'nsds5replicalastupdatestatus', None)
+ print " last update ended: %s" % str(
+ ipautil.parse_generalized_time(
+ entry.single_value('nsds5replicalastupdateend')))
def del_link(realm, replica1, replica2, dirman_passwd, force=False):
"""
@@ -455,12 +461,12 @@ def list_clean_ruv(realm, host, dirman_passwd, verbose):
else:
print "CLEANALLRUV tasks"
for entry in entries:
- name = entry.getValue('cn').replace('clean ', '')
- status = entry.getValue('nsTaskStatus')
+ name = entry.single_value('cn').replace('clean ', '')
+ status = entry.single_value('nsTaskStatus', None)
print "RID %s: %s" % (name, status)
if verbose:
print str(dn)
- print entry.getValue('nstasklog')
+ print entry.single_value('nstasklog', None)
print
@@ -472,12 +478,12 @@ def list_clean_ruv(realm, host, dirman_passwd, verbose):
else:
print "Abort CLEANALLRUV tasks"
for entry in entries:
- name = entry.getValue('cn').replace('abort ', '')
- status = entry.getValue('nsTaskStatus')
+ name = entry.single_value('cn').replace('abort ', '')
+ status = entry.single_value('nsTaskStatus', None)
print "RID %s: %s" % (name, status)
if verbose:
print str(dn)
- print entry.getValue('nstasklog')
+ print entry.single_value('nstasklog', None)
def check_last_link(delrepl, realm, dirman_passwd, force):
"""
@@ -583,7 +589,7 @@ def del_master(realm, hostname, options):
entries = thisrepl.conn.getList(dn, ldap.SCOPE_ONELEVEL)
replica_names = []
for entry in entries:
- replica_names.append(entry.getValue('cn'))
+ replica_names.append(entry.single_value('cn'))
# The host we're removing gets included in this list, remove it.
# Otherwise we try to delete an agreement from the host to itself.
try:
@@ -715,7 +721,7 @@ def add_link(realm, replica1, replica2, dirman_passwd, options):
if repl.get_agreement_type(replica2) == replication.WINSYNC:
agreement = repl.get_replication_agreement(replica2)
sys.exit("winsync agreement already exists on subtree %s" %
- agreement.getValue('nsds7WindowsReplicaSubtree'))
+ agreement.single_value('nsds7WindowsReplicaSubtree', None))
else:
sys.exit("A replication agreement to %s already exists" % replica2)
except errors.NotFound:
@@ -808,7 +814,7 @@ def re_initialize(realm, thishost, fromhost, dirman_passwd):
# If the agreement doesn't have nsDS5ReplicatedAttributeListTotal it means
# we did not replicate memberOf, do so now.
- if not agreement.getValue('nsDS5ReplicatedAttributeListTotal'):
+ if not agreement.single_value('nsDS5ReplicatedAttributeListTotal', None):
ds = dsinstance.DsInstance(realm_name = realm, dm_password = dirman_passwd)
ds.init_memberof()