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

Fix script file transformer and openssl command issues #3473

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion lisa/transformers/script_file_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def _output_names(self) -> List[str]:

def _internal_run(self) -> Dict[str, Any]:
runbook: ScriptFileTransformerSchema = self.runbook
self._node.os.install_packages(runbook.dependent_packages) # type: ignore
if runbook.dependent_packages:
self._node.os.install_packages(runbook.dependent_packages) # type: ignore

results: Dict[str, Any] = {}
failed_scripts = []
Expand Down
17 changes: 16 additions & 1 deletion microsoft/testsuites/nested/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ def _create_cloud_init_iso(
password: str,
host_name: str = "l2vm",
) -> str:
cmd_result = host.execute(f"openssl passwd -6 {password}", sudo=True, shell=True)
cmd_result = host.execute(
f"openssl passwd -6 {password}",
sudo=True,
shell=True,
)
# The expected exit code is 0, indicating success.
# If a non-zero exit code is encountered, try using the -1 option.
# Note: The -6 option may not be available in older versions.
if cmd_result.exit_code != 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comments above to explain the expected errors.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please give an example error message. So if there are other non-zero exit code, others know the if branch is not designed for the new situation.

cmd_result = host.execute(
f"openssl passwd -1 {password}",
sudo=True,
shell=True,
)
if cmd_result.exit_code != 0:
raise LisaException("fail to run openssl command to convert password")
user_data = {
"users": [
"default",
Expand Down
Loading