Skip to content

Commit

Permalink
ci: Use supported ansible-lint action; run ansible-lint against the c…
Browse files Browse the repository at this point in the history
…ollection

The old ansible-community ansible-lint is deprecated.  There is a
new ansible-lint github action.  The new ansible-lint has several checks
related to ansible-test and the ignore files.  Many of our ignore settings
are not allowed any more and are required to be fixed or addressed in the
Ansible preferred way.

The python imports have to be wrapped in a try/except ImportError, and
where possible, an error must be returned from the module explaining
what was not able to be imported.

The module documentation must comply with the Ansible standards.

Because the module code uses mypy, we have to tell ansible-test
to ignore some code with `compile-2.7!skip` and `import-x.y!skip`,
which ansible-lint does not like, so we have to add
```
skip_list:
  - sanity[cannot-ignore]
```
to make ansible-lint happy.

The latest Ansible repo gating tests run ansible-lint against
the collection format instead of against individual roles.
We have to convert the role to collection format before running
ansible-test.

Role developers can run this locally using
`tox -e collection,ansible-lint-collection`
See linux-system-roles/tox-lsr#125

Add `---` doc start to .markdownlint.yaml

Signed-off-by: Rich Megginson <[email protected]>
  • Loading branch information
richm committed Jan 4, 2024
1 parent d930513 commit 2ae6af7
Show file tree
Hide file tree
Showing 12 changed files with 150 additions and 114 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ kinds:
skip_list:
- fqcn-builtins
- var-naming[no-role-prefix]
- sanity[cannot-ignore]

Check warning on line 18 in .ansible-lint

View workflow job for this annotation

GitHub Actions / Detect non-inclusive language

`sanity` may be insensitive, use `confidence`, `quick check`, `coherence check` instead
exclude_paths:
- tests/roles/
- .github/
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Default state for all rules
default: true

Expand Down
33 changes: 12 additions & 21 deletions .sanity-ansible-ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
plugins/modules/pcs_api_v2.py compile-2.7!skip
plugins/modules/pcs_api_v2.py import-2.7!skip
plugins/modules/pcs_api_v2.py import-3.5!skip
plugins/modules/pcs_api_v2.py import-3.6!skip
plugins/modules/pcs_api_v2.py import-3.7!skip
plugins/modules/pcs_api_v2.py import-3.8!skip
plugins/modules/pcs_api_v2.py import-3.9!skip
plugins/modules/pcs_api_v2.py import-3.10!skip
plugins/modules/pcs_api_v2.py validate-modules:import-error
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.8!skip
plugins/modules/pcs_qdevice_certs.py compile-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.5!skip
plugins/modules/pcs_qdevice_certs.py import-3.6!skip
plugins/modules/pcs_qdevice_certs.py import-3.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.8!skip
plugins/modules/pcs_qdevice_certs.py import-3.9!skip
plugins/modules/pcs_qdevice_certs.py import-3.10!skip
plugins/modules/pcs_qdevice_certs.py validate-modules:import-error
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.9!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
36 changes: 12 additions & 24 deletions .sanity-ansible-ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
plugins/modules/pcs_api_v2.py compile-2.7!skip
plugins/modules/pcs_api_v2.py import-2.7!skip
plugins/modules/pcs_api_v2.py import-3.5!skip
plugins/modules/pcs_api_v2.py import-3.6!skip
plugins/modules/pcs_api_v2.py import-3.7!skip
plugins/modules/pcs_api_v2.py import-3.8!skip
plugins/modules/pcs_api_v2.py import-3.9!skip
plugins/modules/pcs_api_v2.py import-3.10!skip
plugins/modules/pcs_api_v2.py import-3.11!skip
plugins/modules/pcs_api_v2.py validate-modules:import-error
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.8!skip
plugins/modules/pcs_qdevice_certs.py compile-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.5!skip
plugins/modules/pcs_qdevice_certs.py import-3.6!skip
plugins/modules/pcs_qdevice_certs.py import-3.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.8!skip
plugins/modules/pcs_qdevice_certs.py import-3.9!skip
plugins/modules/pcs_qdevice_certs.py import-3.10!skip
plugins/modules/pcs_qdevice_certs.py import-3.11!skip
plugins/modules/pcs_qdevice_certs.py validate-modules:import-error
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.9!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
36 changes: 12 additions & 24 deletions .sanity-ansible-ignore-2.15.txt
Original file line number Diff line number Diff line change
@@ -1,34 +1,22 @@
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
plugins/modules/pcs_api_v2.py compile-2.7!skip
plugins/modules/pcs_api_v2.py import-2.7!skip
plugins/modules/pcs_api_v2.py import-3.5!skip
plugins/modules/pcs_api_v2.py import-3.6!skip
plugins/modules/pcs_api_v2.py import-3.7!skip
plugins/modules/pcs_api_v2.py import-3.8!skip
plugins/modules/pcs_api_v2.py import-3.9!skip
plugins/modules/pcs_api_v2.py import-3.10!skip
plugins/modules/pcs_api_v2.py import-3.11!skip
plugins/modules/pcs_api_v2.py validate-modules:import-error
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.8!skip
plugins/modules/pcs_qdevice_certs.py compile-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.5!skip
plugins/modules/pcs_qdevice_certs.py import-3.6!skip
plugins/modules/pcs_qdevice_certs.py import-3.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.8!skip
plugins/modules/pcs_qdevice_certs.py import-3.9!skip
plugins/modules/pcs_qdevice_certs.py import-3.10!skip
plugins/modules/pcs_qdevice_certs.py import-3.11!skip
plugins/modules/pcs_qdevice_certs.py validate-modules:import-error
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.5!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.9!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
35 changes: 12 additions & 23 deletions .sanity-ansible-ignore-2.16.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,22 @@
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
plugins/modules/pcs_api_v2.py compile-2.7!skip
plugins/modules/pcs_api_v2.py import-2.7!skip
plugins/modules/pcs_api_v2.py import-3.6!skip
plugins/modules/pcs_api_v2.py import-3.7!skip
plugins/modules/pcs_api_v2.py import-3.8!skip
plugins/modules/pcs_api_v2.py import-3.9!skip
plugins/modules/pcs_api_v2.py import-3.10!skip
plugins/modules/pcs_api_v2.py import-3.11!skip
plugins/modules/pcs_api_v2.py import-3.12!skip
plugins/modules/pcs_api_v2.py validate-modules:import-error
plugins/modules/pcs_api_v2.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-3.8!skip
plugins/modules/pcs_qdevice_certs.py compile-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-2.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.6!skip
plugins/modules/pcs_qdevice_certs.py import-3.7!skip
plugins/modules/pcs_qdevice_certs.py import-3.8!skip
plugins/modules/pcs_qdevice_certs.py import-3.9!skip
plugins/modules/pcs_qdevice_certs.py import-3.10!skip
plugins/modules/pcs_qdevice_certs.py import-3.11!skip
plugins/modules/pcs_qdevice_certs.py import-3.12!skip
plugins/modules/pcs_qdevice_certs.py validate-modules:import-error
plugins/modules/pcs_qdevice_certs.py validate-modules:missing-gplv3-license
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py compile-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-2.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.6!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.7!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.8!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.9!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.10!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.11!skip
plugins/module_utils/ha_cluster_lsr/pcs_api_v2_utils.py import-3.12!skip
tests/ha_cluster/unit/test_pcs_api_v2.py shebang!skip
tests/ha_cluster/unit/test_pcs_qdevice_certs.py shebang!skip
21 changes: 20 additions & 1 deletion library/pcs_api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@
cmd_params:
description: parameters of the command specified in cmd_name
type: dict
default: {}
cmd_options:
description: generic command options
type: dict
default: {}
suboptions:
request_timeout:
description: request timeout
Expand Down Expand Up @@ -119,8 +121,25 @@
# pylint: disable=no-name-in-module
from ansible.module_utils.ha_cluster_lsr import pcs_api_v2_utils as api_utils

import traceback

# pylint: enable=no-name-in-module
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
try:
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
PCS_IMPORT_ERROR = traceback.format_exc()

Check warning on line 131 in library/pcs_api_v2.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_api_v2.py#L129-L131

Added lines #L129 - L131 were not covered by tests

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.

class CommandOptionsDto(object):
def __init__(self, **kwargs):
pass

Check warning on line 135 in library/pcs_api_v2.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_api_v2.py#L133-L135

Added lines #L133 - L135 were not covered by tests

class CommandDto(object):
pass

Check warning on line 138 in library/pcs_api_v2.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_api_v2.py#L137-L138

Added lines #L137 - L138 were not covered by tests

else:
HAS_PCS = True

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
PCS_IMPORT_ERROR = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.


def run_module() -> None:
Expand Down
20 changes: 19 additions & 1 deletion library/pcs_qdevice_certs.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
cmd_options:
description: pcs API v2 command options
type: dict
default: {}
suboptions:
request_timeout:
description: request timeout
Expand Down Expand Up @@ -112,8 +113,25 @@
# pylint: disable=no-name-in-module
from ansible.module_utils.ha_cluster_lsr import pcs_api_v2_utils as api_utils

import traceback

# pylint: enable=no-name-in-module
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
try:
from pcs.common.async_tasks.dto import CommandDto, CommandOptionsDto
except ImportError:
HAS_PCS = False

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
PCS_IMPORT_ERROR = traceback.format_exc()

Check warning on line 123 in library/pcs_qdevice_certs.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_qdevice_certs.py#L121-L123

Added lines #L121 - L123 were not covered by tests

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.

class CommandOptionsDto(object):
def __init__(self, **kwargs):
pass

Check warning on line 127 in library/pcs_qdevice_certs.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_qdevice_certs.py#L125-L127

Added lines #L125 - L127 were not covered by tests

class CommandDto(object):
pass

Check warning on line 130 in library/pcs_qdevice_certs.py

View check run for this annotation

Codecov / codecov/patch

library/pcs_qdevice_certs.py#L129-L130

Added lines #L129 - L130 were not covered by tests

else:
HAS_PCS = True

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'HAS_PCS' is not used.
PCS_IMPORT_ERROR = None

Check notice

Code scanning / CodeQL

Unused global variable Note

The global variable 'PCS_IMPORT_ERROR' is not used.


def run_module() -> None:
Expand Down
50 changes: 41 additions & 9 deletions module_utils/ha_cluster_lsr/pcs_api_v2_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
# pylint: enable=invalid-name

import sys
import traceback


# Add paths to pcs bundled libraries to make Dacite available
sys.path.insert(0, "/usr/lib64/pcs/pcs_bundled/packages/")
Expand All @@ -24,15 +26,45 @@

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.urls import fetch_url
from dacite import DaciteError
from pcs.common.async_tasks.dto import (
CommandDto,
CommandOptionsDto,
TaskResultDto,
)
from pcs.common.async_tasks.types import TaskFinishType, TaskKillReason
from pcs.common.interface.dto import from_dict, to_dict
from pcs.common.reports import ReportItemDto, ReportItemSeverity

try:
from dacite import DaciteError
except ImportError:
HAS_DACITE = False
DACITE_IMPORT_ERROR = traceback.format_exc()

Check warning on line 34 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L32-L34

Added lines #L32 - L34 were not covered by tests
else:
HAS_DACITE = True
DACITE_IMPORT_ERROR = None

try:
from pcs.common.async_tasks.dto import (
CommandDto,
CommandOptionsDto,
TaskResultDto,
)
from pcs.common.async_tasks.types import TaskFinishType, TaskKillReason
from pcs.common.interface.dto import from_dict, to_dict
from pcs.common.reports import ReportItemDto, ReportItemSeverity
except ImportError:
HAS_PCS = False
PCS_IMPORT_ERROR = traceback.format_exc()

Check warning on line 50 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L48-L50

Added lines #L48 - L50 were not covered by tests

class CommandOptionsDto(object):
def __init__(self, **kwargs):
pass

Check warning on line 54 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L52-L54

Added lines #L52 - L54 were not covered by tests

class ReportItemDto(object):
pass

Check warning on line 57 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L56-L57

Added lines #L56 - L57 were not covered by tests

class TaskResultDto(object):
pass

Check warning on line 60 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L59-L60

Added lines #L59 - L60 were not covered by tests

class CommandDto(object):
pass

Check warning on line 63 in module_utils/ha_cluster_lsr/pcs_api_v2_utils.py

View check run for this annotation

Codecov / codecov/patch

module_utils/ha_cluster_lsr/pcs_api_v2_utils.py#L62-L63

Added lines #L62 - L63 were not covered by tests

else:
HAS_PCS = True
PCS_IMPORT_ERROR = None

PCSD_SOCKET = "/var/run/pcsd.socket"
API_ENDPOINT = "http://doesntmatter/api/v2/task/run"
Expand Down
4 changes: 2 additions & 2 deletions tasks/shell_pcs/sbd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
loop: "{{ ha_cluster.sbd_watchdog_modules_blocklist | d([]) }}"

- name: Unload watchdog kernel modules from blocklist
modprobe:
community.general.modprobe:
name: "{{ item }}"
state: absent
loop: "{{ ha_cluster.sbd_watchdog_modules_blocklist | d([]) }}"
Expand All @@ -38,7 +38,7 @@
loop: "{{ ha_cluster.sbd_watchdog_modules | d([]) }}"

- name: Load watchdog kernel modules
modprobe:
community.general.modprobe:
name: "{{ item }}"
state: present
loop: "{{ ha_cluster.sbd_watchdog_modules | d([]) }}"
Expand Down
21 changes: 12 additions & 9 deletions tests/tests_include_vars_from_parent.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Test include vars from parent
gather_facts: true
- name: Test role include variable override
hosts: all
gather_facts: true
tasks:
- name: Create var file in caller that can override the one in called role
delegate_to: localhost
Expand All @@ -13,7 +13,7 @@
# XXX ugly, self-modifying code - changes the "caller" role on
# the controller
dest: "{{ playbook_dir }}/roles/caller/vars/{{ item }}.yml"
mode: 0666
mode: preserve
loop: "{{ varfiles | unique }}"
# In case the playbook is executed against multiple hosts, use
# only the first one. Otherwise the hosts would stomp on each
Expand All @@ -38,15 +38,18 @@
varfiles: "{{ [facts['distribution']] | product(separators) |
map('join') | product(versions) | map('join') | list +
[facts['distribution'], facts['os_family']] }}"

- name: Set up test environment
include_role:
name: linux-system-roles.ha_cluster
tasks_from: test_setup.yml
register: __varfiles_created

- name: Import role
import_role:
name: caller
vars:
# noqa: var-naming[no-role-prefix]
roletoinclude: linux-system-roles.ha_cluster

- name: Cleanup
file:
path: "{{ item.dest }}"
state: absent
loop: "{{ __varfiles_created.results }}"
delegate_to: localhost
when: inventory_hostname == ansible_play_hosts_all[0]
Loading

0 comments on commit 2ae6af7

Please sign in to comment.