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

Force sos dependency on an older version #3388

Merged
merged 4 commits into from
May 20, 2021
Merged
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion buildchain/buildchain/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
SALT_VERSION : str = '3002.6'
CONTAINERD_VERSION : str = '1.4.3'
CONTAINERD_RELEASE : str = '2.el7'
SOS_VERSION : str = '< 4.0'

def load_version_information() -> None:
"""Load version information from `VERSION`."""
Expand Down Expand Up @@ -331,7 +332,8 @@ def deb_full_name(self) -> str:
PackageVersion(name='runc'),
PackageVersion(name='salt-minion', version=SALT_VERSION),
PackageVersion(name='socat'),
PackageVersion(name='sos'), # TODO download built package dependencies
# TODO download built package dependencies
PackageVersion(name='sos', version=SOS_VERSION),
PackageVersion(name='util-linux'),
PackageVersion(name='xfsprogs'),
),
Expand Down
3 changes: 2 additions & 1 deletion packages/redhat/metalk8s-sosreport.spec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Summary: Metalk8s SOS report custom plugins


Requires: python >= 2.6, python < 2.8
Requires: sos >= 3.1
# Does not work with 4.0.0 and later
Requires: sos >= 3.1, sos < 4.0
# NameError on FileNotFoundError in sos 3.5 python2.7
Conflicts: sos = 3.5

Expand Down
4 changes: 2 additions & 2 deletions packages/redhat/yum_repositories/saltstack.repo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[saltstack]
name=SaltStack repo for RHEL/CentOS $releasever
baseurl=https://repo.saltstack.com/py3/redhat/$releasever/$basearch/archive/@SALT_VERSION@
baseurl=https://repo.saltproject.io/py3/redhat/$releasever/$basearch/archive/@SALT_VERSION@
enabled=1
gpgcheck=1
gpgkey=https://repo.saltstack.com/py3/redhat/$releasever/$basearch/archive/@SALT_VERSION@/SALTSTACK-GPG-KEY.pub
gpgkey=https://repo.saltproject.io/py3/redhat/$releasever/$basearch/archive/@SALT_VERSION@/SALTSTACK-GPG-KEY.pub
alexandre-allard marked this conversation as resolved.
Show resolved Hide resolved
15 changes: 11 additions & 4 deletions salt/_modules/metalk8s_package_manager_yum.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,15 @@ def check_pkg_availability(pkgs_info, exclude=None):
List of package to exclude (e.g.: containerd.io)
'''
for name, info in pkgs_info.items():
pkg_name = name
if info.get('version'):
pkg_name += '-' + str(info['version'])
pkg_version = str(info["version"])
pkg_name = "{}{}{}".format(
name,
"-" if pkg_version[0].isdigit() else " ",
pkg_version
)
else:
pkg_name = name

cmd = [
'yum', 'install', pkg_name,
Expand All @@ -185,8 +191,9 @@ def check_pkg_availability(pkgs_info, exclude=None):

if ret['retcode'] != 0:
raise CommandExecutionError(
'Check availability of package {} failed: {}'.format(
'Check availability of package {} failed:\n{}\n{}'.format(
pkg_name,
ret['stdout']
ret['stdout'],
ret['stderr'],
)
)
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,20 @@ check_pkg_availability:
- pkgs_info:
nonexistent_pkg: {}
yum_install_retcode: 1
raise_msg: "Check availability of package nonexistent_pkg failed: Oh ! No ! An ErRoR"
raise_msg: |-
Check availability of package nonexistent_pkg failed:
Some output
Oh ! No ! An ErRoR

# check 1 package not available with version - error when retrieving it
- pkgs_info:
nonexistent_pkg:
version: "3.11.12"
yum_install_retcode: 1
raise_msg: "Check availability of package nonexistent_pkg-3.11.12 failed: Oh ! No ! An ErRoR"
raise_msg: |-
Check availability of package nonexistent_pkg-3.11.12 failed:
Some output
Oh ! No ! An ErRoR

# check 3 package (2 available, 1 not available) - error when retrieving it
- pkgs_info:
Expand All @@ -177,4 +183,12 @@ check_pkg_availability:
version: null
yum_install_retcode:
nonexistent_pkg: 1
raise_msg: "Check availability of package nonexistent_pkg failed: Oh ! No ! An ErRoR"
raise_msg: |-
Check availability of package nonexistent_pkg failed:
Some output
Oh ! No ! An ErRoR

# check 1 package with a version constraint
- pkgs_info:
my_package:
version: "< 3.11.12"
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ def _yum_install_cmd(command):
out_kwargs['retcode'] = yum_install_retcode.get(command[2], 0)

if out_kwargs.get('retcode'):
out_kwargs['stdout'] = 'Oh ! No ! An ErRoR'
out_kwargs['stdout'] = "Some output"
out_kwargs['stderr'] = 'Oh ! No ! An ErRoR'

return utils.cmd_output(**out_kwargs)

Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _check_pods_count():
if node:
error_msg += "on node '{node}'".format(node=node)

utils.retry(_check_pods_count, times=20, wait=3, error_msg=error_msg)
utils.retry(_check_pods_count, times=40, wait=3, error_msg=error_msg)


_COUNT_RUNNING_PODS_PARSER = parsers.re(
Expand Down