Skip to content

Commit

Permalink
Bump pywinrm version, change README, fix code
Browse files Browse the repository at this point in the history
  • Loading branch information
WStechura committed Sep 13, 2024
1 parent 0a9ddfe commit 8978ba4
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ansible >= 2.15.0
pywinrm >= 0.4.1 ; sys_platform == 'win32'
pywinrm >= 0.4.3
Empty file removed roles/__init__.py
Empty file.
Empty file removed roles/oneagent/__init__.py
Empty file.
Empty file removed roles/oneagent/tests/__init__.py
Empty file.
12 changes: 10 additions & 2 deletions roles/oneagent/tests/component/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
```
```


- repo: https://github.com/ansible/ansible-lint
rev: v24.2.2
hooks:
- id: ansible-lint
pass_filenames: false
args: ['--exclude', 'roles/oneagent/examples']
4 changes: 2 additions & 2 deletions roles/oneagent/tests/component/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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()


Expand Down
4 changes: 2 additions & 2 deletions roles/oneagent/tests/component/scripts/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from util.test_helpers import (
check_agent_state,
check_download_directory,
disable_for_localhost,
perform_operation_on_platforms,
run_deployment,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 8978ba4

Please sign in to comment.