diff --git a/oz/RedHat.py b/oz/RedHat.py index f5fff0a7..de35a364 100644 --- a/oz/RedHat.py +++ b/oz/RedHat.py @@ -57,7 +57,7 @@ def __init__(self, tdl, config, auto, output_disk, nicmodel, diskbus, AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE AcceptEnv XMODIFIERS X11Forwarding yes -Subsystem sftp /usr/libexec/openssh/sftp-server +Subsystem sftp /usr/libexec/openssh/sftp-server """ # initrdtype is actually a tri-state: @@ -816,6 +816,20 @@ def _customize_repos(self, guestaddr): def _install_packages(self, guestaddr, packstr): if self.use_yum: + # If passed in multiple packages, yum will still return a zero even if + # some of packages were not available for install. It seems the only + # safe way to check is to do a yum info on each package. + missing_packages = [] + for package in packstr.split(): + # Verify each package is available + try: + self.guest_execute_command(guestaddr, 'yum info %s' % package) + except oz.ozutil.SubprocessException: + missing_packages.append(package) + if missing_packages: + raise oz.OzException.OzException( + 'Failed to find packages: %s' % ' '.join(missing_packages) + ) self.guest_execute_command(guestaddr, 'yum -y install %s' % (packstr)) else: self.guest_execute_command(guestaddr, 'dnf -y install %s' % (packstr))