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
Merged
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
14 changes: 12 additions & 2 deletions cf_remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_sudo(connection, "command -v cf-agent"):
log.debug("cf-agent is not in $PATH")

if ssh_cmd(connection, "command -v /var/cfengine/bin/cf-agent"):
cfagent_path = "/var/cfengine/bin/"
else:
user_error("Cannot find the path to cf-agent.")

commands = [
"rm -rf /var/cfengine/masterfiles.delete",
"mv /var/cfengine/masterfiles /var/cfengine/masterfiles.delete",
"mv masterfiles /var/cfengine/masterfiles",
"rm -rf /var/cfengine/masterfiles.delete",
"cf-agent -Kf update.cf",
"cf-agent -K",
"{}cf-agent -Kf update.cf".format(cfagent_path),
"{}cf-agent -K".format(cfagent_path),
]
combined = " && ".join(commands)
print("Running: '%s'" % combined)
Expand Down
Loading