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

Fixed file extension error when installing package #111

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
9 changes: 7 additions & 2 deletions cf_remote/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ def install_package(host, pkg, data, *, connection=None):
# sleep is powershell specific,
# timeout doesn't work over ssh.
output = ssh_cmd(connection, powershell(r".\{} ; sleep 10".format(pkg)), True)
else:
# generally this "else" is for rpm packages
elif ".rpm" in pkg:
if "yum" in data["bin"]:
output = ssh_sudo(connection, "yum -y install {}".format(pkg), True)
elif "zypper" in data["bin"]: # suse case
Expand All @@ -276,6 +275,12 @@ def install_package(host, pkg, data, *, connection=None):
log.error(
"Don't know how to install rpm package. No yum or zypper in PATH."
)
else:
file_extension = pkg.split(".")[-1]
if pkg.endswith("tar.gz"):
file_extension = "tar.gz"
log.error("Don't know how to install {} package.".format(file_extension))

if output is None:
log.error("Installation failed on '{}'".format(host))

Expand Down
Loading