From ef324a7f13887c581d74d4c09c8436af8523c635 Mon Sep 17 00:00:00 2001 From: German Parente Date: Mon, 1 Oct 2018 17:39:20 +0200 Subject: [PATCH] ipa-replica-manage: remove "last init status" if it's None. we remove the "last init status" section in the output of ipa-replica-manage to avoid confusion and show epoch date when status is None Fixes: https://pagure.io/freeipa/issue/7716 Signed-off-by: German Parente Reviewed-By: Rob Crittenden Reviewed-By: Francois Cami Reviewed-By: Florence Blanc-Renaud --- install/tools/ipa-csreplica-manage.in | 12 +++++++----- install/tools/ipa-replica-manage.in | 11 +++++++---- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/install/tools/ipa-csreplica-manage.in b/install/tools/ipa-csreplica-manage.in index 716e3434b..0822deb15 100644 --- a/install/tools/ipa-csreplica-manage.in +++ b/install/tools/ipa-csreplica-manage.in @@ -134,17 +134,19 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose): print('%s' % entry.single_value.get('nsds5replicahost')) if verbose: - print(" last init status: %s" % entry.single_value.get( - 'nsds5replicalastinitstatus')) - print(" last init ended: %s" % str( - ipautil.parse_generalized_time( - entry.single_value['nsds5replicalastinitend']))) + initstatus = entry.single_value.get('nsds5replicalastinitstatus') + if initstatus is not None: + print(" last init status: %s" % initstatus) + print(" last init ended: %s" % str( + ipautil.parse_generalized_time( + entry.single_value['nsds5replicalastinitend']))) print(" last update status: %s" % entry.single_value.get( 'nsds5replicalastupdatestatus')) print(" last update ended: %s" % str( ipautil.parse_generalized_time( entry.single_value['nsds5replicalastupdateend']))) + def del_link(realm, replica1, replica2, dirman_passwd, force=False): repl2 = None diff --git a/install/tools/ipa-replica-manage.in b/install/tools/ipa-replica-manage.in index 176ab0742..a289b5fb9 100644 --- a/install/tools/ipa-replica-manage.in +++ b/install/tools/ipa-replica-manage.in @@ -236,16 +236,19 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose, nolookup=False): print('%s: %s' % (entry.single_value.get('nsds5replicahost'), ent_type)) if verbose: - print(" last init status: %s" % entry.single_value.get( - 'nsds5replicalastinitstatus')) - print(" last init ended: %s" % str(ipautil.parse_generalized_time( - entry.single_value['nsds5replicalastinitend']))) + initstatus = entry.single_value.get('nsds5replicalastinitstatus') + if initstatus is not None: + print(" last init status: %s" % initstatus) + print(" last init ended: %s" % str( + ipautil.parse_generalized_time( + entry.single_value['nsds5replicalastinitend']))) print(" last update status: %s" % entry.single_value.get( 'nsds5replicalastupdatestatus')) print(" last update ended: %s" % str( ipautil.parse_generalized_time( entry.single_value['nsds5replicalastupdateend']))) + def del_link(realm, replica1, replica2, dirman_passwd, force=False): """ Delete a replication agreement from host A to host B.