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

DTT1 - Allocator module. The allocation fails if the sshpass utility is not installed #5295

Closed
3 tasks
mhamra opened this issue Apr 25, 2024 · 2 comments · Fixed by #5336
Closed
3 tasks
Assignees

Comments

@mhamra
Copy link
Contributor

mhamra commented Apr 25, 2024

Target version Related issue Related PR/dev branch
4.9.0 4495-dtt1-release

Description

The log of this comment shows that the allocator failed to run. The code that generates the exception is this:

if conn_ok:
if action == 'create':
try:
cmd = "sudo /usr/local/bin/prlctl list -j"
prlctl_output = subprocess.Popen(f"sshpass -p {ssh_password} ssh -o 'StrictHostKeyChecking no' {ssh_user}@{server_ip} {cmd}", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0].decode('utf-8')
data_list = json.loads(prlctl_output)
except Exception as e:
raise ValueError('Could not get VMs running on macStadium server: ' + str(e) + '.')
uuid_count = 0
for item in data_list:
if 'uuid' in item:
uuid_count += 1
if uuid_count < 2:
logger.info(f"macStadium server has less than 2 VMs running, deploying in this host.")
return remote_host_parameters
else:

I've checked, and the host machine didn't have the sshpass utility installed. After installing it, the workflow file worked fine.

The current implementation does not check if the sshpass utility is installed or inform the user of the problem. An exception is raised, but with a log message that does not allow the user to fix the problem.

Requested feature:

The VagrantProvider.__remote_host method should process the subprocess.Popen output to log if sshpass is not installed or sshpass cannot connect, or a verification of the current environment needs to be done before launching the command.

Proposed checks

  • The code handles the exception when the sshpass utility is not installed.
  • The code handles the exception when the sshpass utility cannot connect.
  • Review/update the documentation to add the dependency of the sshpass utility.
@c-bordon
Copy link
Member

We believe that this problem should be attacked in DTT2, since the ideal is not to perform a dependency fix but to change all these ssh calls that are made and replace them with Python libraries so that in this way, the script It also works on systems like Windows and macOS

@rauldpm
Copy link
Member

rauldpm commented May 2, 2024

We can improve the remote calls with Python in DTT2 as an enhancement, but we need to fix this behavior as we need to report the real error in DTT1

@teddytpc1 teddytpc1 assigned teddytpc1 and c-bordon and unassigned teddytpc1 May 2, 2024
@wazuhci wazuhci moved this from Triage to Backlog in Release 4.9.0 May 2, 2024
@wazuhci wazuhci moved this from Backlog to In progress in Release 4.9.0 May 2, 2024
@wazuhci wazuhci moved this from In progress to In review in Release 4.9.0 May 3, 2024
@wazuhci wazuhci moved this from In review to On hold in Release 4.9.0 May 3, 2024
@wazuhci wazuhci moved this from On hold to Pending review in Release 4.9.0 May 3, 2024
@wazuhci wazuhci moved this from Pending review to Done in Release 4.9.0 May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants