From bc3906f9aacb5081d0e50365eb64f3848ef490d4 Mon Sep 17 00:00:00 2001 From: François Cami Date: Mar 02 2021 10:48:59 +0000 Subject: ipa-replica-manage: handle missing attributes If nsds5replicalastupdateend is not yet present, ipa-replica-manage will backtrace as it tries to retrieve that attribute unconditionally. Gracefully handle that situation. Fixes: https://pagure.io/freeipa/issue/8605 Signed-off-by: François Cami Reviewed-By: Rob Crittenden Reviewed-By: Florence Blanc-Renaud --- diff --git a/install/tools/ipa-replica-manage.in b/install/tools/ipa-replica-manage.in index 1486ada..2a77a40 100644 --- a/install/tools/ipa-replica-manage.in +++ b/install/tools/ipa-replica-manage.in @@ -242,12 +242,18 @@ def list_replicas(realm, host, replica, dirman_passwd, verbose, nolookup=False): if initstatus is not None: 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']))) + entry.single_value['nsds5replicalastinitend'])) + ) + updatestatus = entry.single_value.get( + 'nsds5replicalastupdatestatus' + ) + print(" last update status: %s" % updatestatus) + if updatestatus is not 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):