Skip to content

Commit

Permalink
feat: update pytest-mh output to work with latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrezina authored and kaleemsiddiqu committed Aug 6, 2024
1 parent 079c3dc commit b3e0f7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
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

0 comments on commit b3e0f7d

Please sign in to comment.