When removing package(s) with zypper, that are (all) installed zypper may
succeed and return 0, but when any package(s) are not present before requesting
them to be removed zypper will return 104 on success.
The function remoto.process.run raises a "RuntimeError" exception when the
command does not return 0 in the form:
RuntimeError("Failed to execute command: %s" % " ".join(cmd))
Hence to maintain the expected behaviour, remoto.process.check is used, and the
error code is checked, and if it does not match 0 or 104 the exception is
raised.
Signed-off-by: Owen Synge <osynge@suse.com>
extra_flags = [extra_flags]
cmd.extend(extra_flags)
cmd.extend(packages)
- return self._run(cmd)
+ stdout, stderr, exitrc = remoto.process.check(
+ self.remote_conn,
+ cmd,
+ **kw
+ )
+ # exitrc is 104 when package(s) not installed.
+ if not exitrc in [0, 104]:
+ raise RuntimeError("Failed to execute command: %s" % " ".join(cmd))
+ return
def clean(self):
cmd = self.executable + ['refresh']