From 3667197efb7b18ec842efd504785965911f8ac4b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 5 Jun 2024 18:18:34 +0200 Subject: Adding upstream version 10.0.0+dfsg. Signed-off-by: Daniel Baumann --- ansible_collections/ibm/qradar/.ansible-lint | 5 + .../ibm/qradar/.github/dependabot.yml | 10 + .../ibm/qradar/.github/release-drafter.yml | 3 + .../ibm/qradar/.github/workflows/ack.yml | 14 + .../ibm/qradar/.github/workflows/codecoverage.yml | 14 + .../ibm/qradar/.github/workflows/lint.yml | 13 + .../ibm/qradar/.github/workflows/push.yml | 26 + .../ibm/qradar/.github/workflows/release.yml | 13 + .../ibm/qradar/.github/workflows/test.yml | 41 -- .../ibm/qradar/.github/workflows/tests.yml | 40 ++ ansible_collections/ibm/qradar/.gitignore | 17 +- ansible_collections/ibm/qradar/.isort.cfg | 6 + .../ibm/qradar/.pre-commit-config.yaml | 38 +- ansible_collections/ibm/qradar/.prettierignore | 22 + ansible_collections/ibm/qradar/CHANGELOG.rst | 19 + ansible_collections/ibm/qradar/FILES.json | 614 ++++++++++++--------- ansible_collections/ibm/qradar/MANIFEST.json | 12 +- ansible_collections/ibm/qradar/README.md | 12 +- ansible_collections/ibm/qradar/bindep.txt | 2 - .../ibm/qradar/changelogs/changelog.yaml | 111 ++-- .../ibm/qradar/changelogs/config.yaml | 35 +- ansible_collections/ibm/qradar/codecov.yml | 15 + .../ibm.qradar.qradar_analytics_rules_module.rst | 4 +- ...qradar.qradar_log_sources_management_module.rst | 2 +- ansible_collections/ibm/qradar/meta/runtime.yml | 2 +- .../plugins/action/qradar_analytics_rules.py | 63 +-- .../action/qradar_log_sources_management.py | 81 +-- .../ibm/qradar/plugins/httpapi/qradar.py | 17 +- .../ibm/qradar/plugins/module_utils/qradar.py | 51 +- .../ibm/qradar/plugins/modules/deploy.py | 17 +- .../plugins/modules/log_source_management.py | 64 +-- .../ibm/qradar/plugins/modules/offense_action.py | 39 +- .../ibm/qradar/plugins/modules/offense_info.py | 28 +- .../ibm/qradar/plugins/modules/offense_note.py | 25 +- .../plugins/modules/qradar_analytics_rules.py | 6 +- .../ibm/qradar/plugins/modules/qradar_deploy.py | 17 +- .../modules/qradar_log_source_management.py | 64 +-- .../modules/qradar_log_sources_management.py | 3 +- .../plugins/modules/qradar_offense_action.py | 39 +- .../qradar/plugins/modules/qradar_offense_info.py | 28 +- .../qradar/plugins/modules/qradar_offense_note.py | 25 +- .../ibm/qradar/plugins/modules/qradar_rule.py | 59 +- .../ibm/qradar/plugins/modules/qradar_rule_info.py | 24 +- .../ibm/qradar/plugins/modules/rule.py | 59 +- .../ibm/qradar/plugins/modules/rule_info.py | 24 +- ansible_collections/ibm/qradar/pyproject.toml | 2 +- .../ibm/qradar/test-requirements.txt | 13 +- .../targets/log_source_management/tasks/main.yml | 40 +- .../integration/targets/offense/tasks/main.yml | 29 +- .../defaults/main.yaml | 2 +- .../qradar_log_sources_management/tasks/cli.yaml | 17 +- .../qradar_log_sources_management/tasks/main.yaml | 4 +- .../tasks/redirection.yaml | 8 +- .../tests/cli/_populate_log_sources_config.yaml | 18 +- .../tests/cli/_remove_log_sources_config.yaml | 4 +- .../tests/cli/deleted.yaml | 12 +- .../tests/cli/gathered.yaml | 12 +- .../tests/cli/merged.yaml | 28 +- .../tests/cli/replaced.yaml | 30 +- .../tests/cli/rtt.yaml | 41 +- .../qradar_log_sources_management/vars/main.yaml | 89 ++- .../tests/integration/targets/rule/tasks/main.yml | 40 +- .../ibm/qradar/tests/unit/compat/builtins.py | 34 -- .../ibm/qradar/tests/unit/compat/mock.py | 4 +- .../ibm/qradar/tests/unit/compat/unittest.py | 2 + .../ibm/qradar/tests/unit/mock/loader.py | 5 +- .../ibm/qradar/tests/unit/mock/path.py | 8 +- .../ibm/qradar/tests/unit/mock/procenv.py | 8 +- .../ibm/qradar/tests/unit/mock/vault_helper.py | 6 +- .../ibm/qradar/tests/unit/mock/yaml_helper.py | 38 +- .../plugins/action/test_qradar_analytics_rules.py | 37 +- .../qradar/tests/unit/plugins/modules/conftest.py | 18 +- .../ibm/qradar/tests/unit/plugins/modules/utils.py | 9 +- ansible_collections/ibm/qradar/tox.ini | 8 +- 74 files changed, 1307 insertions(+), 1082 deletions(-) create mode 100644 ansible_collections/ibm/qradar/.ansible-lint create mode 100644 ansible_collections/ibm/qradar/.github/dependabot.yml create mode 100644 ansible_collections/ibm/qradar/.github/release-drafter.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/ack.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/codecoverage.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/lint.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/push.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/release.yml delete mode 100644 ansible_collections/ibm/qradar/.github/workflows/test.yml create mode 100644 ansible_collections/ibm/qradar/.github/workflows/tests.yml create mode 100644 ansible_collections/ibm/qradar/.isort.cfg create mode 100644 ansible_collections/ibm/qradar/.prettierignore create mode 100644 ansible_collections/ibm/qradar/codecov.yml delete mode 100644 ansible_collections/ibm/qradar/tests/unit/compat/builtins.py (limited to 'ansible_collections/ibm') diff --git a/ansible_collections/ibm/qradar/.ansible-lint b/ansible_collections/ibm/qradar/.ansible-lint new file mode 100644 index 000000000..8d9bb70b8 --- /dev/null +++ b/ansible_collections/ibm/qradar/.ansible-lint @@ -0,0 +1,5 @@ +--- +profile: production + +exclude_paths: + - changelogs/changelog.yaml diff --git a/ansible_collections/ibm/qradar/.github/dependabot.yml b/ansible_collections/ibm/qradar/.github/dependabot.yml new file mode 100644 index 000000000..66f19d7e4 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/dependabot.yml @@ -0,0 +1,10 @@ +--- +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + open-pull-requests-limit: 3 + labels: + - skip-changelog diff --git a/ansible_collections/ibm/qradar/.github/release-drafter.yml b/ansible_collections/ibm/qradar/.github/release-drafter.yml new file mode 100644 index 000000000..e3e5966e4 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/release-drafter.yml @@ -0,0 +1,3 @@ +--- +# see https://github.com/ansible-community/devtools +_extends: ansible-community/devtools diff --git a/ansible_collections/ibm/qradar/.github/workflows/ack.yml b/ansible_collections/ibm/qradar/.github/workflows/ack.yml new file mode 100644 index 000000000..ef09fe3d0 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/ack.yml @@ -0,0 +1,14 @@ +--- +# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml +name: ack + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] +jobs: + ack: + uses: ansible/devtools/.github/workflows/ack.yml@main diff --git a/ansible_collections/ibm/qradar/.github/workflows/codecoverage.yml b/ansible_collections/ibm/qradar/.github/workflows/codecoverage.yml new file mode 100644 index 000000000..606180741 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/codecoverage.yml @@ -0,0 +1,14 @@ +--- +name: Code Coverage + +on: # yamllint disable-line rule:truthy + push: + pull_request: + branches: [main] +jobs: + codecoverage: + uses: ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main + with: + collection_pre_install: >- + git+https://github.com/ansible-collections/ansible.utils.git + git+https://github.com/ansible-collections/ansible.netcommon.git diff --git a/ansible_collections/ibm/qradar/.github/workflows/lint.yml b/ansible_collections/ibm/qradar/.github/workflows/lint.yml new file mode 100644 index 000000000..fbac38cbf --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/lint.yml @@ -0,0 +1,13 @@ +--- +name: ansible-lint +on: # yamllint disable-line rule:truthy + pull_request: + branches: ["main"] +jobs: + build: + name: Ansible Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Run ansible-lint + uses: ansible/ansible-lint@main diff --git a/ansible_collections/ibm/qradar/.github/workflows/push.yml b/ansible_collections/ibm/qradar/.github/workflows/push.yml new file mode 100644 index 000000000..b8846a398 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/push.yml @@ -0,0 +1,26 @@ +--- +# push workflow is shared and expected to perform actions after a merge happens +# on a maintenance branch (default or release). For example updating the +# draft release-notes. +# based on great work from +# https://github.com/T-Systems-MMS/ansible-collection-icinga-director +name: push + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + workflow_dispatch: +env: + NAMESPACE: ibm + COLLECTION_NAME: qradar + ANSIBLE_COLLECTIONS_PATHS: ./ + +jobs: + update_release_draft: + uses: ansible/devtools/.github/workflows/push_network.yml@main + with: + repo: ansible-collections/ibm.qradar + secrets: + BOT_PAT: ${{ secrets.BOT_PAT }} diff --git a/ansible_collections/ibm/qradar/.github/workflows/release.yml b/ansible_collections/ibm/qradar/.github/workflows/release.yml new file mode 100644 index 000000000..749b3c344 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/release.yml @@ -0,0 +1,13 @@ +--- +name: release +on: # yamllint disable-line rule:truthy + release: + types: [published] +jobs: + release: + uses: ansible/devtools/.github/workflows/release_collection.yml@main + with: + environment: release + secrets: + ah_token: ${{ secrets.AH_TOKEN }} + ansible_galaxy_api_key: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} diff --git a/ansible_collections/ibm/qradar/.github/workflows/test.yml b/ansible_collections/ibm/qradar/.github/workflows/test.yml deleted file mode 100644 index e2a19e00a..000000000 --- a/ansible_collections/ibm/qradar/.github/workflows/test.yml +++ /dev/null @@ -1,41 +0,0 @@ ---- -name: Test collection - -concurrency: - group: ${{ github.head_ref }} - cancel-in-progress: true - -on: # yamllint disable-line rule:truthy - pull_request: - branches: [main] - workflow_dispatch: - -jobs: - changelog: - uses: ansible-network/github_actions/.github/workflows/changelog.yml@main - sanity: - uses: ansible-network/github_actions/.github/workflows/sanity.yml@main - unit-galaxy: - uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main - unit-source: - uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main - with: - collection_pre_install: >- - git+https://github.com/ansible-collections/ansible.utils.git - git+https://github.com/ansible-collections/ansible.netcommon.git - all_green: - if: ${{ always() }} - needs: - - changelog - - sanity - - unit-galaxy - - unit-source - runs-on: ubuntu-latest - steps: - - run: >- - python -c "assert set([ - '${{ needs.changelog.result }}', - '${{ needs.sanity.result }}', - '${{ needs.unit-galaxy.result }}', - '${{ needs.unit-source.result }}' - ]) == {'success'}" \ No newline at end of file diff --git a/ansible_collections/ibm/qradar/.github/workflows/tests.yml b/ansible_collections/ibm/qradar/.github/workflows/tests.yml new file mode 100644 index 000000000..74056d553 --- /dev/null +++ b/ansible_collections/ibm/qradar/.github/workflows/tests.yml @@ -0,0 +1,40 @@ +--- +name: CI + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + pull_request: + branches: [main] + workflow_dispatch: + schedule: + - cron: "0 0 * * *" + +jobs: + sanity: + uses: ansible-network/github_actions/.github/workflows/sanity.yml@main + unit-galaxy: + uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main + unit-source: + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main + with: + collection_pre_install: >- + git+https://github.com/ansible-collections/ansible.utils.git + git+https://github.com/ansible-collections/ansible.netcommon.git + all_green: + if: ${{ always() && (github.event_name != 'schedule') }} + needs: + - sanity + - unit-galaxy + - unit-source + runs-on: ubuntu-latest + steps: + - run: >- + python -c "assert 'failure' not in + set([ + '${{ needs.sanity.result }}', + '${{ needs.unit-galaxy.result }}', + '${{ needs.unit-source.result }}' + ])" diff --git a/ansible_collections/ibm/qradar/.gitignore b/ansible_collections/ibm/qradar/.gitignore index 651a7bc91..1f9858c45 100644 --- a/ansible_collections/ibm/qradar/.gitignore +++ b/ansible_collections/ibm/qradar/.gitignore @@ -1,3 +1,10 @@ +# CML/virl lab cache +.virl/ + +# A collection directory, resulting from the use of the pytest-ansible-units plugin +collections/ + + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] @@ -103,9 +110,9 @@ venv.bak/ # mypy .mypy_cache/ -# mazer / ansible collections -releases/ - -*.tar.gz +# ide +*.code-workspace +.vscode/ +.DS_Store -tests/output* +changelogs/.plugin-cache.yaml diff --git a/ansible_collections/ibm/qradar/.isort.cfg b/ansible_collections/ibm/qradar/.isort.cfg new file mode 100644 index 000000000..3e6d0fb29 --- /dev/null +++ b/ansible_collections/ibm/qradar/.isort.cfg @@ -0,0 +1,6 @@ +[settings] +known_first_party=ansible_collections.ibm.qradar +line_length=100 +lines_after_imports=2 +lines_between_types=1 +profile=black diff --git a/ansible_collections/ibm/qradar/.pre-commit-config.yaml b/ansible_collections/ibm/qradar/.pre-commit-config.yaml index 7d4355f70..92ecede00 100644 --- a/ansible_collections/ibm/qradar/.pre-commit-config.yaml +++ b/ansible_collections/ibm/qradar/.pre-commit-config.yaml @@ -1,7 +1,12 @@ --- repos: + - repo: https://github.com/ansible-network/collection_prep + rev: 1.1.1 + hooks: + - id: update-docs + - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.2.0 + rev: v4.5.0 hooks: - id: check-merge-conflict - id: check-symlinks @@ -10,12 +15,31 @@ repos: - id: no-commit-to-branch args: [--branch, main] - id: trailing-whitespace + + - repo: https://github.com/asottile/add-trailing-comma + rev: v3.1.0 + hooks: + - id: add-trailing-comma + + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v3.1.0 + hooks: + - id: prettier + entry: env CI=1 bash -c "prettier --list-different . || ec=$? && prettier --loglevel=error --write . && exit $ec" + pass_filenames: false + args: [] + additional_dependencies: + - prettier + - prettier-plugin-toml + + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + name: Sort import statements using isort + args: [--filter-files] + - repo: https://github.com/psf/black - rev: 22.3.0 + rev: 23.11.0 hooks: - id: black - args: [-l, "100"] - - repo: https://github.com/ansible-network/collection_prep - rev: 1.0.0 - hooks: - - id: update-docs diff --git a/ansible_collections/ibm/qradar/.prettierignore b/ansible_collections/ibm/qradar/.prettierignore new file mode 100644 index 000000000..9f980a682 --- /dev/null +++ b/ansible_collections/ibm/qradar/.prettierignore @@ -0,0 +1,22 @@ +# Stuff we don't want priettier to ever to look into +.*/ + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# A linked collection directory created by pytest-ansible-units + +collections/ + +# Tracked but not manually edited + +# Tracked but manually formatted + +# WIP +README.md diff --git a/ansible_collections/ibm/qradar/CHANGELOG.rst b/ansible_collections/ibm/qradar/CHANGELOG.rst index f937e8e9f..117d5fc77 100644 --- a/ansible_collections/ibm/qradar/CHANGELOG.rst +++ b/ansible_collections/ibm/qradar/CHANGELOG.rst @@ -4,6 +4,25 @@ IBM Qradar Collection Release Notes .. contents:: Topics +v3.0.0 +====== + +Release Summary +--------------- + +Starting from this release, the minimum `ansible-core` version this collection requires is `2.14.0`. The last known version compatible with ansible-core<2.14 is `v2.1.0`. + +Major Changes +------------- + +- Bumping `requires_ansible` to `>=2.14.0`, since previous ansible-core versions are EoL now. + +Bugfixes +-------- + +- A bunch of ansible-lint and ansible-test sanity issues have been fixed. + + v2.1.0 ====== diff --git a/ansible_collections/ibm/qradar/FILES.json b/ansible_collections/ibm/qradar/FILES.json index 84a0f1790..03160ab27 100644 --- a/ansible_collections/ibm/qradar/FILES.json +++ b/ansible_collections/ibm/qradar/FILES.json @@ -8,145 +8,208 @@ "format": 1 }, { - "name": ".github", + "name": "codecov.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "4aa7e485dd4db6f8a55b046088c745def2b3145d9499ccda4e9a3336467dcea2", + "format": 1 + }, + { + "name": "LICENSE", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "format": 1 + }, + { + "name": ".yamllint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "827ef9e031ecdcaf137be239d33ef93fcbbc3611cbb6b30b0e507d0e03373d0e", + "format": 1 + }, + { + "name": "requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "format": 1 + }, + { + "name": "meta", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": ".github/workflows", + "name": "meta/runtime.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "33dbe37da65e207c3cf01b0320d2e0505c515d9c8262d343ce0eeb54932cbc9f", + "format": 1 + }, + { + "name": "README.md", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "9c74fb8b8254bac397a104e298c19f5c745fbd0a49668d0c3a8109d86b6e0bb0", + "format": 1 + }, + { + "name": "plugins", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": ".github/workflows/test.yml", + "name": "plugins/httpapi", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "plugins/httpapi/qradar.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "abbe2f2b782e28e478a011667782bcd93a86c21f1554f5eaa772305af4d37640", + "chksum_sha256": "23db40436b182dd7011133d48740f3ad61150b654bd0a59ea8d295dbde384b71", "format": 1 }, { - "name": "changelogs", + "name": "plugins/modules", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "changelogs/changelog.yaml", + "name": "plugins/modules/qradar_log_source_management.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c675ed616cbec4e8e3343eb024182ca9c7d6dbc1e72e3b8f3598da67349ff5bc", + "chksum_sha256": "c378a4caa2f71974a072f18eae5f3ec2347953c178c75ffe1f2633bf7dcb1897", "format": 1 }, { - "name": "changelogs/config.yaml", + "name": "plugins/modules/deploy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d2c4dcbe8870d9e338d757b61e3f3cc08ab7f4535795d67a3df7b5f15e4fd6c8", + "chksum_sha256": "a343676ac8e349f33711cea53b6870b7248b76e6febbbfca1259d49eee4508e3", "format": 1 }, { - "name": "docs", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "plugins/modules/rule.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "04108c2d38f900b5223ec1cd6d8ca6010f57d7d61f84c9518175f077f4d39bbf", "format": 1 }, { - "name": "docs/ibm.qradar.deploy_module.rst", + "name": "plugins/modules/qradar_rule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "905ea7071de3986d5fec78b1314b7901838add60f05418861c47667c11762605", + "chksum_sha256": "04108c2d38f900b5223ec1cd6d8ca6010f57d7d61f84c9518175f077f4d39bbf", "format": 1 }, { - "name": "docs/ibm.qradar.log_source_management_module.rst", + "name": "plugins/modules/qradar_offense_action.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "967f8c4a1fffeab83b6d2b0a8a0a55098f8ed89cd5a5e947d88fe7c3860e508f", + "chksum_sha256": "cc4f52f737a9ffbae3dcc00b667883ef0e1ffde2993f23b9a14cec753fe8ce30", "format": 1 }, { - "name": "docs/ibm.qradar.offense_action_module.rst", + "name": "plugins/modules/offense_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "499aa85776594aa101b48286715c4f50980807f3aeb057e05c983c2b853ae1f3", + "chksum_sha256": "5169f96dcf88d13ee4f5e36c21142b1a4047baa39d537f83fdd4d54d69e87a9a", "format": 1 }, { - "name": "docs/ibm.qradar.offense_info_module.rst", + "name": "plugins/modules/log_source_management.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "147d44b8ed4d5fd6cf7fb4df19b370625e9064455e76f5ccad4139a979ba29c2", + "chksum_sha256": "c378a4caa2f71974a072f18eae5f3ec2347953c178c75ffe1f2633bf7dcb1897", "format": 1 }, { - "name": "docs/ibm.qradar.offense_note_module.rst", + "name": "plugins/modules/qradar_offense_note.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "20b656a582532cb4f46af1840c6d9e6bfb7e75299ce84b30a2aaa1f9bf9db15c", + "chksum_sha256": "5d946202d41494f6b5167bd2a61a41bcfd145930d963818392ae9af56a8003b4", "format": 1 }, { - "name": "docs/ibm.qradar.qradar_analytics_rules_module.rst", + "name": "plugins/modules/qradar_analytics_rules.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eaeff500aa899570ba58be93ecd66808c4959df923243b2373f07b43e4d18d43", + "chksum_sha256": "f9062cb8661e430f7bc1d765a0ca4d5a8aec4ba93a137f311c45b64334ffd30c", "format": 1 }, { - "name": "docs/ibm.qradar.qradar_httpapi.rst", + "name": "plugins/modules/qradar_log_sources_management.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d9bff624389781d9d2b517ccf2fb797811a98007aa3e0d6a999d3b0d462a2956", + "chksum_sha256": "037f16ccb809bb1a758e24402e4a59a3b45a3fe282206ac0571f7f897cb895d7", "format": 1 }, { - "name": "docs/ibm.qradar.qradar_log_sources_management_module.rst", + "name": "plugins/modules/qradar_rule_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "58f7e256f3556620aaf73fc4ef793713d3f021fa1ef4424b063ced7494d4752d", + "chksum_sha256": "186bcf87f8e837b4d6b268d46f249643275f4314b22d5e844e255516f0922d26", "format": 1 }, { - "name": "docs/ibm.qradar.rule_info_module.rst", + "name": "plugins/modules/qradar_deploy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "607c6f296c8106aa22a070d4c6513c663ab3ae2fcc93e22f9b462d27b41fda53", + "chksum_sha256": "a343676ac8e349f33711cea53b6870b7248b76e6febbbfca1259d49eee4508e3", "format": 1 }, { - "name": "docs/ibm.qradar.rule_module.rst", + "name": "plugins/modules/offense_action.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "86039262bfcc0df113911178cc1fc5a8bae0e92b6a20d4bd0b79e7f76f337620", + "chksum_sha256": "cc4f52f737a9ffbae3dcc00b667883ef0e1ffde2993f23b9a14cec753fe8ce30", "format": 1 }, { - "name": "meta", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "plugins/modules/offense_note.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5d946202d41494f6b5167bd2a61a41bcfd145930d963818392ae9af56a8003b4", "format": 1 }, { - "name": "meta/runtime.yml", + "name": "plugins/modules/rule_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "414e97f033acc6afc08f9bb522bbf5db1b4f359a820c01f82be4bc50f1e55352", + "chksum_sha256": "186bcf87f8e837b4d6b268d46f249643275f4314b22d5e844e255516f0922d26", "format": 1 }, { - "name": "plugins", + "name": "plugins/modules/qradar_offense_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5169f96dcf88d13ee4f5e36c21142b1a4047baa39d537f83fdd4d54d69e87a9a", + "format": 1 + }, + { + "name": "plugins/module_utils", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, + { + "name": "plugins/module_utils/qradar.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b9d944e009465426cbfc542f0e8ac3ab6d475bfe3fc25b4e2ccf37bc51d369d1", + "format": 1 + }, { "name": "plugins/action", "ftype": "dir", @@ -165,168 +228,210 @@ "name": "plugins/action/qradar_analytics_rules.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "69740224f09fe0f6dff44597fa30c5707fd77c0e6429e479fdc5feffaa50843e", + "chksum_sha256": "6683ffbf1d19b81081e232dce41743e2bc9b5be6e216ba8775b4217e7fa297ca", "format": 1 }, { "name": "plugins/action/qradar_log_sources_management.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "24ffae07d93bae8d3850f0bba2c50c7b10c7d124a57542f24542b9ac112faa91", + "chksum_sha256": "3aab75520fc41aa84f40c0a32dd78aea75a0f97ec5c5a1dc97d74e9c1b6adb8e", "format": 1 }, { - "name": "plugins/httpapi", + "name": ".ansible-lint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b47f72e159f93a5ff07ea2534752e0fa977b214e9ac05c667fa83ac13be4e50c", + "format": 1 + }, + { + "name": "test-requirements.txt", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ef11b7e31c53ed88a2352faacda33806dda00f45d4e9cce540a40e6a47ccbe73", + "format": 1 + }, + { + "name": "tests", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "plugins/httpapi/qradar.py", + "name": "tests/sanity", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/sanity/ignore-2.9.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ba3b495f9dfdff81318a594c4b1874548239b916f3a9a30b6e9775a35761c5d3", + "chksum_sha256": "9246dc0a460b34f99c668d253511798595dc611dfda1fb828bdb9d13672fdfed", "format": 1 }, { - "name": "plugins/module_utils", + "name": "tests/unit", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "plugins/module_utils/qradar.py", + "name": "tests/unit/requirements.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ae62dfc3637bfb6eae56ae40e922b35087b550fc7554ab47bbf94b53d43de1a4", + "chksum_sha256": "49ba996dc4735c3463e9af561344346dfae14bcc1a68096ce78364b377f0df1f", "format": 1 }, { - "name": "plugins/modules", + "name": "tests/unit/plugins", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "plugins/modules/qradar_deploy.py", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "e061cdb5af3a9c2f2c7f14ca300feb52a2cd41e3669f7814311cfcedaeec08f7", + "name": "tests/unit/plugins/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "plugins/modules/qradar_log_source_management.py", + "name": "tests/unit/plugins/modules/__init__.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b8f915dec02b41d29af6680823bf538dd2f648d1142124cf54565ad7ba260e49", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "plugins/modules/qradar_offense_action.py", + "name": "tests/unit/plugins/modules/conftest.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2f25e23ff4bba3332a877fb5cf6f2c2f28e7a776cacdfdb08648d5d9527d00db", + "chksum_sha256": "e0ae70fa7c2a5e56d7f02a47c3602398cff60c8eb021772ac59a76df2a234048", "format": 1 }, { - "name": "plugins/modules/qradar_offense_info.py", + "name": "tests/unit/plugins/modules/utils.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "de02f673e3ff3653ca8f9e8a43e980ef7811fc0e4b8ede36c10cb495c2ce44d7", + "chksum_sha256": "36b272718629a9491578048908464bdd009437cfe6a1fd1c40ffe6dbebaa1875", "format": 1 }, { - "name": "plugins/modules/qradar_offense_note.py", + "name": "tests/unit/plugins/action", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/plugins/action/test_qradar_analytics_rules.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "511912ef4baaafb001439ee96559843a2ac2054d77e7e4e4f97fef79b7261f94", + "chksum_sha256": "f699006252320b9fb0ec4d6f329641f30ea4396fda8cc0f26ae81828f64b46d5", "format": 1 }, { - "name": "plugins/modules/qradar_rule.py", + "name": "tests/unit/plugins/action/__init__.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ed52d8c0cfc0e1860240cf2b913eeba6f7263c6b0029aac8468410b8aae8e141", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "plugins/modules/qradar_rule_info.py", + "name": "tests/unit/__init__.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5a68a767a121239541d4685d65022b48b4b990c12a679406d232c089a686b456", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "plugins/modules/deploy.py", + "name": "tests/unit/mock", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/mock/vault_helper.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e061cdb5af3a9c2f2c7f14ca300feb52a2cd41e3669f7814311cfcedaeec08f7", + "chksum_sha256": "55bd0e924dcc22d050612c944bff0ef745e51faac9260dce9b9b2018c4c8a661", "format": 1 }, { - "name": "plugins/modules/log_source_management.py", + "name": "tests/unit/mock/__init__.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b8f915dec02b41d29af6680823bf538dd2f648d1142124cf54565ad7ba260e49", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "plugins/modules/offense_action.py", + "name": "tests/unit/mock/procenv.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2f25e23ff4bba3332a877fb5cf6f2c2f28e7a776cacdfdb08648d5d9527d00db", + "chksum_sha256": "4cde8da110df91dab071c776c8694e6f8f0ce859933436a8fb1598f168cccdb9", "format": 1 }, { - "name": "plugins/modules/offense_info.py", + "name": "tests/unit/mock/loader.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "de02f673e3ff3653ca8f9e8a43e980ef7811fc0e4b8ede36c10cb495c2ce44d7", + "chksum_sha256": "07eb6a715b3bc2a0f03d6fbaa5428cb74796403e1d30348f0d6c88022cea3eed", "format": 1 }, { - "name": "plugins/modules/offense_note.py", + "name": "tests/unit/mock/yaml_helper.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "511912ef4baaafb001439ee96559843a2ac2054d77e7e4e4f97fef79b7261f94", + "chksum_sha256": "134eef238c83a9611799871b743e49e9bfbcd8bdddf2cc6a7bf69fd1000345b3", "format": 1 }, { - "name": "plugins/modules/qradar_analytics_rules.py", + "name": "tests/unit/mock/path.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "20a9edb860d5e98e1bb08f4320bcbd13726e0b52cbfa23f55875e10c00212472", + "chksum_sha256": "e7a8f960d10a413dd86f44485a1437366491514b819c869984058a11676f34ba", "format": 1 }, { - "name": "plugins/modules/qradar_log_sources_management.py", + "name": "tests/unit/compat", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "tests/unit/compat/unittest.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f5fa473f263ccc2ebd15724c2722b20891f6a818729b0d966d2f00a35fc6acc2", + "chksum_sha256": "727203a3846be41893b78a4b77852a1658925e936fb19539551958a5d8e8fb81", "format": 1 }, { - "name": "plugins/modules/rule.py", + "name": "tests/unit/compat/__init__.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ed52d8c0cfc0e1860240cf2b913eeba6f7263c6b0029aac8468410b8aae8e141", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "plugins/modules/rule_info.py", + "name": "tests/unit/compat/mock.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5a68a767a121239541d4685d65022b48b4b990c12a679406d232c089a686b456", + "chksum_sha256": "b91b074a0bb9cfda8560f02aa3cefe0bfaae9b045f8386597bfe342f1e5a0717", "format": 1 }, { - "name": "tests", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "tests/.keep", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { @@ -344,84 +449,84 @@ "format": 1 }, { - "name": "tests/integration/targets/deploy", + "name": "tests/integration/targets/offense", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/deploy/tasks", + "name": "tests/integration/targets/offense/tasks", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/deploy/tasks/main.yml", + "name": "tests/integration/targets/offense/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "83cc8a6c22f6d0424f4595ed06c3253351fdfb61c88a8cf9a4ce640121f17a63", "format": 1 }, { - "name": "tests/integration/targets/deploy/aliases", + "name": "tests/integration/targets/offense/aliases", "ftype": "file", "chksum_type": "sha256", "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", "format": 1 }, { - "name": "tests/integration/targets/log_source_management", + "name": "tests/integration/targets/qradar_rule", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/log_source_management/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "tests/integration/targets/qradar_rule/aliases", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", "format": 1 }, { - "name": "tests/integration/targets/log_source_management/tasks/main.yml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "6821a3548927a93503e37fd42e276c8ebc829bc72ae55dc47b8f3c20e32f11d8", + "name": "tests/integration/targets/qradar_offense", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/log_source_management/aliases", + "name": "tests/integration/targets/qradar_offense/aliases", "ftype": "file", "chksum_type": "sha256", "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", "format": 1 }, { - "name": "tests/integration/targets/offense", + "name": "tests/integration/targets/rule", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/offense/tasks", + "name": "tests/integration/targets/rule/tasks", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/offense/tasks/main.yml", + "name": "tests/integration/targets/rule/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "985949c5779a18b1d13a05230a565e24d4edc5b8e9d87ae16ea47c07a44e3a75", + "chksum_sha256": "171c995ef3f9449275934955792aa3a86b570b9f4511109e3c4e69f14714cb96", "format": 1 }, { - "name": "tests/integration/targets/offense/aliases", + "name": "tests/integration/targets/rule/aliases", "ftype": "file", "chksum_type": "sha256", "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", @@ -456,465 +561,430 @@ "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management", + "name": "tests/integration/targets/deploy", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/defaults", + "name": "tests/integration/targets/deploy/tasks", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/defaults/main.yaml", + "name": "tests/integration/targets/deploy/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c8e82c716422654d049fd043bbf84d624ed532f96741e032f52f14c19e970d3e", - "format": 1 - }, - { - "name": "tests/integration/targets/qradar_log_sources_management/meta", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/meta/main.yaml", + "name": "tests/integration/targets/deploy/aliases", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tasks", + "name": "tests/integration/targets/log_source_management", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "79c2820b2b63ca8b1b4025dfdac534f3296e24d72ad688c06d33268cfafff497", + "name": "tests/integration/targets/log_source_management/tasks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tasks/main.yaml", + "name": "tests/integration/targets/log_source_management/tasks/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e7d7f58a1d24f52718c31cc560ba27eaf69da2df9e8b0d26516560b547d1d9da", + "chksum_sha256": "346485b9603298f42471c95f7a2c22f84ad34e589e8379e2fd50456c3b5761e0", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml", + "name": "tests/integration/targets/log_source_management/aliases", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5b071a65a98718e6fbc859cf577103adc6dd5700bc7263877936d391639e61f3", + "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests", + "name": "tests/integration/targets/qradar_log_sources_management", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli", + "name": "tests/integration/targets/qradar_log_sources_management/tasks", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml", + "name": "tests/integration/targets/qradar_log_sources_management/tasks/main.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d216d1ab07e6220f2d5dcd22f84c70849db6945d9a3680d4190a92e4198c24b7", + "chksum_sha256": "75d83a8aa1677129e967a13404e097759d4685abd50f922d149cb45ae112b00f", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml", + "name": "tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f817d766182cdf2e099e8d96f468bf1e7db3159091394578b72097767ec5fceb", + "chksum_sha256": "2f9456c14163cd3739af82e9b03804574e4927cc87610498b538f98780ce8057", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml", + "name": "tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "18f5096b5f3e533da91e48f0659696f616adb83d3f48a940b2711a1c34f48af3", + "chksum_sha256": "5650670078ee98a1c74dde60512bf365e9c8e6390fd4f252c6a520c127467e48", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "69e7f5c3460b00653d155a4e71b882125ca7c183429e951ddd069965afbe9c3e", + "name": "tests/integration/targets/qradar_log_sources_management/meta", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml", + "name": "tests/integration/targets/qradar_log_sources_management/meta/main.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "304640c1a0e6ee8436f147745e62b44cb536b176a8cecb50441e0ca2c7c11e8a", + "chksum_sha256": "ec4fa30fc4a7b9e002d1c7b3932286ace72ba36e4f532e2cc79f49d07e0794c3", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "038a9601139d83cec40b40f711bc6eca1602bae2d988fde4bcdd84b6be18c6a4", + "name": "tests/integration/targets/qradar_log_sources_management/defaults", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml", + "name": "tests/integration/targets/qradar_log_sources_management/defaults/main.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4cb3f0ad53ddd35f3d47cef6262bb97af8b045b625ed5bcf9310950604ffaf84", + "chksum_sha256": "b6cec8117492a3110c2e9066aa77a54abd2b9774cea08d60eb42b01c51c3e032", "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/vars", + "name": "tests/integration/targets/qradar_log_sources_management/tests", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_log_sources_management/vars/main.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "a7ce38445031d76134d0cd52780f5905abb1cffce74718fe61fefa1c8fbf2f9f", - "format": 1 - }, - { - "name": "tests/integration/targets/qradar_offense", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/integration/targets/qradar_offense/aliases", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", - "format": 1 - }, - { - "name": "tests/integration/targets/qradar_rule", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "chksum_sha256": "f06ab1369d820859393d3838da2e825f17c7e21013c60bb43838f21400d923b0", "format": 1 }, { - "name": "tests/integration/targets/qradar_rule/aliases", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "chksum_sha256": "a6920423a420a47539b311c48d41fd3be3ef3921b9047304800329fcd62b8735", "format": 1 }, { - "name": "tests/integration/targets/rule", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "c173df5f78694395fbd097074b34b81ff3f9fa50cc173199ae0010e380d4f383", "format": 1 }, { - "name": "tests/integration/targets/rule/tasks", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "7f4dee852a9328374d5cf8fe6e9c8b5528683ea451efd41b17f0af60e06ba4da", "format": 1 }, { - "name": "tests/integration/targets/rule/tasks/main.yml", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1d47767a0f7a9e41ac6cfe46ae8f0184a05fa4f81f5ef7b64c0387fce1a163c1", + "chksum_sha256": "07a48637fa1060daceb0128e415ea0fb734ec991740a3e9258222c66e334395e", "format": 1 }, { - "name": "tests/integration/targets/rule/aliases", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e317ad2cb83962cf790cc6c46c9c099b2b1636a63a18192532a624f196b78df1", + "chksum_sha256": "f2732c7f6f198a99a472093912a8f15659bae5461248fb6a0fb9c7a99aada896", "format": 1 }, { - "name": "tests/integration/target-prefixes.network", + "name": "tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f4d2f34d7884174dabd0e91e1f2ae1a22499f44e634261344ad065a167f5f862", + "chksum_sha256": "e70da2a6a5f0f5b26592c1e50d533193cc9ae0c11b7989eb5ba1777c97d5d811", "format": 1 }, { - "name": "tests/sanity", + "name": "tests/integration/targets/qradar_log_sources_management/vars", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/sanity/ignore-2.9.txt", + "name": "tests/integration/targets/qradar_log_sources_management/vars/main.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "9246dc0a460b34f99c668d253511798595dc611dfda1fb828bdb9d13672fdfed", + "chksum_sha256": "bca95d24f2c640405026076e1b28e28ae4d24ebdd6082eb0288fa087d7de178b", "format": 1 }, { - "name": "tests/unit", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": "tests/integration/target-prefixes.network", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f4d2f34d7884174dabd0e91e1f2ae1a22499f44e634261344ad065a167f5f862", "format": 1 }, { - "name": "tests/unit/compat", + "name": "docs", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/unit/compat/__init__.py", + "name": "docs/ibm.qradar.qradar_log_sources_management_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "610f0ea43aed7b158537e14f0350c93cd50a1550d21e13385c80516b7fa20b6c", "format": 1 }, { - "name": "tests/unit/compat/builtins.py", + "name": "docs/ibm.qradar.qradar_analytics_rules_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ba13a350ade8ef804336f888d5883b8e54f8bddfb9d0fadc10277a8ca6540f4e", + "chksum_sha256": "e0f2ac972ba74463502acf9315e827a85c5c421fb4418a133f6dec38848fbfd7", "format": 1 }, { - "name": "tests/unit/compat/mock.py", + "name": "docs/ibm.qradar.rule_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "52ecd54195edca933104eb3e937547c7395ff604ada2694a8b184c2c1466dbf1", + "chksum_sha256": "86039262bfcc0df113911178cc1fc5a8bae0e92b6a20d4bd0b79e7f76f337620", "format": 1 }, { - "name": "tests/unit/compat/unittest.py", + "name": "docs/ibm.qradar.rule_info_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3ed698b1faec43d87a2c1ebcb15a2aae48b09ff355bb9a598e5f5a1c928dbb30", - "format": 1 - }, - { - "name": "tests/unit/mock", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "chksum_sha256": "607c6f296c8106aa22a070d4c6513c663ab3ae2fcc93e22f9b462d27b41fda53", "format": 1 }, { - "name": "tests/unit/mock/__init__.py", + "name": "docs/ibm.qradar.qradar_httpapi.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "d9bff624389781d9d2b517ccf2fb797811a98007aa3e0d6a999d3b0d462a2956", "format": 1 }, { - "name": "tests/unit/mock/loader.py", + "name": "docs/ibm.qradar.offense_action_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "99243cafb4042ee1354d81e3f21647b18bba2b81e1bcd0d77d5487d6069740b9", + "chksum_sha256": "499aa85776594aa101b48286715c4f50980807f3aeb057e05c983c2b853ae1f3", "format": 1 }, { - "name": "tests/unit/mock/path.py", + "name": "docs/ibm.qradar.offense_note_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "77760b066115f34f1ecce2387f8194ba254f3dc44ed89f439f3e6adfd258cdf1", + "chksum_sha256": "20b656a582532cb4f46af1840c6d9e6bfb7e75299ce84b30a2aaa1f9bf9db15c", "format": 1 }, { - "name": "tests/unit/mock/procenv.py", + "name": "docs/ibm.qradar.offense_info_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "d7f9e134ebd607e1b2910d62cd8997535c8a2cced4473a2bf5cdaae2233e3049", + "chksum_sha256": "147d44b8ed4d5fd6cf7fb4df19b370625e9064455e76f5ccad4139a979ba29c2", "format": 1 }, { - "name": "tests/unit/mock/vault_helper.py", + "name": "docs/ibm.qradar.deploy_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "feae23166b6eb502f7d9b77c314970516c9a99aaad7de01295b4dfdad53c5c09", + "chksum_sha256": "905ea7071de3986d5fec78b1314b7901838add60f05418861c47667c11762605", "format": 1 }, { - "name": "tests/unit/mock/yaml_helper.py", + "name": "docs/ibm.qradar.log_source_management_module.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "94e2f3c867d2582c9f7a0e99e544718e355025c4a51c9925e70158fa89b3609e", - "format": 1 - }, - { - "name": "tests/unit/plugins", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "chksum_sha256": "967f8c4a1fffeab83b6d2b0a8a0a55098f8ed89cd5a5e947d88fe7c3860e508f", "format": 1 }, { - "name": "tests/unit/plugins/action", - "ftype": "dir", - "chksum_type": null, - "chksum_sha256": null, + "name": ".isort.cfg", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "fd259158086fc19b6cd30087f4022537f0fb602e16d472fa52e01ff49ce48371", "format": 1 }, { - "name": "tests/unit/plugins/action/__init__.py", + "name": "pyproject.toml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "ba383ecc0b6b3a23e4bce8269e716ba103def0943564ff0a821718ddd4786070", "format": 1 }, { - "name": "tests/unit/plugins/action/test_qradar_analytics_rules.py", + "name": "bindep.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "82ca5c7c9be3c8ad8c86dccba1b7f48e2deea8be67efd24689fdfab994136ea9", + "chksum_sha256": "80645079eb025b3a905b4775ac545d080a3d7d35d537c31e04f7197c94315ab5", "format": 1 }, { - "name": "tests/unit/plugins/modules", + "name": "changelogs", "ftype": "dir", "chksum_type": null, "chksum_sha256": null, "format": 1 }, { - "name": "tests/unit/plugins/modules/__init__.py", + "name": "changelogs/config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "0c775b3aad450f0d3f6579f77bff72150841c1dd8564dc439cc2398dc82b2c95", "format": 1 }, { - "name": "tests/unit/plugins/modules/conftest.py", + "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2af4846e50d461a131ad3edfb609fbb39a9eb1796048c62e4ead8234bcf5c6a1", + "chksum_sha256": "d3d2a4383c362e6ba094f8907ff2faba56fbae071b3e284456df83b128c9fea1", "format": 1 }, { - "name": "tests/unit/plugins/modules/utils.py", + "name": "tox.ini", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ecb4e4c4a3a490b49d33d043d246bea11580cfe5460e70630a793c2ffd0ff450", + "chksum_sha256": "beb3313789623e5570d0871f6115ba563a0d92ea75e8e89cbd9f79045b4fe279", "format": 1 }, { - "name": "tests/unit/__init__.py", + "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "b29e19b072604f36b57d5a15296f4dafe6823a88b2283a0d470627bdc65549e9", "format": 1 }, { - "name": "tests/unit/requirements.txt", + "name": ".gitignore", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "49ba996dc4735c3463e9af561344346dfae14bcc1a68096ce78364b377f0df1f", + "chksum_sha256": "179a6d0780422c32653a71b9395a3ecb8b3859346ffa3e38ca3c8d90f8063fd2", "format": 1 }, { - "name": "tests/.keep", + "name": ".pre-commit-config.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "abfba9f6b56a992c574b0be4bd190d3a078279a6f7f357391562bdc8c9c5499b", "format": 1 }, { - "name": ".gitignore", + "name": ".prettierignore", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "63e02bf68769e25aba8db3f3cf2c1cd8b1e92e71ce3ef2d13e949b994e424b75", + "chksum_sha256": "9881cacd6494858bc3c50f32917a7971c275f5dbeaa27d438985eacb344f9857", "format": 1 }, { - "name": ".pre-commit-config.yaml", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "6aabafd87ba32cf5d946aedd801dd41ee6fa90c7699a54f7d52c02b9c6576e14", + "name": ".github", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": ".yamllint", + "name": ".github/dependabot.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "827ef9e031ecdcaf137be239d33ef93fcbbc3611cbb6b30b0e507d0e03373d0e", + "chksum_sha256": "e39a1df1f81f943962e6cfb4f8ec384804ae7099cc8bc26c3bfdb957ba9de2d3", "format": 1 }, { - "name": "CHANGELOG.rst", - "ftype": "file", - "chksum_type": "sha256", - "chksum_sha256": "d7387333cff83fd516f8ec5f3808dabcf3e7bff7da05f76ab1793e6fbd6836db", + "name": ".github/workflows", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, "format": 1 }, { - "name": "LICENSE", + "name": ".github/workflows/codecoverage.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "3972dc9744f6499f0f9b2dbf76696f2ae7ad8af9b23dde66d6af86c9dfb36986", + "chksum_sha256": "c897a9049e77f9061073ee895aa4a5304cadc2523c566d410b6c4b5b1946d88f", "format": 1 }, { - "name": "README.md", + "name": ".github/workflows/lint.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1e50ccabd2166f551342cba98c6747604ed6d7df8fdda10fcfedbf89837df04d", + "chksum_sha256": "4aeac57f14d48d82a859c822f84a0573419958bc70708f19caa6daac5c771ff9", "format": 1 }, { - "name": "bindep.txt", + "name": ".github/workflows/ack.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f20e24c3b24e3738a72623924e20848bb3bab9ea951099b7d2fcce091b9673a8", + "chksum_sha256": "d6b4d340f95c3abd91a7689d511b4aa003702eb6b68830c69d09c75fc944b732", "format": 1 }, { - "name": "pyproject.toml", + "name": ".github/workflows/release.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "39dc64b0a646edff79e3a08ae4d3bae8fe707149df149814149d45ce07c30937", + "chksum_sha256": "a63b3e77a75b16d7295bc98c7fef3e23ecd1fd27e551e91f79144e3a6fbe13ac", "format": 1 }, { - "name": "requirements.txt", + "name": ".github/workflows/push.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "chksum_sha256": "97239c29b7314dd70fcd9b2b90a51bb0e84a78971ce572571dd363d376a87867", "format": 1 }, { - "name": "test-requirements.txt", + "name": ".github/workflows/tests.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eaa5e13a5ebe3344585b2e5ac61a6974a6d5b132f13a815d3a0f68c36ecfe8ad", + "chksum_sha256": "b9c53e96a44fcc5957dfb2e48a5d09f43c5bee9f925d053811c435747830a75a", "format": 1 }, { - "name": "tox.ini", + "name": ".github/release-drafter.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fa849abc071b00742c00b96e3df480355a2af2c60e4c920f085a9ac5616d8d4b", + "chksum_sha256": "7cbc785c8661033cd9dd7a60897484fce731cbe3dc124a689fc3e934b1d974fb", "format": 1 } ], diff --git a/ansible_collections/ibm/qradar/MANIFEST.json b/ansible_collections/ibm/qradar/MANIFEST.json index abcace9e9..4d1b3d2e8 100644 --- a/ansible_collections/ibm/qradar/MANIFEST.json +++ b/ansible_collections/ibm/qradar/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "ibm", "name": "qradar", - "version": "2.1.0", + "version": "3.0.0", "authors": [ "Ansible Security Team (https://github.com/ansible-security)" ], @@ -12,12 +12,10 @@ "qradar" ], "description": "Ansible Security Collection for IBM Qradar SIEM", - "license": [ - "GPL-3.0-or-later" - ], - "license_file": null, + "license": [], + "license_file": "LICENSE", "dependencies": { - "ansible.netcommon": ">=2.5.1" + "ansible.netcommon": ">=6.0.0" }, "repository": "https://github.com/ansible-collections/ibm.qradar", "documentation": "https://github.com/ansible-collections/ibm.qradar", @@ -28,7 +26,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6ba5743d2a4af148e4e25deb85d86aa62e1b5ba35f8f0c1ef23a52b863b2b2a4", + "chksum_sha256": "5e67b8e606839e38a3a6795f2495d5a4d7c7caac085992ab25ed04a98bb004a4", "format": 1 }, "format": 1 diff --git a/ansible_collections/ibm/qradar/README.md b/ansible_collections/ibm/qradar/README.md index dc0cb7f3a..3c410ada1 100644 --- a/ansible_collections/ibm/qradar/README.md +++ b/ansible_collections/ibm/qradar/README.md @@ -1,6 +1,8 @@ # IBM QRadar Ansible Collection -[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/ibm.qradar) +[![CI](https://zuul-ci.org/gated.svg)](https://dashboard.zuul.ansible.com/t/ansible/project/github.com/ansible-collections/ibm.qradar) +[![Codecov](https://codecov.io/gh/ansible-collections/ibm.qradar/branch/main/graph/badge.svg)](https://codecov.io/gh/ansible-collections/ibm.qradar) +[![CI](https://github.com/ansible-collections/ibm.qradar/actions/workflows/tests.yml/badge.svg?branch=main&event=schedule)](https://github.com/ansible-collections/ibm.qradar/actions/workflows/tests.yml) This is the [Ansible Collection](https://docs.ansible.com/ansible/latest/dev_guide/developing_collections.html) @@ -16,8 +18,10 @@ and provide feedback about. ## Ansible version compatibility -This collection has been tested against following Ansible versions: **>=2.9.10**. +This collection has been tested against following Ansible versions: **>=2.14.0**. +For collections that support Ansible 2.9, please ensure you update your `network_os` to use the +fully qualified collection name (for example, `cisco.ios.ios`). Plugins and modules within a collection may be tested with only specific Ansible versions. A collection may contain metadata that identifies these versions. PEP440 is the schema used to describe the versions of Ansible. @@ -72,8 +76,8 @@ qradar.example.com ansible_network_os=ibm.qradar.qradar ansible_user=admin ansible_httpapi_pass=SuperSekretPassword -ansible_httpapi_use_ssl=yes -ansible_httpapi_validate_certs=yes +ansible_httpapi_use_ssl=true +ansible_httpapi_validate_certs=true ansible_connection=httpapi ``` diff --git a/ansible_collections/ibm/qradar/bindep.txt b/ansible_collections/ibm/qradar/bindep.txt index 1eeaeb4de..ba9c980fb 100644 --- a/ansible_collections/ibm/qradar/bindep.txt +++ b/ansible_collections/ibm/qradar/bindep.txt @@ -4,5 +4,3 @@ gcc-c++ [doc test platform:rpm] python3-devel [test platform:rpm] python3 [test platform:rpm] -libssh-devel [test platform:rpm] -libssh-dev [test platform:dpkg] \ No newline at end of file diff --git a/ansible_collections/ibm/qradar/changelogs/changelog.yaml b/ansible_collections/ibm/qradar/changelogs/changelog.yaml index 35d420526..b07985e36 100644 --- a/ansible_collections/ibm/qradar/changelogs/changelog.yaml +++ b/ansible_collections/ibm/qradar/changelogs/changelog.yaml @@ -2,68 +2,85 @@ ancestor: null releases: 1.0.0: modules: - - description: Trigger a qradar configuration deployment - name: ibm.qradar.deploy - namespace: '' - - description: Manage Log Sources in QRadar - name: ibm.qradar.log_source_management - namespace: '' - - description: Take action on a QRadar Offense - name: ibm.qradar.offense_action - namespace: '' - - description: Obtain information about one or many QRadar Offenses, with filter - options - name: ibm.qradar.offense_info - namespace: '' - - description: Create or update a QRadar Offense Note - name: ibm.qradar.offense_note - namespace: '' - - description: Manage state of QRadar Rules, with filter options - name: ibm.qradar.rule - namespace: '' - - description: Obtain information about one or many QRadar Rules, with filter - options - name: ibm.qradar.rule_info - namespace: '' - release_date: '2020-06-22' + - description: Trigger a qradar configuration deployment + name: ibm.qradar.deploy + namespace: "" + - description: Manage Log Sources in QRadar + name: ibm.qradar.log_source_management + namespace: "" + - description: Take action on a QRadar Offense + name: ibm.qradar.offense_action + namespace: "" + - description: + Obtain information about one or many QRadar Offenses, with filter + options + name: ibm.qradar.offense_info + namespace: "" + - description: Create or update a QRadar Offense Note + name: ibm.qradar.offense_note + namespace: "" + - description: Manage state of QRadar Rules, with filter options + name: ibm.qradar.rule + namespace: "" + - description: + Obtain information about one or many QRadar Rules, with filter + options + name: ibm.qradar.rule_info + namespace: "" + release_date: "2020-06-22" 1.0.1: changes: release_summary: Removed tech preview from collection Readme file. - release_date: '2020-06-23' + release_date: "2020-06-23" 1.0.2: changes: release_summary: Releasing 1.0.2 with updated changelog. - release_date: '2020-08-27' + release_date: "2020-08-27" 1.0.3: changes: release_summary: Re-releasing 1.0.2 with updated galaxy file. - release_date: '2020-09-1' 2.0.0: changes: major_changes: - - Minimum required ansible.netcommon version is 2.5.1. - - Updated base plugin references to ansible.netcommon. + - Minimum required ansible.netcommon version is 2.5.1. + - Updated base plugin references to ansible.netcommon. fragments: - - netcommon_ref_update.yaml - - update_tests_unit_black_requirements.yaml - release_date: '2022-04-29' + - netcommon_ref_update.yaml + - update_tests_unit_black_requirements.yaml + release_date: "2022-04-29" 2.1.0: changes: minor_changes: - - Add Qradar Analytics rules resource module. - - Add Qradar Log Sources Management resource module. + - Add Qradar Analytics rules resource module. + - Add Qradar Log Sources Management resource module. fragments: - - add_qradar_analytics_rules_module.yaml - - add_qradar_log_sources_management_module.yaml - - doc_update_for_deprecation.yaml - - fix_doc_for_sanity_failures.yaml - - doc_update_with_correct_version.yaml - - undo_changelog_override.yaml + - add_qradar_analytics_rules_module.yaml + - add_qradar_log_sources_management_module.yaml + - doc_update_for_deprecation.yaml + - doc_update_with_correct_version.yaml + - fix_doc_for_sanity_failures.yaml + - undo_changelog_override.yaml modules: - - description: Qradar Analytics Rules Management resource module - name: qradar_analytics_rules - namespace: private.var.folders._0.m716s5gx1g3d5j1dw_s2w1ph0000gn.T.antsibull-changelog9yvlq4ax.collections.ansible_collections.ibm.qradar.plugins.modules - - description: Qradar Log Sources Management resource module - name: qradar_log_sources_management - namespace: private.var.folders._0.m716s5gx1g3d5j1dw_s2w1ph0000gn.T.antsibull-changelog9yvlq4ax.collections.ansible_collections.ibm.qradar.plugins.modules - release_date: '2022-09-07' + - description: Qradar Analytics Rules Management resource module + name: qradar_analytics_rules + namespace: "" + - description: Qradar Log Sources Management resource module + name: qradar_log_sources_management + namespace: "" + release_date: "2022-09-07" + 3.0.0: + changes: + bugfixes: + - A bunch of ansible-lint and ansible-test sanity issues have been fixed. + major_changes: + - Bumping `requires_ansible` to `>=2.14.0`, since previous ansible-core versions + are EoL now. + release_summary: + Starting from this release, the minimum `ansible-core` version + this collection requires is `2.14.0`. The last known version compatible with + ansible-core<2.14 is `v2.1.0`. + fragments: + - codecov_pr.yml + - prep_300.yaml + - updates.yaml + release_date: "2023-12-01" diff --git a/ansible_collections/ibm/qradar/changelogs/config.yaml b/ansible_collections/ibm/qradar/changelogs/config.yaml index c0c71629b..9959d2506 100644 --- a/ansible_collections/ibm/qradar/changelogs/config.yaml +++ b/ansible_collections/ibm/qradar/changelogs/config.yaml @@ -1,4 +1,5 @@ -changelog_filename_template: CHANGELOG.rst +--- +changelog_filename_template: ../CHANGELOG.rst changelog_filename_version_depth: 0 changes_file: changelog.yaml changes_format: combined @@ -10,21 +11,21 @@ prelude_section_name: release_summary prelude_section_title: Release Summary flatmap: true sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - - major_changes + - Major Changes + - - minor_changes + - Minor Changes + - - breaking_changes + - Breaking Changes / Porting Guide + - - deprecated_features + - Deprecated Features + - - removed_features + - Removed Features (previously deprecated) + - - security_fixes + - Security Fixes + - - bugfixes + - Bugfixes + - - known_issues + - Known Issues title: IBM Qradar Collection trivial_section_name: trivial diff --git a/ansible_collections/ibm/qradar/codecov.yml b/ansible_collections/ibm/qradar/codecov.yml new file mode 100644 index 000000000..c77c91a90 --- /dev/null +++ b/ansible_collections/ibm/qradar/codecov.yml @@ -0,0 +1,15 @@ +--- +codecov: + require_ci_to_pass: true +comment: + layout: " diff, flags, files" + behavior: default + require_changes: false + require_base: false + require_head: true +coverage: + status: + patch: false + project: + default: + threshold: 0.3% diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst index bc657fd5b..99b3c7c81 100644 --- a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst +++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_analytics_rules_module.rst @@ -249,7 +249,7 @@ Examples # Using GATHERED state # -------------------- - - name: Get information about the Rule named "Ansible Example DDOS Rule" + - name: Get information about the Rule named "Ansible Example DDOS Rule" ibm.qradar.qradar_analytics_rules: config: name: "Ansible Example DDOS Rule" @@ -274,7 +274,7 @@ Examples # owner: admin # type: EVENT - - name: Get information about the Rule with ID 100443 + - name: Get information about the Rule with ID 100443 ibm.qradar.qradar_analytics_rules: config: id: 100443 diff --git a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst index f8611f8dd..5ed48ef1e 100644 --- a/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst +++ b/ansible_collections/ibm/qradar/docs/ibm.qradar.qradar_log_sources_management_module.rst @@ -606,7 +606,7 @@ Examples - name: "Apache HTTP Server logs" type_name: "Apache HTTP Server" description: "REPLACED Apache HTTP Server remote logs from rsyslog" - identifier: "192.0.2.1" + identifier: "192.0.2.1" # RUN output: # ----------- diff --git a/ansible_collections/ibm/qradar/meta/runtime.yml b/ansible_collections/ibm/qradar/meta/runtime.yml index 157f6c130..755d4c391 100644 --- a/ansible_collections/ibm/qradar/meta/runtime.yml +++ b/ansible_collections/ibm/qradar/meta/runtime.yml @@ -31,4 +31,4 @@ plugin_routing: redirect: ibm.qradar.qradar_log_source_management log_sources_management: redirect: ibm.qradar.qradar_log_sources_management -requires_ansible: '>=2.9.10' +requires_ansible: ">=2.14.0" diff --git a/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py b/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py index 906cbc9e5..559869c6f 100644 --- a/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py +++ b/ansible_collections/ibm/qradar/plugins/action/qradar_analytics_rules.py @@ -23,27 +23,25 @@ The module file for qradar_analytics_rules from __future__ import absolute_import, division, print_function + __metaclass__ = type import json -from ansible.plugins.action import ActionBase -from ansible.module_utils.connection import Connection + from ansible.module_utils._text import to_text +from ansible.module_utils.connection import Connection from ansible.module_utils.six.moves.urllib.parse import quote - -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, +from ansible.plugins.action import ActionBase +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils +from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( + AnsibleArgSpecValidator, ) + from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( QRadarRequest, remove_unsupported_keys_from_payload_dict, ) -from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( - AnsibleArgSpecValidator, -) -from ansible_collections.ibm.qradar.plugins.modules.qradar_analytics_rules import ( - DOCUMENTATION, -) +from ansible_collections.ibm.qradar.plugins.modules.qradar_analytics_rules import DOCUMENTATION class ActionModule(ActionBase): @@ -86,13 +84,13 @@ class ActionModule(ActionBase): """ if search_for_resource.get("id"): api_obj_url = self.api_object + "/{0}".format( - search_for_resource["id"] + search_for_resource["id"], ) elif search_for_resource.get("name"): api_obj_url = self.api_object + "?filter={0}".format( quote( - 'name="{0}"'.format(to_text(search_for_resource["name"])) - ) + 'name="{0}"'.format(to_text(search_for_resource["name"])), + ), ) elif search_for_resource.get("range"): api_obj_url = self.api_object @@ -104,10 +102,7 @@ class ActionModule(ActionBase): if ( rule_source_exists and len(rule_source_exists) == 1 - and ( - search_for_resource.get("name") - and not search_for_resource.get("id") - ) + and (search_for_resource.get("name") and not search_for_resource.get("id")) ): rule_source_exists = rule_source_exists[0] return rule_source_exists @@ -124,13 +119,14 @@ class ActionModule(ActionBase): after = {} changed = False rule_exists = self.search_for_resource( - qradar_request, module_config_params + qradar_request, + module_config_params, ) if rule_exists: changed = True before = rule_exists code, qradar_return_data = qradar_request.delete( - self.api_object + "/{0}".format(rule_exists["id"]) + self.api_object + "/{0}".format(rule_exists["id"]), ) config.update({"before": before, "after": after}) else: @@ -149,7 +145,8 @@ class ActionModule(ActionBase): changed = False rule_exists = self.search_for_resource( - qradar_request, module_config_params + qradar_request, + module_config_params, ) if rule_exists: if isinstance(rule_exists, list): @@ -168,7 +165,7 @@ class ActionModule(ActionBase): ) if qradar_return_data[0] >= 200: config.update( - {"before": before, "after": qradar_return_data[1]} + {"before": before, "after": qradar_return_data[1]}, ) else: config.update({"before": before}) @@ -179,10 +176,9 @@ class ActionModule(ActionBase): self._result = super(ActionModule, self).run(tmp, task_vars) headers = None if self._task.args.get("config"): - self._task.args[ - "config" - ] = remove_unsupported_keys_from_payload_dict( - self._task.args["config"], self.supported_params + self._task.args["config"] = remove_unsupported_keys_from_payload_dict( + self._task.args["config"], + self.supported_params, ) self._check_argspec() if self._result.get("failed"): @@ -191,20 +187,23 @@ class ActionModule(ActionBase): headers = { "Content-Type": "application/json", "Range": "items={0}".format( - self._task.args["config"]["range"] + self._task.args["config"]["range"], ), } conn = Connection(self._connection.socket_path) if headers: conn_request = QRadarRequest( - connection=conn, headers=headers, task_vars=task_vars + connection=conn, + headers=headers, + task_vars=task_vars, ) else: conn_request = QRadarRequest(connection=conn, task_vars=task_vars) if self._task.args["state"] == "gathered": if self._task.args.get("config"): self._result["gathered"] = self.search_for_resource( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) elif self._task.args["state"] == "merged": if self._task.args.get("config"): @@ -212,7 +211,8 @@ class ActionModule(ActionBase): self._result[self.module_return], self._result["changed"], ) = self.configure_module_api( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) elif self._task.args["state"] == "deleted": if self._task.args.get("config"): @@ -220,7 +220,8 @@ class ActionModule(ActionBase): self._result[self.module_return], self._result["changed"], ) = self.delete_module_api_config( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) return self._result diff --git a/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py b/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py index 5d5efcd5e..c09c32227 100644 --- a/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py +++ b/ansible_collections/ibm/qradar/plugins/action/qradar_log_sources_management.py @@ -23,27 +23,28 @@ The module file for qradar_log_sources_management from __future__ import absolute_import, division, print_function + __metaclass__ = type -from copy import copy import json -from ansible.plugins.action import ActionBase + +from copy import copy + from ansible.errors import AnsibleActionFail from ansible.module_utils.connection import Connection from ansible.module_utils.six.moves.urllib.parse import quote - -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, +from ansible.plugins.action import ActionBase +from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import utils +from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( + AnsibleArgSpecValidator, ) + from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( QRadarRequest, find_dict_in_list, list_to_dict, remove_unsupported_keys_from_payload_dict, ) -from ansible_collections.ansible.utils.plugins.module_utils.common.argspec_validate import ( - AnsibleArgSpecValidator, -) from ansible_collections.ibm.qradar.plugins.modules.qradar_log_sources_management import ( DOCUMENTATION, ) @@ -55,11 +56,13 @@ class ActionModule(ActionBase): def __init__(self, *args, **kwargs): super(ActionModule, self).__init__(*args, **kwargs) self._result = None - self.api_object = ( - "/api/config/event_sources/log_source_management/log_sources" + self.api_object = "/api/config/event_sources/log_source_management/log_sources" + self.api_object_types = ( + "/api/config/event_sources/log_source_management/log_source_types?filter=" + ) + self.api_object_search = ( + "/api/config/event_sources/log_source_management/log_sources?filter=" ) - self.api_object_types = "/api/config/event_sources/log_source_management/log_source_types?filter=" - self.api_object_search = "/api/config/event_sources/log_source_management/log_sources?filter=" self.api_return = "log_sources_management" self.module_return = "qradar_log_sources_management" self.supported_params = [ @@ -98,9 +101,8 @@ class ActionModule(ActionBase): def set_log_source_values(self, qradar_request, config_params): # find log source types details if config_params.get("type_name"): - api_object = self.api_object_types + "{0}".format( - quote('name="{0}"'.format(config_params["type_name"])) + quote('name="{0}"'.format(config_params["type_name"])), ) code, log_source_type_found = qradar_request.get(api_object) if config_params.get("type_id"): @@ -112,7 +114,7 @@ class ActionModule(ActionBase): config_params.pop("type_name") else: raise AnsibleActionFail( - "Incompatible type provided, please consult QRadar Documentation for Log Source Types!" + "Incompatible type provided, please consult QRadar Documentation for Log Source Types!", ) if log_source_type_found: @@ -124,7 +126,7 @@ class ActionModule(ActionBase): ) if not found_dict_in_list: config_params.fail_json( - msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types" + msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types", ) elif log_source_type_found[0].get("protocol_types"): # Set it to the default as provided by the QRadar Instance @@ -142,27 +144,29 @@ class ActionModule(ActionBase): "id": config_params["protocol_type_id"], "name": "identifier", "value": config_params["identifier"], - } + }, ] config_params.pop("identifier") return config_params def search_for_resource_name( - self, qradar_request, search_resource_by_names=None + self, + qradar_request, + search_resource_by_names=None, ): search_result = [] if isinstance(search_resource_by_names, list): for each in search_resource_by_names: each = utils.remove_empties(each) query_api_object = self.api_object_search + "{0}".format( - quote('name="{0}"'.format(each["name"])) + quote('name="{0}"'.format(each["name"])), ) code, log_source_exists = qradar_request.get(query_api_object) if log_source_exists and (code >= 200 and code < 300): search_result.append(log_source_exists[0]) elif isinstance(search_resource_by_names, str): query_api_object = self.api_object_search + "{0}".format( - quote('name="{0}"'.format(search_resource_by_names)) + quote('name="{0}"'.format(search_resource_by_names)), ) code, log_source_exists = qradar_request.get(query_api_object) if log_source_exists and (code >= 200 and code < 300): @@ -182,12 +186,13 @@ class ActionModule(ActionBase): for each in module_config_params: each = utils.remove_empties(each) log_source_exists = self.search_for_resource_name( - qradar_request, each["name"] + qradar_request, + each["name"], ) if log_source_exists: before.append(log_source_exists) query_object = self.api_object + "/{0}".format( - log_source_exists["id"] + log_source_exists["id"], ) code, qradar_return_data = qradar_request.delete(query_object) if code >= 200 and code < 300: @@ -207,7 +212,8 @@ class ActionModule(ActionBase): each = utils.remove_empties(each) each = self.set_log_source_values(conn_request, each) search_result = self.search_for_resource_name( - conn_request, each["name"] + conn_request, + each["name"], ) if search_result: if search_result["name"] == each["name"]: @@ -219,15 +225,15 @@ class ActionModule(ActionBase): if diff: if self._task.args["state"] == "merged": each = utils.remove_empties( - utils.dict_merge(search_result, each) + utils.dict_merge(search_result, each), ) temp_request_param.append(each) elif self._task.args["state"] == "replaced": query_object = self.api_object + "/{0}".format( - search_result["id"] + search_result["id"], ) code, qradar_return_data = conn_request.delete( - query_object + query_object, ) temp_request_param.append(each) else: @@ -254,7 +260,7 @@ class ActionModule(ActionBase): "Failed with http_response: {0} and message: {1}".format( response["http_response"]["message"], response["message"], - ) + ), ) config.update({"before": before, "after": after}) else: @@ -266,10 +272,9 @@ class ActionModule(ActionBase): self._supports_check_mode = True self._result = super(ActionModule, self).run(tmp, task_vars) if self._task.args.get("config"): - self._task.args[ - "config" - ] = remove_unsupported_keys_from_payload_dict( - self._task.args["config"], self.supported_params + self._task.args["config"] = remove_unsupported_keys_from_payload_dict( + self._task.args["config"], + self.supported_params, ) self._check_argspec() if self._result.get("failed"): @@ -279,20 +284,19 @@ class ActionModule(ActionBase): if self._task.args["state"] == "gathered": if self._task.args.get("config"): self._result["gathered"] = self.search_for_resource_name( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) else: self._result["gathered"] = conn_request.get(self.api_object) - elif ( - self._task.args["state"] == "merged" - or self._task.args["state"] == "replaced" - ): + elif self._task.args["state"] == "merged" or self._task.args["state"] == "replaced": if self._task.args.get("config"): ( self._result[self.module_return], self._result["changed"], ) = self.configure_module_api( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) elif self._task.args["state"] == "deleted": if self._task.args.get("config"): @@ -300,7 +304,8 @@ class ActionModule(ActionBase): self._result[self.module_return], self._result["changed"], ) = self.delete_module_api_config( - conn_request, self._task.args["config"] + conn_request, + self._task.args["config"], ) return self._result diff --git a/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py b/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py index 004c7815e..1b394ceee 100644 --- a/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py +++ b/ansible_collections/ibm/qradar/plugins/httpapi/qradar.py @@ -3,6 +3,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type DOCUMENTATION = """ @@ -19,14 +20,11 @@ version_added: "1.0.0" import json from ansible.module_utils.basic import to_text -from ansible.module_utils.six.moves.urllib.error import HTTPError -from ansible_collections.ansible.netcommon.plugins.plugin_utils.httpapi_base import ( - HttpApiBase, -) from ansible.module_utils.connection import ConnectionError -from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( - BASE_HEADERS, -) +from ansible.module_utils.six.moves.urllib.error import HTTPError +from ansible_collections.ansible.netcommon.plugins.plugin_utils.httpapi_base import HttpApiBase + +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import BASE_HEADERS class HttpApi(HttpApiBase): @@ -36,7 +34,10 @@ class HttpApi(HttpApiBase): try: self._display_request(request_method) response, response_data = self.connection.send( - path, payload, method=request_method, headers=headers + path, + payload, + method=request_method, + headers=headers, ) value = self._get_response_value(response_data) diff --git a/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py b/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py index e1569863f..0b57ba7c7 100644 --- a/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py +++ b/ansible_collections/ibm/qradar/plugins/module_utils/qradar.py @@ -6,15 +6,17 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type -from ansible.module_utils.urls import CertificateError -from ansible.module_utils.six.moves.urllib.parse import quote_plus -from ansible.module_utils.connection import ConnectionError -from ansible.module_utils.connection import Connection +import json + +from copy import copy +from ssl import CertificateError + from ansible.module_utils._text import to_text +from ansible.module_utils.connection import Connection, ConnectionError from ansible.module_utils.six import iteritems -from copy import copy -import json +from ansible.module_utils.six.moves.urllib.parse import quote_plus BASE_HEADERS = {"Content-Type": "application/json", "Version": "9.1"} @@ -43,17 +45,17 @@ def set_offense_values(module, qradar_request): found_closing_reason = qradar_request.get_by_path( "api/siem/offense_closing_reasons?filter={0}".format( quote_plus( - 'text="{0}"'.format(module.params["closing_reason"]) - ) - ) + 'text="{0}"'.format(module.params["closing_reason"]), + ), + ), ) if found_closing_reason: module.params["closing_reason_id"] = found_closing_reason[0]["id"] else: module.fail_json( "Unable to find closing_reason text: {0}".format( - module.params["closing_reason"] - ) + module.params["closing_reason"], + ), ) if module.params["status"]: @@ -97,7 +99,7 @@ def list_to_dict(input_dict): if each.get("id") or each.get("id") == 0: each.pop("id") each_key_values = "_".join( - [str(x) for x in each.values()] + [str(x) for x in each.values()], ) temp_dict.update({each_key_values: each}) input_dict[k] = temp_dict @@ -141,20 +143,23 @@ class QRadarRequest(object): response = {} try: code, response = self.connection.send_request( - method, uri, payload=payload, headers=self.headers + method, + uri, + payload=payload, + headers=self.headers, ) except ConnectionError as e: self.module.fail_json( - msg="connection error occurred: {0}".format(e) + msg="connection error occurred: {0}".format(e), ) except CertificateError as e: self.module.fail_json( - msg="certificate error occurred: {0}".format(e) + msg="certificate error occurred: {0}".format(e), ) except ValueError as e: try: self.module.fail_json( - msg="certificate not found: {0}".format(e) + msg="certificate not found: {0}".format(e), ) except AttributeError: pass @@ -167,7 +172,7 @@ class QRadarRequest(object): ): return {} if to_text("The rule does not exist.") in to_text( - response["description"] + response["description"], ): return code, {} @@ -180,15 +185,17 @@ class QRadarRequest(object): else: self.module.fail_json( msg="qradar httpapi returned error {0} with message {1}".format( - code, response - ) + code, + response, + ), ) elif not (code >= 200 and code < 300): try: self.module.fail_json( msg="qradar httpapi returned error {0} with message {1}".format( - code, response - ) + code, + response, + ), ) except AttributeError: pass @@ -229,7 +236,7 @@ class QRadarRequest(object): except TypeError as e: self.module.fail_json( - msg="invalid data type provided: {0}".format(e) + msg="invalid data type provided: {0}".format(e), ) def post_by_path(self, rest_path, data=None): diff --git a/ansible_collections/ibm/qradar/plugins/modules/deploy.py b/ansible_collections/ibm/qradar/plugins/modules/deploy.py index dc41acd99..40bb41244 100644 --- a/ansible_collections/ibm/qradar/plugins/modules/deploy.py +++ b/ansible_collections/ibm/qradar/plugins/modules/deploy.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type DOCUMENTATION = """ @@ -37,22 +38,19 @@ EXAMPLES = """ type: INCREMENTAL """ -from ansible.module_utils.basic import AnsibleModule from ansible.module_utils._text import to_text +from ansible.module_utils.basic import AnsibleModule -from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( - QRadarRequest, -) +from ansible_collections.ibm.qradar.plugins.module_utils.qradar import QRadarRequest def main(): - argspec = dict( type=dict( choices=["INCREMENTAL", "FULL"], required=False, default="INCREMENTAL", - ) + ), ) module = AnsibleModule(argument_spec=argspec, supports_check_mode=False) @@ -63,12 +61,11 @@ def main(): ) qradar_return_data = qradar_request.post_by_path( - "api/staged_config/deploy_status" + "api/staged_config/deploy_status", ) if "message" in qradar_return_data and ( - to_text("No changes to deploy") - in to_text(qradar_return_data["message"]) + to_text("No changes to deploy") in to_text(qradar_return_data["message"]) ): module.exit_json( msg="No changes to deploy", @@ -78,7 +75,7 @@ def main(): else: module.exit_json( msg="Successfully initiated {0} deployment.".format( - module.params["type"] + module.params["type"], ), qradar_return_data=qradar_return_data, changed=True, diff --git a/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py b/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py index fa793a596..18f2a7ecd 100644 --- a/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py +++ b/ansible_collections/ibm/qradar/plugins/modules/log_source_management.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type DOCUMENTATION = """ @@ -73,31 +74,31 @@ EXAMPLES = """ identifier: "192.168.1.101" """ -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils._text import to_text +import json +from ansible.module_utils._text import to_text +from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.six.moves.urllib.parse import quote + from ansible_collections.ibm.qradar.plugins.module_utils.qradar import ( QRadarRequest, find_dict_in_list, ) -import json - def set_log_source_values(module, qradar_request): if module.params["type_name"]: code, query_response = qradar_request.get( "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format( - quote('name="{0}"'.format(module.params["type_name"])) - ) + quote('name="{0}"'.format(module.params["type_name"])), + ), ) log_source_type_found = query_response[0] if module.params["type_id"]: code, query_response = qradar_request.get( "/api/config/event_sources/log_source_management/log_source_types?filter={0}".format( - quote('name="{0}"'.format(module.params["type_name"])) - ) + quote('name="{0}"'.format(module.params["type_name"])), + ), ) code, log_source_type_found = query_response[0] if log_source_type_found: @@ -105,7 +106,7 @@ def set_log_source_values(module, qradar_request): module.params["type_id"] = log_source_type_found["id"] else: module.fail_json( - msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types" + msg="Incompatible type provided, please consult QRadar Documentation for Log Source Types", ) if module.params["protocol_type_id"]: @@ -116,25 +117,24 @@ def set_log_source_values(module, qradar_request): ) if not found_dict_in_list: module.fail_json( - msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types" + msg="Incompatible protocol_type_id provided, please consult QRadar Documentation for Log Source Types", ) else: # Set it to the default as provided by the QRadar Instance - module.params["protocol_type_id"] = log_source_type_found[ - "protocol_types" - ][0]["protocol_id"] + module.params["protocol_type_id"] = log_source_type_found["protocol_types"][0][ + "protocol_id" + ] module.params["protocol_parameters"] = [ { "id": module.params["protocol_type_id"], "name": "identifier", "value": module.params["identifier"], - } + }, ] def main(): - argspec = dict( name=dict(required=True, type="str"), state=dict(choices=["present", "absent"], required=True), @@ -159,12 +159,11 @@ def main(): code, log_source_exists = qradar_request.get( "/api/config/event_sources/log_source_management/log_sources?filter={0}".format( - quote('name="{0}"'.format(module.params["name"])) - ) + quote('name="{0}"'.format(module.params["name"])), + ), ) if log_source_exists: - if module.params["state"] == "present": ( existing_log_source_protocol_identifier, @@ -178,8 +177,7 @@ def main(): set_log_source_values(module, qradar_request) comparison_map = [ - existing_log_source_protocol_identifier["value"] - == module.params["identifier"], + existing_log_source_protocol_identifier["value"] == module.params["identifier"], log_source_exists[0]["name"] == module.params["name"], log_source_exists[0]["type_id"] == module.params["type_id"], to_text(log_source_exists[0]["description"]) @@ -189,17 +187,15 @@ def main(): if all(comparison_map): module.exit_json(changed=False, msg="Nothing to do.") else: - log_source_exists[0]["protocol_parameters"][ - _elspi_index - ] = module.params["protocol_parameters"][0] + log_source_exists[0]["protocol_parameters"][_elspi_index] = module.params[ + "protocol_parameters" + ][0] log_source_exists[0]["name"] = module.params["name"] log_source_exists[0]["type_id"] = module.params["type_id"] - log_source_exists[0]["description"] = module.params[ - "description" - ] + log_source_exists[0]["description"] = module.params["description"] if module.check_mode: qradar_return_data = { - "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE", } else: code, qradar_return_data = qradar_request.create_update( @@ -209,7 +205,7 @@ def main(): module.exit_json( msg="Successfully updated log source: {0}".format( - module.params["name"] + module.params["name"], ), qradar_return_data=qradar_return_data, changed=True, @@ -218,18 +214,18 @@ def main(): if module.params["state"] == "absent": if module.check_mode: qradar_return_data = { - "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE", } else: code, qradar_return_data = qradar_request.delete( "/api/config/event_sources/log_source_management/log_sources/{0}".format( - log_source_exists[0]["id"] - ) + log_source_exists[0]["id"], + ), ) module.exit_json( msg="Successfully deleted log source: {0}".format( - module.params["name"] + module.params["name"], ), qradar_return_data=qradar_return_data, changed=True, @@ -239,7 +235,7 @@ def main(): set_log_source_values(module, qradar_request) if module.check_mode: qradar_return_data = { - "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE" + "EMPTY": "IN CHECK MODE, NO TRANSACTION TOOK PLACE", } else: code, qradar_return_data = qradar_request.create_update( @@ -249,7 +245,7 @@ def main(): module.exit_json( msg="Successfully created log source: {0}".format( - module.params["name"] + module.params["name"], ), qradar_return_data=qradar_return_data, changed=True, diff --git a/ansible_collections/ibm/qradar/plugins/modules/offense_action.py b/ansible_collections/ibm/qradar/plugins/modules/offense_action.py index 784f1e7b1..4944f4627 100644 --- a/ansible_collections/ibm/qradar/plugins/modules/offense_action.py +++ b/ansible_collections/ibm/qradar/plugins/modules/offense_action.py @@ -6,6 +6,7 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type DOCUMENTATION = """ @@ -72,8 +73,8 @@ author: Ansible Security Automation Team (@maxamillion) '3.5' +# For ansible-tox-linters +black==23.3.0 ; python_version >= '3.7' flake8 -mock ; python_version < '3.5' -pexpect -pytest-xdist yamllint -coverage==4.5.4 -git+https://github.com/ansible-community/pytest-ansible-units.git + +# Unit test runner +pytest-ansible ; python_version >= '3.9' +git+https://github.com/ansible-community/pytest-ansible-units.git ; python_version < '3.9' +pytest-xdist diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml index cf547abcb..88ae78609 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/log_source_management/tasks/main.yml @@ -1,60 +1,60 @@ --- - name: Create Testing Apache HTTP Server log source log_source_management: - name: "Testing Collections PB - 192.168.1.112" - type_name: "Apache HTTP Server" + name: Testing Collections PB - 192.168.1.112 + type_name: Apache HTTP Server state: present - description: "Testing Collection PB Description" - identifier: "192.168.1.112" + description: Testing Collection PB Description + identifier: 192.168.1.112 register: snort_log_source_create - name: Assert Create Test Apache HTTP Server log source changed - assert: + ansible.builtin.assert: that: - snort_log_source_create is changed - snort_log_source_create is not failed - name: Create Testing Apache HTTP Server log source RERUN log_source_management: - name: "Testing Collections PB - 192.168.1.112" - type_name: "Apache HTTP Server" + name: Testing Collections PB - 192.168.1.112 + type_name: Apache HTTP Server state: present - description: "Testing Collection PB Description" - identifier: "192.168.1.112" + description: Testing Collection PB Description + identifier: 192.168.1.112 register: snort_log_source_create_rerun - name: Assert Create Test Apache HTTP Server log source is not changed on RERUN - assert: + ansible.builtin.assert: that: - snort_log_source_create_rerun is not changed - snort_log_source_create_rerun is not failed - name: Delete Testing Apache HTTP Server log source log_source_management: - name: "Testing Collections PB - 192.168.1.112" - type_name: "Apache HTTP Server" + name: Testing Collections PB - 192.168.1.112 + type_name: Apache HTTP Server state: absent - description: "Testing Collection PB Description" - identifier: "192.168.1.112" + description: Testing Collection PB Description + identifier: 192.168.1.112 register: snort_log_source_delete - name: Assert Delete Test Apache HTTP Server log source changed - assert: + ansible.builtin.assert: that: - snort_log_source_delete is changed - snort_log_source_delete is not failed - name: Delete Testing Apache HTTP Server log source RERUN log_source_management: - name: "Testing Collections PB - 192.168.1.112" - type_name: "Apache HTTP Server" + name: Testing Collections PB - 192.168.1.112 + type_name: Apache HTTP Server state: absent - description: "Testing Collection PB Description" - identifier: "192.168.1.112" + description: Testing Collection PB Description + identifier: 192.168.1.112 register: snort_log_source_delete_rerun - name: Assert Delete Test Apache HTTP Server log source is not changed on RERUN - assert: + ansible.builtin.assert: that: - snort_log_source_delete_rerun is not changed - snort_log_source_delete_rerun is not failed diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml index 7495ec9b8..f93cb9657 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/offense/tasks/main.yml @@ -1,19 +1,18 @@ --- - -#- qradar_offense_action: -# id: 1 -# status: "hidden" -# assigned_to: "admin" -# protected: false +# - qradar_offense_action: +# id: 1 +# status: "hidden" +# assigned_to: "admin" +# protected: false # -#- qradar_offense_note: -# offense_id: 2 -# note_text: "testing note text from playbook - modified" +# - qradar_offense_note: +# offense_id: 2 +# note_text: "testing note text from playbook - modified" # -#- name: get info about qradar offense -# qradar_offense_info: -# protected: true -# status: "HIDDEN" -# register: offense_info +# - name: get info about qradar offense +# qradar_offense_info: +# protected: true +# status: "HIDDEN" +# register: offense_info # -#- debug: var=offense_info +# - debug: var=offense_info diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml index 10c0fabcb..5f709c5aa 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/defaults/main.yaml @@ -1,2 +1,2 @@ --- -testcase: '*' +testcase: "*" diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml index dc4768b5c..2d5ece550 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/cli.yaml @@ -1,18 +1,19 @@ --- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/cli' - patterns: '{{ testcase }}.yaml' +- name: Collect all cli test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/cli" + patterns: "{{ testcase }}.yaml" register: test_cases -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" +- name: Set test_items + ansible.builtin.set_fact: + test_items: "{{ test_cases.files | map(attribute='path') | list }}" - name: Run test case (connection=ansible.netcommon.httpapi) - include: '{{ test_case_to_run }}' + ansible.builtin._include: "{{ test_case_to_run }}" vars: ansible_connection: ansible.netcommon.httpapi - with_items: '{{ test_items }}' + with_items: "{{ test_items }}" loop_control: loop_var: test_case_to_run tags: connection_httpapi diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml index 62cc1ae1e..098fa1e5a 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/main.yaml @@ -1,7 +1,7 @@ --- -- include: cli.yaml +- ansible.builtin._include: cli.yaml tags: - cli -- include: redirection.yaml +- ansible.builtin._include: redirection.yaml when: ansible_version.full is version('2.10.0', '>=') diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml index a57054c7d..9172f3018 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tasks/redirection.yaml @@ -1,6 +1,6 @@ --- -- name: collect all cli test cases - find: - paths: '{{ role_path }}/tests/redirection' - patterns: '{{ testcase }}.yaml' +- name: Collect all cli test cases + ansible.builtin.find: + paths: "{{ role_path }}/tests/redirection" + patterns: "{{ testcase }}.yaml" register: test_cases diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml index 0b8e6b8f6..7c1608c00 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_populate_log_sources_config.yaml @@ -1,14 +1,14 @@ --- - name: Populate Log Sources Management for tests tags: merged - ibm.qradar.qradar_log_sources_management: &id001 + ibm.qradar.qradar_log_sources_management: state: merged config: - - name: "Snort logs" - type_name: "Snort Open Source IDS" - description: "Snort IDS remote logs from rsyslog" - identifier: "192.0.2.1" - - name: "Apache HTTP Server logs" - type_name: "Apache HTTP Server" - description: "Apache HTTP Server remote logs from rsyslog" - identifier: "198.51.100.1" \ No newline at end of file + - name: Snort logs + type_name: Snort Open Source IDS + description: Snort IDS remote logs from rsyslog + identifier: 192.0.2.1 + - name: Apache HTTP Server logs + type_name: Apache HTTP Server + description: Apache HTTP Server remote logs from rsyslog + identifier: 198.51.100.1 diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml index e7f5896be..ed0cc55c4 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/_remove_log_sources_config.yaml @@ -3,5 +3,5 @@ ibm.qradar.qradar_log_sources_management: state: deleted config: - - name: "Snort logs" - - name: "Apache HTTP Server logs" \ No newline at end of file + - name: Snort logs + - name: Apache HTTP Server logs diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml index f5c70826b..21df8087f 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/deleted.yaml @@ -1,27 +1,24 @@ --- - debug: - msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection - }} + msg: Start Deleted integration state for qradar_log_sources_management ansible_connection={{ ansible_connection }} - include_tasks: _remove_log_sources_config.yaml - include_tasks: _populate_log_sources_config.yaml - block: - - name: Delete attributes of provided configured Log Sources Management register: result ibm.qradar.qradar_log_sources_management: &id001 config: - - name: "Snort logs" - - name: "Apache HTTP Server logs" + - name: Snort logs + - name: Apache HTTP Server logs state: deleted - assert: that: - result.changed == true - - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\ - \ length == 4 }}" + - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 4 }}" - merged['before'] == result['qradar_log_sources_management']['after'] - name: Delete attributes of all configured Log Sources Management (IDEMPOTENT) @@ -34,5 +31,4 @@ - result.changed == false always: - - include_tasks: _remove_log_sources_config.yaml diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml index c30ad1646..4539c444a 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/gathered.yaml @@ -1,27 +1,23 @@ --- - debug: - msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection - }} + msg: START qradar_log_sources_management gathered integration tests on connection={{ ansible_connection }} - include_tasks: _remove_log_sources_config.yaml - include_tasks: _populate_log_sources_config.yaml - block: - - name: Gather the provided configuration with the exisiting running configuration register: result ibm.qradar.qradar_log_sources_management: config: - - name: "Snort logs" - - name: "Apache HTTP Server logs" + - name: Snort logs + - name: Apache HTTP Server logs state: gathered - assert: that: - - "{{ merged['after'] | symmetric_difference(result['gathered']) |\ - \ length == 4 }}" + - "{{ merged['after'] | symmetric_difference(result['gathered']) | length == 4 }}" - result['changed'] == false always: - - include_tasks: _remove_log_sources_config.yaml diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml index 224671edb..d4cd1a2aa 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/merged.yaml @@ -1,26 +1,24 @@ --- - debug: - msg: START Merged qradar_log_sources_management state for integration tests on connection={{ - ansible_connection }} + msg: START Merged qradar_log_sources_management state for integration tests on connection={{ ansible_connection }} - include_tasks: _remove_log_sources_config.yaml - block: - - name: Merge and Create new Log Sources Management tags: merged register: result ibm.qradar.qradar_log_sources_management: &id001 state: merged config: - - name: "Snort logs" - type_name: "Snort Open Source IDS" - description: "Snort IDS remote logs from rsyslog" - identifier: "192.0.2.1" - - name: "Apache HTTP Server logs" - type_name: "Apache HTTP Server" - description: "Apache HTTP Server remote logs from rsyslog" - identifier: "198.51.100.1" + - name: Snort logs + type_name: Snort Open Source IDS + description: Snort IDS remote logs from rsyslog + identifier: 192.0.2.1 + - name: Apache HTTP Server logs + type_name: Apache HTTP Server + description: Apache HTTP Server remote logs from rsyslog + identifier: 198.51.100.1 - name: To remove creation_date from the after dict set_fact: @@ -28,7 +26,7 @@ when: "{{item.key not in ['creation_date']}}" with_dict: "{{ dict }}" loop: "{{ result['qradar_log_sources_management']['after'] }}" - + - name: To remove modified_date from the after dict set_fact: after: "{{ after | default([]) | combine({ item.key : item.value }) }}" @@ -47,8 +45,7 @@ assert: that: - result['changed'] == true - - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\ - \ length == 4 }}" + - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 4 }}" - name: Assert that before dicts are correctly generated assert: @@ -65,5 +62,4 @@ - result['changed'] == false always: - - - include_tasks: _remove_log_sources_config.yaml \ No newline at end of file + - include_tasks: _remove_log_sources_config.yaml diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml index d8dfd7373..bc241ed9e 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/replaced.yaml @@ -1,37 +1,32 @@ --- - debug: - msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection - }} + msg: START Replaced qradar_log_sources_management state for integration tests on connection={{ ansible_connection }} - include_tasks: _remove_log_sources_config.yaml - include_tasks: _populate_log_sources_config.yaml - block: - - name: Replace existing Log Sources Management register: result ibm.qradar.qradar_log_sources_management: &id001 state: replaced config: - - name: "Snort logs" - type_name: "Snort Open Source IDS" - description: "REPLACED Snort IDS remote logs from rsyslog" - identifier: "198.51.100.1" - - name: "Apache HTTP Server logs" - type_name: "Apache HTTP Server" - description: "REPLACED Apache HTTP Server remote logs from rsyslog" - identifier: "192.0.2.1" + - name: Snort logs + type_name: Snort Open Source IDS + description: REPLACED Snort IDS remote logs from rsyslog + identifier: 198.51.100.1 + - name: Apache HTTP Server logs + type_name: Apache HTTP Server + description: REPLACED Apache HTTP Server remote logs from rsyslog + identifier: 192.0.2.1 - assert: that: - result.changed == true - - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\ - \ length == 4 }}" - - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\ - \ length == 4 }}" + - "{{ merged['after'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 4 }}" + - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 4 }}" - - name: Replaces device configuration of listed Log Sources Management with provided configuration - (IDEMPOTENT) + - name: Replaces device configuration of listed Log Sources Management with provided configuration (IDEMPOTENT) register: result ibm.qradar.qradar_log_sources_management: *id001 @@ -41,5 +36,4 @@ - result['changed'] == false always: - - include_tasks: _remove_log_sources_config.yaml diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml index 0536a6a73..c7c6230ae 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/tests/cli/rtt.yaml @@ -1,51 +1,47 @@ --- - debug: - msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection - }} + msg: START qradar_log_sources_management round trip integration tests on connection={{ ansible_connection }} - include_tasks: _remove_log_sources_config.yaml - block: - - name: Apply the provided configuration (base config) register: base_config - ibm.qradar.qradar_log_sources_management: &id001 + ibm.qradar.qradar_log_sources_management: state: merged config: - - name: "Snort logs" - type_name: "Snort Open Source IDS" - description: "Snort IDS remote logs from rsyslog" - identifier: "192.0.2.1" - - name: "Apache HTTP Server logs" - type_name: "Apache HTTP Server" - description: "Apache HTTP Server remote logs from rsyslog" - identifier: "198.51.100.1" + - name: Snort logs + type_name: Snort Open Source IDS + description: Snort IDS remote logs from rsyslog + identifier: 192.0.2.1 + - name: Apache HTTP Server logs + type_name: Apache HTTP Server + description: Apache HTTP Server remote logs from rsyslog + identifier: 198.51.100.1 - name: Gather Qradar Log Sources Management facts register: gather_result ibm.qradar.qradar_log_sources_management: config: - - name: "Snort logs" - - name: "Apache HTTP Server logs" + - name: Snort logs + - name: Apache HTTP Server logs state: gathered - name: Apply the configuration which need to be reverted register: result ibm.qradar.qradar_log_sources_management: config: - - name: "Snort logs" - type_name: "Snort Open Source IDS" - description: "REPLACED Snort IDS remote logs from rsyslog" - identifier: "198.51.100.1" + - name: Snort logs + type_name: Snort Open Source IDS + description: REPLACED Snort IDS remote logs from rsyslog + identifier: 198.51.100.1 state: replaced - assert: that: - result.changed == true - - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) |\ - \ length == 1 }}" - - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) |\ - \ length == 3 }}" + - "{{ merged['before'] | symmetric_difference(result['qradar_log_sources_management']['before']) | length == 1 }}" + - "{{ replaced['after'] | symmetric_difference(result['qradar_log_sources_management']['after']) | length == 3 }}" - name: Revert back to base config using facts round trip register: revert @@ -58,5 +54,4 @@ - revert['changed'] == true always: - - include_tasks: _remove_log_sources_config.yaml diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml index 7e7c63c52..488ca2746 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/qradar_log_sources_management/vars/main.yaml @@ -1,7 +1,6 @@ --- merged: before: [] - after: - auto_discovered: false average_eps: 0 @@ -11,30 +10,30 @@ merged: enabled: true gateway: false group_ids: - - 0 + - 0 internal: false language_id: 1 last_event_time: 0 - log_source_extension_id: null + log_source_extension_id: name: Snort logs protocol_parameters: - - id: 1 - name: incomingPayloadEncoding - value: UTF-8 - - id: 0 - name: identifier - value: 192.0.2.1 + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 192.0.2.1 protocol_type_id: 0 requires_deploy: true status: last_updated: 0 - messages: null + messages: status: NA store_event_payload: true target_event_collector_id: 7 type_id: 2 - wincollect_external_destination_ids: null - wincollect_internal_destination_id: null + wincollect_external_destination_ids: + wincollect_internal_destination_id: - auto_discovered: false average_eps: 0 coalesce_events: true @@ -43,30 +42,30 @@ merged: enabled: true gateway: false group_ids: - - 0 + - 0 internal: false language_id: 1 last_event_time: 0 - log_source_extension_id: null + log_source_extension_id: name: Apache HTTP Server logs protocol_parameters: - - id: 1 - name: incomingPayloadEncoding - value: UTF-8 - - id: 0 - name: identifier - value: 198.51.100.1 + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 198.51.100.1 protocol_type_id: 0 requires_deploy: true status: last_updated: 0 - messages: null + messages: status: NA store_event_payload: true target_event_collector_id: 7 type_id: 10 - wincollect_external_destination_ids: null - wincollect_internal_destination_id: null + wincollect_external_destination_ids: + wincollect_internal_destination_id: replaced: after: @@ -78,30 +77,30 @@ replaced: enabled: true gateway: false group_ids: - - 0 + - 0 internal: false language_id: 1 last_event_time: 0 - log_source_extension_id: null + log_source_extension_id: name: Snort logs protocol_parameters: - - id: 1 - name: incomingPayloadEncoding - value: UTF-8 - - id: 0 - name: identifier - value: 198.51.100.1 + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 198.51.100.1 protocol_type_id: 0 requires_deploy: true status: last_updated: 0 - messages: null + messages: status: NA store_event_payload: true target_event_collector_id: 7 type_id: 2 - wincollect_external_destination_ids: null - wincollect_internal_destination_id: null + wincollect_external_destination_ids: + wincollect_internal_destination_id: - auto_discovered: false average_eps: 0 coalesce_events: true @@ -110,27 +109,27 @@ replaced: enabled: true gateway: false group_ids: - - 0 + - 0 internal: false language_id: 1 last_event_time: 0 - log_source_extension_id: null + log_source_extension_id: name: Apache HTTP Server logs protocol_parameters: - - id: 1 - name: incomingPayloadEncoding - value: UTF-8 - - id: 0 - name: identifier - value: 192.0.2.1 + - id: 1 + name: incomingPayloadEncoding + value: UTF-8 + - id: 0 + name: identifier + value: 192.0.2.1 protocol_type_id: 0 requires_deploy: true status: last_updated: 0 - messages: null + messages: status: NA store_event_payload: true target_event_collector_id: 7 type_id: 10 - wincollect_external_destination_ids: null - wincollect_internal_destination_id: null + wincollect_external_destination_ids: + wincollect_internal_destination_id: diff --git a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml index 142fd613d..b72873a3d 100644 --- a/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml +++ b/ansible_collections/ibm/qradar/tests/integration/targets/rule/tasks/main.yml @@ -1,55 +1,57 @@ --- -- name: get info about qradar offense +- name: Get info about qradar offense rule_info: - name: "Service DoS Attack Detected" + name: Service DoS Attack Detected register: rule_info -- debug: var=rule_info +- name: Debug rule_info + ansible.builtin.debug: + var: rule_info -- name: enable rule by id +- name: Enable rule by id rule: state: enabled - id: "{{ rule_info['rules'][0]['id']|int }}" + id: "{{ rule_info['rules'][0]['id'] | int }}" register: enable_rule_by_id -- name: ensure enable rule by id - assert: +- name: Ensure enable rule by id + ansible.builtin.assert: that: - enable_rule_by_id is changed - enable_rule_by_id is not failed -- name: enable rule by id again +- name: Enable rule by id again rule: state: enabled - id: "{{ rule_info['rules'][0]['id']|int }}" + id: "{{ rule_info['rules'][0]['id'] | int }}" register: enable_rule_by_id_again -- name: ensure enable rule by id again - assert: +- name: Ensure enable rule by id again + ansible.builtin.assert: that: - enable_rule_by_id_again is not changed - enable_rule_by_id_again is not failed -- name: disable rule by id +- name: Disable rule by id rule: state: disabled - id: "{{ rule_info['rules'][0]['id']|int }}" + id: "{{ rule_info['rules'][0]['id'] | int }}" register: disable_rule_by_id -- name: ensure disable rule by id - assert: +- name: Ensure disable rule by id + ansible.builtin.assert: that: - disable_rule_by_id is changed - disable_rule_by_id is not failed -- name: disable rule by id again +- name: Disable rule by id again rule: state: disabled - id: "{{ rule_info['rules'][0]['id']|int }}" + id: "{{ rule_info['rules'][0]['id'] | int }}" register: disable_rule_by_id_again -- name: ensure disable rule by id again - assert: +- name: Ensure disable rule by id again + ansible.builtin.assert: that: - disable_rule_by_id_again is not changed - disable_rule_by_id_again is not failed diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py b/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py deleted file mode 100644 index bfc8adfbe..000000000 --- a/ansible_collections/ibm/qradar/tests/unit/compat/builtins.py +++ /dev/null @@ -1,34 +0,0 @@ -# (c) 2014, Toshio Kuratomi -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see . - -# Make coding more python3-ish -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -# -# Compat for python2.7 -# - -# One unittest needs to import builtins via __import__() so we need to have -# the string that represents it -try: - import __builtin__ -except ImportError: - BUILTINS = "builtins" -else: - BUILTINS = "__builtin__" diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/mock.py b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py index 2ea98a17f..61ac88700 100644 --- a/ansible_collections/ibm/qradar/tests/unit/compat/mock.py +++ b/ansible_collections/ibm/qradar/tests/unit/compat/mock.py @@ -19,6 +19,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type """ @@ -26,6 +27,7 @@ Compat module for Python3.x's unittest.mock module """ import sys + # Python 2.7 # Note: Could use the pypi mock library on python3.x as well as python2.x. It @@ -104,7 +106,7 @@ if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): import _io file_spec = list( - set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))) + set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))), ) if mock is None: diff --git a/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py index df3379b82..df4266ec9 100644 --- a/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py +++ b/ansible_collections/ibm/qradar/tests/unit/compat/unittest.py @@ -18,6 +18,7 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type """ @@ -26,6 +27,7 @@ Compat module for Python2.7's unittest module import sys + # Allow wildcard import because we really do want to import all of # unittests's symbols into this compat shim # pylint: disable=wildcard-import,unused-wildcard-import diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/loader.py b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py index 19c44a7e8..011c67b29 100644 --- a/ansible_collections/ibm/qradar/tests/unit/mock/loader.py +++ b/ansible_collections/ibm/qradar/tests/unit/mock/loader.py @@ -18,19 +18,20 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type import os from ansible.errors import AnsibleParserError -from ansible.parsing.dataloader import DataLoader from ansible.module_utils._text import to_bytes, to_text +from ansible.parsing.dataloader import DataLoader class DictDataLoader(DataLoader): def __init__(self, file_mapping=None): file_mapping = {} if file_mapping is None else file_mapping - assert type(file_mapping) == dict + assert isinstance(file_mapping, dict) super(DictDataLoader, self).__init__() diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/path.py b/ansible_collections/ibm/qradar/tests/unit/mock/path.py index 1e5902864..f69b4822b 100644 --- a/ansible_collections/ibm/qradar/tests/unit/mock/path.py +++ b/ansible_collections/ibm/qradar/tests/unit/mock/path.py @@ -1,12 +1,12 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type -from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import ( - MagicMock, -) from ansible.utils.path import unfrackpath +from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import MagicMock mock_unfrackpath_noop = MagicMock( - spec_set=unfrackpath, side_effect=lambda x, *args, **kwargs: x + spec_set=unfrackpath, + side_effect=lambda x, *args, **kwargs: x, ) diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py index f7ab5fe91..83c7d00bd 100644 --- a/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py +++ b/ansible_collections/ibm/qradar/tests/unit/mock/procenv.py @@ -19,16 +19,18 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type -import sys import json +import sys from contextlib import contextmanager from io import BytesIO, StringIO -from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest -from ansible.module_utils.six import PY3 + from ansible.module_utils._text import to_bytes +from ansible.module_utils.six import PY3 +from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest @contextmanager diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py index b34ae1340..82d01f5c5 100644 --- a/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py +++ b/ansible_collections/ibm/qradar/tests/unit/mock/vault_helper.py @@ -14,10 +14,10 @@ # Make coding more python3-ish from __future__ import absolute_import, division, print_function + __metaclass__ = type from ansible.module_utils._text import to_bytes - from ansible.parsing.vault import VaultSecret @@ -38,5 +38,7 @@ class TextVaultSecret(VaultSecret): def bytes(self): """The text encoded with encoding, unless we specifically set _bytes.""" return self._bytes or to_bytes( - self.text, encoding=self.encoding, errors=self.errors + self.text, + encoding=self.encoding, + errors=self.errors, ) diff --git a/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py index 5df30aaed..e46d3180b 100644 --- a/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py +++ b/ansible_collections/ibm/qradar/tests/unit/mock/yaml_helper.py @@ -1,12 +1,14 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type import io + import yaml from ansible.module_utils.six import PY3 -from ansible.parsing.yaml.loader import AnsibleLoader from ansible.parsing.yaml.dumper import AnsibleDumper +from ansible.parsing.yaml.loader import AnsibleLoader class YamlTestUtils(object): @@ -45,7 +47,8 @@ class YamlTestUtils(object): # dump the gen 2 objects directory to strings string_from_object_dump_2 = self._dump_string( - obj_2, dumper=AnsibleDumper + obj_2, + dumper=AnsibleDumper, ) # The gen 1 and gen 2 yaml strings @@ -59,7 +62,8 @@ class YamlTestUtils(object): obj_3 = loader_3.get_data() string_from_object_dump_3 = self._dump_string( - obj_3, dumper=AnsibleDumper + obj_3, + dumper=AnsibleDumper, ) self.assertEqual(obj, obj_3) @@ -93,10 +97,14 @@ class YamlTestUtils(object): if PY3: yaml.dump( - obj_from_stream, stream_obj_from_stream, Dumper=AnsibleDumper + obj_from_stream, + stream_obj_from_stream, + Dumper=AnsibleDumper, ) yaml.dump( - obj_from_stream, stream_obj_from_string, Dumper=AnsibleDumper + obj_from_stream, + stream_obj_from_string, + Dumper=AnsibleDumper, ) else: yaml.dump( @@ -120,25 +128,27 @@ class YamlTestUtils(object): if PY3: yaml_string_obj_from_stream = yaml.dump( - obj_from_stream, Dumper=AnsibleDumper + obj_from_stream, + Dumper=AnsibleDumper, ) yaml_string_obj_from_string = yaml.dump( - obj_from_string, Dumper=AnsibleDumper + obj_from_string, + Dumper=AnsibleDumper, ) else: yaml_string_obj_from_stream = yaml.dump( - obj_from_stream, Dumper=AnsibleDumper, encoding=None + obj_from_stream, + Dumper=AnsibleDumper, + encoding=None, ) yaml_string_obj_from_string = yaml.dump( - obj_from_string, Dumper=AnsibleDumper, encoding=None + obj_from_string, + Dumper=AnsibleDumper, + encoding=None, ) assert yaml_string == yaml_string_obj_from_stream - assert ( - yaml_string - == yaml_string_obj_from_stream - == yaml_string_obj_from_string - ) + assert yaml_string == yaml_string_obj_from_stream == yaml_string_obj_from_string assert ( yaml_string == yaml_string_obj_from_stream diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py index 390992698..c24441308 100644 --- a/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py +++ b/ansible_collections/ibm/qradar/tests/unit/plugins/action/test_qradar_analytics_rules.py @@ -18,19 +18,18 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type -import unittest import tempfile +import unittest + from ansible.playbook.task import Task from ansible.template import Templar -from ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules import ( - ActionModule, -) -from ansible_collections.ansible.utils.tests.unit.compat.mock import ( - MagicMock, - patch, -) +from ansible_collections.ansible.utils.tests.unit.compat.mock import MagicMock, patch + +from ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules import ActionModule + RESPONSE_PAYLOAD = { "average_capacity": "null", @@ -64,7 +63,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): # Ansible <= 2.13 looks for check_mode in play_context play_context.check_mode = False connection = patch( - "ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules.Connection" + "ansible_collections.ibm.qradar.plugins.action.qradar_analytics_rules.Connection", ) fake_loader = {} templar = Templar(loader=fake_loader) @@ -83,9 +82,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): def test_qradar_analytics_rules_merged(self, connection): self._plugin.search_for_resource = MagicMock() self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD - self._plugin._connection.socket_path = ( - tempfile.NamedTemporaryFile().name - ) + self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name self._plugin._connection._shell = MagicMock() self._plugin._task.args = { "state": "merged", @@ -96,9 +93,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): @patch("ansible.module_utils.connection.Connection.__rpc__") def test_qradar_analytics_rules_merged_idempotent(self, connection): - self._plugin._connection.socket_path = ( - tempfile.NamedTemporaryFile().name - ) + self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name self._plugin._connection._shell = MagicMock() self._plugin.search_for_resource = MagicMock() self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD @@ -115,9 +110,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): @patch("ansible.module_utils.connection.Connection.__rpc__") def test_qradar_analytics_rules_deleted(self, connection): - self._plugin._connection.socket_path = ( - tempfile.NamedTemporaryFile().name - ) + self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name self._plugin._connection._shell = MagicMock() self._plugin.search_for_resource = MagicMock() self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD @@ -135,9 +128,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): def test_qradar_analytics_rules_deleted_idempotent(self, connection): self._plugin.search_for_resource = MagicMock() self._plugin.search_for_resource.return_value = {} - self._plugin._connection.socket_path = ( - tempfile.NamedTemporaryFile().name - ) + self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name self._plugin._connection._shell = MagicMock() self._plugin._task.args = { "state": "deleted", @@ -150,9 +141,7 @@ class TestQradarAnalyticsRules(unittest.TestCase): @patch("ansible.module_utils.connection.Connection.__rpc__") def test_qradar_analytics_rules_gathered(self, connection): - self._plugin._connection.socket_path = ( - tempfile.NamedTemporaryFile().name - ) + self._plugin._connection.socket_path = tempfile.NamedTemporaryFile().name self._plugin._connection._shell = MagicMock() self._plugin.search_for_resource = MagicMock() self._plugin.search_for_resource.return_value = RESPONSE_PAYLOAD diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py index e19a1e04c..349e71ada 100644 --- a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py +++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/conftest.py @@ -2,15 +2,16 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function + __metaclass__ = type import json import pytest -from ansible.module_utils.six import string_types from ansible.module_utils._text import to_bytes from ansible.module_utils.common._collections_compat import MutableMapping +from ansible.module_utils.six import string_types @pytest.fixture @@ -21,20 +22,13 @@ def patch_ansible_module(request, mocker): if "ANSIBLE_MODULE_ARGS" not in request.param: request.param = {"ANSIBLE_MODULE_ARGS": request.param} if "_ansible_remote_tmp" not in request.param["ANSIBLE_MODULE_ARGS"]: - request.param["ANSIBLE_MODULE_ARGS"][ - "_ansible_remote_tmp" - ] = "/tmp" - if ( - "_ansible_keep_remote_files" - not in request.param["ANSIBLE_MODULE_ARGS"] - ): - request.param["ANSIBLE_MODULE_ARGS"][ - "_ansible_keep_remote_files" - ] = False + request.param["ANSIBLE_MODULE_ARGS"]["_ansible_remote_tmp"] = "/tmp" + if "_ansible_keep_remote_files" not in request.param["ANSIBLE_MODULE_ARGS"]: + request.param["ANSIBLE_MODULE_ARGS"]["_ansible_keep_remote_files"] = False args = json.dumps(request.param) else: raise Exception( - "Malformed data to the patch_ansible_module pytest fixture" + "Malformed data to the patch_ansible_module pytest fixture", ) mocker.patch("ansible.module_utils.basic._ANSIBLE_ARGS", to_bytes(args)) diff --git a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py index d55afc0b3..e86add0b3 100644 --- a/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py +++ b/ansible_collections/ibm/qradar/tests/unit/plugins/modules/utils.py @@ -1,12 +1,13 @@ from __future__ import absolute_import, division, print_function + __metaclass__ = type import json -from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest -from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import patch from ansible.module_utils import basic from ansible.module_utils._text import to_bytes +from ansible_collections.trendmicro.deepsec.tests.unit.compat import unittest +from ansible_collections.trendmicro.deepsec.tests.unit.compat.mock import patch def set_module_args(args): @@ -41,7 +42,9 @@ def fail_json(*args, **kwargs): class ModuleTestCase(unittest.TestCase): def setUp(self): self.mock_module = patch.multiple( - basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json + basic.AnsibleModule, + exit_json=exit_json, + fail_json=fail_json, ) self.mock_module.start() self.mock_sleep = patch("time.sleep") diff --git a/ansible_collections/ibm/qradar/tox.ini b/ansible_collections/ibm/qradar/tox.ini index a533ccb30..6ada631cb 100644 --- a/ansible_collections/ibm/qradar/tox.ini +++ b/ansible_collections/ibm/qradar/tox.ini @@ -4,20 +4,18 @@ envlist = linters skipsdist = True [testenv] -basepython = python3 deps = -r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt -commands = find {toxinidir} -type f -name "*.py[c|o]" -delete [testenv:black] install_command = pip install {opts} {packages} commands = - black -v -l79 {toxinidir} + black -v {toxinidir} [testenv:linters] install_command = pip install {opts} {packages} commands = - black -v -l79 --check {toxinidir} + black -v --diff --check {toxinidir} flake8 {posargs} [testenv:venv] @@ -27,7 +25,7 @@ commands = {posargs} # E123, E125 skipped as they are invalid PEP-8. show-source = True -ignore = E123,E125,E402,E501,E741,W503 +ignore = E123,E125,E203,E402,E501,E741,F401,F811,F841,W503 max-line-length = 160 builtins = _ exclude = .git,.tox,tests/unit/compat/ -- cgit v1.2.3