Skip to content

Commit

Permalink
replication: support error messages from 389-ds 1.3.5 or later
Browse files Browse the repository at this point in the history
389-ds 1.3.5 changed the error message format for
nsds5ReplicaLastUpdateStatus value. Now it produces
"Error (%d) %s" instead of "%d %s".

Change the check_repl_update() to handle both formats.

Fixes: https://pagure.io/freeipa/issue/7442
Reviewed-By: Christian Heimes <cheimes@redhat.com>
  • Loading branch information
abbra authored and tiran committed Apr 17, 2018
1 parent 0925349 commit 1f9320b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ipaserver/install/replication.py
Expand Up @@ -18,6 +18,7 @@
#

from __future__ import print_function
from __future__ import absolute_import

import logging

Expand Down Expand Up @@ -981,7 +982,13 @@ def check_repl_update(self, conn, agmtdn):
if status: # always check for errors
# status will usually be a number followed by a string
# number != 0 means error
rc, msg = status.split(' ', 1)
# Since 389-ds-base 1.3.5 it is 'Error (%d) %s'
# so we need to remove a prefix string and parentheses
if status.startswith('Error '):
rc, msg = status[6:].split(' ', 1)
rc = rc.strip('()')
else:
rc, msg = status.split(' ', 1)
if rc != '0':
hasError = 1
error_message = msg
Expand Down

0 comments on commit 1f9320b

Please sign in to comment.