Skip to content

Idempotency for Audit Configuration is not working #288

@Warkdev

Description

@Warkdev

Hello,

The idempotency of this API call is not working properly: https://github.com/IBM-Security/ibmsecurity/blob/master/ibmsecurity/isam/base/audit_configuration.py

The issue being that the json_compare is often providing back false due to the misalignment between the config lists.

To solve this problem, the following _check method does the sorting:

  1. At the top, add:
from operator import itemgetter
  1. In the check method, replace:
        "config": config,

by

        "config": sorted(config, key=itemgetter('key'))
  1. And add it as well later in the retrieved config:
aud_cfg['config'] = sorted(aud_cfg['config'], key=itemgetter('key'))

These changes will make sure that both lists are sorted on the 'key' element prior comparing them.

Cédric Servais

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions