This repository has been archived by the owner on Jan 24, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
139 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
async def run(hub, subcommand: str, target: str = "*", *args): | ||
with hub.test.container.roster() as rf: | ||
command = f"{hub.lib.sys.executable} -m soluble -R {rf} {subcommand} '{target}' {' '.join(args)}" | ||
command = f"{hub.lib.sys.executable} -m soluble --ssh-option='-o StrictHostKeyChecking=no' --log-level=debug --salt-config-dir {hub.test.SALT_CONFIG_DIR} -R {rf} {subcommand} '{target}' {' '.join(args)}" | ||
|
||
# Run the command asynchronously | ||
process = await hub.lib.asyncio.create_subprocess_shell( | ||
command, | ||
stdout=hub.lib.asyncio.subprocess.PIPE, | ||
stderr=hub.lib.asyncio.subprocess.PIPE, | ||
) | ||
|
||
await hub.lib.asyncio.sleep(2) | ||
|
||
# Capture the stdout and stderr | ||
stdout, stderr = await process.communicate() | ||
stdout, _ = await process.communicate() | ||
|
||
# Decode the output | ||
stdout = stdout.decode() | ||
stderr = stderr.decode() | ||
|
||
# Assert the process was successful | ||
assert ( | ||
process.returncode == 0 | ||
), f"Command failed with code {process.returncode}: {stderr}" | ||
print(stdout) | ||
assert not await process.wait(), "Command failed" | ||
|
||
# Return the captured stdout | ||
return stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters