diff --git a/README.md b/README.md index cf87ef4..41e1099 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ In its current state, the collection consists of a single role that deploys Dyna ### General * Ansible >= 2.15.0 ### Windows -* pywinrm >= 0.4.1 +* pywinrm >= 0.4.3 ## Setup `pip install -r requirements.txt` diff --git a/requirements.txt b/requirements.txt index 46aa4a4..0555910 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,2 @@ ansible >= 2.15.0 -pywinrm >= 0.4.1 ; sys_platform == 'win32' +pywinrm >= 0.4.3 diff --git a/roles/__init__.py b/roles/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/roles/oneagent/__init__.py b/roles/oneagent/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/roles/oneagent/tests/__init__.py b/roles/oneagent/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/roles/oneagent/tests/component/README.md b/roles/oneagent/tests/component/README.md index f1eb357..e8f636a 100644 --- a/roles/oneagent/tests/component/README.md +++ b/roles/oneagent/tests/component/README.md @@ -14,7 +14,7 @@ Upon downloading the collection $ apt-get install -y python3-venv python3-pip # Create virtual environment -$ python -m venv venv && source venv/bin/activate +$ cd Dynatrace-OneAgent-Ansible && python -m venv venv && source venv/bin/activate # Install requirements $ pip install -r roles/oneagent/tests/component/resources/requirements.txt @@ -29,4 +29,12 @@ $ ansible-galaxy collection install -vvv dynatrace-oneagent* # Run tests (eg. For linux_x86 platform) $ cd roles/oneagent/tests/component $ python run.py --linux_x86=localhost -``` \ No newline at end of file +``` + + +- repo: https://github.com/ansible/ansible-lint + rev: v24.2.2 + hooks: + - id: ansible-lint + pass_filenames: false + args: ['--exclude', 'roles/oneagent/examples'] \ No newline at end of file diff --git a/roles/oneagent/tests/component/run.py b/roles/oneagent/tests/component/run.py index dfad9a5..483abcf 100644 --- a/roles/oneagent/tests/component/run.py +++ b/roles/oneagent/tests/component/run.py @@ -40,7 +40,7 @@ def get_env_vars(): def save_log(out, log_path: Path): - with open(log_path, "w") as log: + with log_path.open("w") as log: for line in out: log.write(line) @@ -86,7 +86,7 @@ def run_server(): def get_file_content(path: Path): - with open(path, "r") as f: + with path.open("r") as f: return f.readlines() diff --git a/roles/oneagent/tests/component/scripts/tests/conftest.py b/roles/oneagent/tests/component/scripts/tests/conftest.py index 02c1e74..6ec9ced 100644 --- a/roles/oneagent/tests/component/scripts/tests/conftest.py +++ b/roles/oneagent/tests/component/scripts/tests/conftest.py @@ -3,8 +3,8 @@ import pytest -import technology.ansible.constants as AnsibleConstants -import technology.ansible.util as AnsibleUtil +import technology.constants as AnsibleConstants +import technology.util as AnsibleUtil from command.platform_command_wrapper import PlatformCommandWrapper from technology.config import AnsibleConfig diff --git a/roles/oneagent/tests/component/scripts/tests/test_localInstaller.py b/roles/oneagent/tests/component/scripts/tests/test_localInstaller.py index 798f0a7..ffa9ef9 100644 --- a/roles/oneagent/tests/component/scripts/tests/test_localInstaller.py +++ b/roles/oneagent/tests/component/scripts/tests/test_localInstaller.py @@ -6,6 +6,7 @@ from util.test_helpers import ( check_agent_state, check_download_directory, + disable_for_localhost, perform_operation_on_platforms, run_deployment, ) diff --git a/roles/oneagent/tests/component/scripts/tests/test_resilience.py b/roles/oneagent/tests/component/scripts/tests/test_resilience.py index 1d6871a..994b37e 100644 --- a/roles/oneagent/tests/component/scripts/tests/test_resilience.py +++ b/roles/oneagent/tests/component/scripts/tests/test_resilience.py @@ -156,7 +156,7 @@ def test_failed_signature_verification(_error_messages, runner, configurator, co set_installer_download_params(configurator) - with open(INSTALLER_SIGNATURE_FILE, "w") as signature: + with INSTALLER_SIGNATURE_FILE.open("w") as signature: signature.write("break signature by writing some text") universal_message = _error_messages.get(SIGNATURE_VERIFICATION_FAILED_KEY) diff --git a/roles/oneagent/tests/component/scripts/util/common_utils.py b/roles/oneagent/tests/component/scripts/util/common_utils.py index 31fdc4f..c3fc940 100644 --- a/roles/oneagent/tests/component/scripts/util/common_utils.py +++ b/roles/oneagent/tests/component/scripts/util/common_utils.py @@ -64,7 +64,7 @@ def _get_platform_by_installer(installer: Path) -> DeploymentPlatform: return DeploymentPlatform.LINUX_X86 -def _get_available_installers() -> dist[DeploymentPlatform, list[Path]]: +def _get_available_installers() -> dict[DeploymentPlatform, list[Path]]: installers: dict[DeploymentPlatform, list[Path]] = {k: [] for k in DeploymentPlatform} for installer in sorted(INSTALLERS_DIRECTORY.glob(f"{INSTALLER_PARTIAL_NAME}*")): platform = _get_platform_by_installer(installer)