Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat: update pytest-mh output to work with latest version #295

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/mrack/outputs/pytest_mh.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,20 @@ def create_mh_config(self):
"family": get_os_type(host),
},
"role": host["role"],
"ssh": {
"conn": {
"type": "ssh",
"host": get_external_id(provisioned_host, host, self._config),
},
}

if get_os_type(host) == "windows":
username = get_username(provisioned_host, host, self._config)
if username:
hostcfg["ssh"]["username"] = username
hostcfg["conn"]["username"] = username

password = get_password(provisioned_host, host, self._config)
if password:
hostcfg["ssh"]["password"] = password
hostcfg["conn"]["password"] = password

cfgdom["hosts"].append(merge_dict(hostcfg, host.get("pytest_mh", {})))

Expand Down
12 changes: 8 additions & 4 deletions tests/unit/test_pytest_mh.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ def mock_metadata():
role: ipa
os: fedora-37
pytest_mh:
ssh:
conn:
type: ssh
username: tuser
password: tuserpassword
config:
Expand Down Expand Up @@ -77,7 +78,8 @@ def test_output(self, mock_metadata, mock_gethostbyaddr):
os:
family: linux
role: client
ssh:
conn:
type: ssh
host: 192.168.0.1
artifacts:
- /etc/sssd/*
Expand All @@ -87,7 +89,8 @@ def test_output(self, mock_metadata, mock_gethostbyaddr):
os:
family: linux
role: ipa
ssh:
conn:
type: ssh
host: 192.168.0.1
username: tuser
password: tuserpassword
Expand All @@ -100,7 +103,8 @@ def test_output(self, mock_metadata, mock_gethostbyaddr):
os:
family: windows
role: ad
ssh:
conn:
type: ssh
host: 192.168.0.1
username: Administrator
password: adpassword
Expand Down
Loading