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

Added check if binaries are in path #109

Merged

Conversation

victormlg
Copy link
Contributor

No description provided.

@victormlg victormlg requested a review from larsewi January 2, 2025 13:19
@olehermanse olehermanse self-requested a review January 2, 2025 13:26
Copy link
Contributor

@larsewi larsewi left a comment

Choose a reason for hiding this comment

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

Looks like you forgot to format the file with black

@@ -600,13 +600,23 @@ def deploy_masterfiles(host, tarball, *, connection=None):
scp(tarball, host, connection=connection, rename="masterfiles.tgz")
tarball = "masterfiles.tgz"
ssh_cmd(connection, "tar -xzf %s" % tarball)

cfagent_path = ""
if not ssh_cmd(connection, "command -v cf-agent"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, we check if cf-agent is in PATH for the user we logged in as. However, we execute the commands below as root. Hence, cf-agent may still not be in PATH for the root user. Thus, we need to do this command as root as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I need to use sudo when doing if ssh_cmd(connection, "command -v /var/cfengine/bin/cf-agent"): ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, because that you are not using the PATH environment variable :)

@larsewi
Copy link
Contributor

larsewi commented Jan 2, 2025

It would be nice if we printed an error if ssh_sudo(connection, combined) does not succeed. Furthermore, it would be nice if we knew which step did not succeed. I guess then we would have to split up the combined steps. But this is out of scope for this ticket. Feel free to create a ticket to do this.

@victormlg victormlg closed this Jan 3, 2025
@victormlg victormlg reopened this Jan 3, 2025
@victormlg
Copy link
Contributor Author

It would be nice if we printed an error if ssh_sudo(connection, combined) does not succeed. Furthermore, it would be nice if we knew which step did not succeed. I guess then we would have to split up the combined steps. But this is out of scope for this ticket. Feel free to create a ticket to do this.

I created a ticket here: https://northerntech.atlassian.net/browse/CFE-4480

@victormlg victormlg requested a review from larsewi January 3, 2025 09:40
Ticket: CFE-4446

Signed-off-by: Victor Moene <[email protected]>
@victormlg victormlg force-pushed the CFE-4446-check-binaries-in-path branch from 7521671 to cf2e698 Compare January 3, 2025 10:17
@olehermanse olehermanse merged commit a22a1d7 into cfengine:master Jan 8, 2025
6 checks passed
@victormlg victormlg deleted the CFE-4446-check-binaries-in-path branch January 8, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants