Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idempotency for Audit Configuration is not working #288

Open
Warkdev opened this issue Nov 6, 2020 · 0 comments
Open

Idempotency for Audit Configuration is not working #288

Warkdev opened this issue Nov 6, 2020 · 0 comments

Comments

@Warkdev
Copy link

Warkdev commented Nov 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant