#7442 Replication agreement status incorrectly checked
Closed: fixed 5 years ago Opened 6 years ago by mreynolds.

Issue

The replication agreement update status message was changed a few releases ago (nsds5ReplicaLastUpdateStatus), and the following code does not work correctly (See "status" variable):

ipaserver/install/replication.py

943     def check_repl_update(self, conn, agmtdn):
944         done = False
945         hasError = 0
946         error_message = ''
947         attrlist = ['cn', 'nsds5replicaUpdateInProgress',
948                     'nsds5ReplicaLastUpdateStatus', 'nsds5ReplicaLastUpdateStart',
949                     'nsds5ReplicaLastUpdateEnd']
950         entry = conn.get_entry(agmtdn, attrlist)
951         if not entry:
952             print("Error reading status from agreement", agmtdn)
953             hasError = 1
954         else:
955             inprogress = entry.single_value.get('nsds5replicaUpdateInProgress')
956             status = entry.single_value.get('nsds5ReplicaLastUpdateStatus')
957             try:
958                 start = int(entry.single_value['nsds5ReplicaLastUpdateStart'])
959             except (ValueError, TypeError, KeyError):
960                 start = 0
961             try:
962                 end = int(entry.single_value['nsds5ReplicaLastUpdateEnd'])
963             except (ValueError, TypeError, KeyError):
964                 end = 0
965             # incremental update is done if inprogress is false and end >= start
966             done = inprogress and inprogress.lower() == 'false' and start <= end
967             logger.info("Replication Update in progress: %s: status: %s: "
968                         "start: %d: end: %d",
969                         inprogress, status, start, end)
970             if status: # always check for errors
971                 # status will usually be a number followed by a string
972                 # number != 0 means error
973                 rc, msg = status.split(' ', 1)
974                 if rc != '0':
975                     hasError = 1
976                     error_message = msg
977                     done = True

This code expects the update status massages to look like:

("%d %s", error_code, msg)

However this was changed a while ago to be:

("Error (%d) %s", error_code, msg)

@mreynolds which version of 389-ds did see the change? We need to understand what releases are affected.

This affects 389-ds-base-1.3.5 (RHEL 7.3) and up. So its been this way for awhile. I would of thought you would seen an issue with this by now , so maybe it's dead code?

While we do check the error code, we ignore it in upper level consumers (convert_to_gssapi_replicaiton and setup_winsync_replication). The only place where we do care about the message is in get_replica_principal_dns where we would eventually show an error message if any of the replication DNs wasn't synced.

I guess this is not really happening in majority of the cases.

We certainly can add support for both formats, no problem.

Metadata Update from @abbra:
- Issue assigned to abbra

6 years ago

master:

  • 1dbc6de replication: support error messages from 389-ds 1.3.5 or later

ipa-4-6:

  • 1f9320b replication: support error messages from 389-ds 1.3.5 or later

ipa-4-5:

  • a5d6af7 replication: support error messages from 389-ds 1.3.5 or later

Metadata Update from @cheimes:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

5 years ago

Login to comment on this ticket.

Metadata