Skip to content

Commit 691e950

Browse files
authored
Merge pull request #54 from craigcomstock/CFE-4078
CFE-4078: Added zypper install method and opensuse-leap knowledge about packages
2 parents c5601a9 + def359f commit 691e950

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

cf_remote/packages.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ def add_tags_from_filename(self, filename):
9898
self.add_tag("client")
9999
self.add_tag("agent")
100100

101+
# suse15 is equivalent to opensuse-leap and opensuse-leap15
102+
if "suse15" in self.tags:
103+
self.add_tag("opensuse-leap15")
104+
self.add_tag("opensuse-leap")
105+
101106
# sorry, debian packages work great on ubuntu
102107
# if we don't have a specific ubuntu package, note which debian is equivalent
103108
# only add "ubuntu" tag if we know we have an equivalent debian :)

cf_remote/remote.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ def get_info(host, *, users=None, connection=None):
208208
)
209209

210210
data["bin"] = {}
211-
for bin in ["dpkg", "rpm", "yum", "apt", "pkg"]:
211+
for bin in ["dpkg", "rpm", "yum", "apt", "pkg", "zypper"]:
212212
path = ssh_cmd(connection, "which {}".format(bin))
213213
if path:
214214
data["bin"][bin] = path
@@ -231,7 +231,13 @@ def install_package(host, pkg, data, *, connection=None):
231231
# timeout doesn't work over ssh.
232232
output = ssh_cmd(connection, powershell(r".\{} ; sleep 10".format(pkg)), True)
233233
else:
234-
output = ssh_sudo(connection, "yum -y install {}".format(pkg), True)
234+
# generally this "else" is for rpm packages
235+
if "yum" in data["bin"]:
236+
output = ssh_sudo(connection, "yum -y install {}".format(pkg), True)
237+
elif "zypper" in data["bin"]: # suse case
238+
output = ssh_sudo(connection, "zypper install -y --allow-unsigned-rpm {}".format(pkg), True)
239+
else:
240+
log.error("Don't know how to install rpm package. No yum or zypper in PATH.")
235241
if output is None:
236242
log.error("Installation failed on '{}'".format(host))
237243

0 commit comments

Comments
 (0)