Skip to content

Commit

Permalink
Fix dnf install for ca-certificates on RedHat family distros (#3279) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sbbroot authored Oct 3, 2022
1 parent 7cbfa09 commit 7511799
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,15 @@ def update(self, package: str = '',
f'dnf update failed for packages `{package}`, reason: `{proc.stderr}`')

def install(self, package: str,
assume_yes: bool = True):
assume_yes: bool = True,
ignore_already_installed_error: bool = False):
"""
Interface for `dnf install -y`
:param package: packaged to be installed
:param assume_yes: if set to True, -y flag will be used
:param ignore_already_installed_error: if set to True,
`The same or higher version of {package} is already installed` error is ignored
"""
no_ask: str = '-y' if assume_yes else ''
proc = self.run(['install', no_ask, package], accept_nonzero_returncode=True)
Expand All @@ -94,8 +97,11 @@ def install(self, package: str,
raise CriticalError(
f'Found an error. dnf install failed for package `{package}`, reason: `{proc.stdout}`')
if self._filter_non_critical_errors(proc.stderr):
raise CriticalError(
f'dnf install failed for package `{package}`, reason: `{proc.stderr}`')
if ignore_already_installed_error:
if any('is already installed' in line for line in proc.stdout.split('\n')):
return

raise CriticalError(f'dnf install failed for package `{package}`, reason: `{proc.stderr}`')

def remove(self, package: str,
assume_yes: bool = True):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def _install_base_packages(self):
self._tools.dnf.makecache(timer=True)

# Ensure ca-certificates package is in the latest version
self._tools.dnf.install('ca-certificates')
self._tools.dnf.install('ca-certificates', ignore_already_installed_error=True)

for package in self.__base_packages:
if not self._tools.rpm.is_package_installed(package):
Expand Down
1 change: 1 addition & 0 deletions docs/changelogs/CHANGELOG-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

- [#3271](https://github.com/epiphany-platform/epiphany/issues/3271) - Filebeat not shipping logs to OpenSearch after upgrading epicli from v2.0.1
- [#3275](https://github.com/epiphany-platform/epiphany/issues/3275) - Kubernetes installation on aarch64 fails due to missing kubernetes-cni-0.8.7 package
- [#3279](https://github.com/epiphany-platform/epiphany/issues/3279) - dnf install failed for `ca-certificates` package on RedHat family distros

### Updated

Expand Down

0 comments on commit 7511799

Please sign in to comment.