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

Bootstrap may fail if epel repo enabled with some priority #2704

Closed
TeddyAndrieux opened this issue Aug 3, 2020 · 0 comments
Closed

Bootstrap may fail if epel repo enabled with some priority #2704

TeddyAndrieux opened this issue Aug 3, 2020 · 0 comments
Assignees
Labels
complexity:medium Something that requires one or few days to fix kind:bug Something isn't working priority:medium Medium priority issues, should only be postponed if no other option severity:medium Medium impact (usability) on live deployments topic:deployment Bugs in or enhancements to deployment stages

Comments

@TeddyAndrieux
Copy link
Collaborator

TeddyAndrieux commented Aug 3, 2020

Component:

'salt'

What happened:

When running bootstrap with epel repo enable and has some yum priority https://wiki.centos.org/PackageManagement/Yum/Priorities set on it, salt from epel repository is installed (2015.x).

So bootstrap fail because some expected function not here (like fopen)

[CRITICAL] Rendering SLS 'base:metalk8s.salt.minion.local' failed: Jinja error: 'module' object has no attribute 'fopen'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 364, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 2, in top-level template code
  File "/var/cache/salt/minion/extmods/modules/metalk8s.py", line 211, in get_archives
    info = archive_info_from_tree(archive)
  File "/var/cache/salt/minion/extmods/modules/metalk8s.py", line 158, in archive_info_from_tree
    with salt.utils.files.fopen(product_txt) as fd:
AttributeError: 'module' object has no attribute 'fopen'

; line 2

---
{%- from "metalk8s/map.jinja" import metalk8s with context %}
{%- set archives = salt.metalk8s.get_archives() %}    <======================

Configure salt minion for local mode:
  file.serialize:
    - name: /etc/salt/minion.d/99-metalk8s-local.conf
    - user: root
[...]
---
local:
    Data failed to compile:
----------
    Rendering SLS 'base:metalk8s.salt.minion.local' failed: Jinja error: 'module' object has no attribute 'fopen'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/utils/templates.py", line 364, in render_jinja_tmpl
    output = template.render(**decoded_context)
  File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python2.7/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "<template>", line 2, in top-level template code
  File "/var/cache/salt/minion/extmods/modules/metalk8s.py", line 211, in get_archives
    info = archive_info_from_tree(archive)
  File "/var/cache/salt/minion/extmods/modules/metalk8s.py", line 158, in archive_info_from_tree
    with salt.utils.files.fopen(product_txt) as fd:
AttributeError: 'module' object has no attribute 'fopen'

; line 2

---
{%- from "metalk8s/map.jinja" import metalk8s with context %}
{%- set archives = salt.metalk8s.get_archives() %}    <======================

Configure salt minion for local mode:
  file.serialize:
    - name: /etc/salt/minion.d/99-metalk8s-local.conf
    - user: root
[...]
---
<< END >>

This script will now exit

Workaround:

Disable epel repository (as this repository is not needed at all for MetalK8s) to perform bootstrap or just unset the priority on epel repository.

What was expected:

Working bootstrap and Salt minion from our repo installed either:

  • If salt-minion already installed in another version (may be downgraded or upgraded in bootstrap script)
  • If other salt-minion packages available in another repo (likely 2015.x in epel repo even if a priority is set on this epel repository)

Steps to reproduce

Install the yum priority plugin, enable epel repository and set priority on epel repository to something between 1 and 98 and then bootstrap

yum install epel-release
yum install yum-plugin-priorities
vim /etc/yum.repos.d/epel.repo # set `priority=10` for epel repo

Resolution proposal (optional):

Force the salt-minion version we install in bootstrap script

@TeddyAndrieux TeddyAndrieux added kind:bug Something isn't working topic:deployment Bugs in or enhancements to deployment stages complexity:medium Something that requires one or few days to fix priority:medium Medium priority issues, should only be postponed if no other option severity:medium Medium impact (usability) on live deployments labels Aug 3, 2020
@TeddyAndrieux TeddyAndrieux changed the title Bootstrap may fail if epel repo enabled Bootstrap may fail if epel repo enabled with some priority Aug 11, 2020
@TeddyAndrieux TeddyAndrieux self-assigned this Aug 11, 2020
TeddyAndrieux added a commit that referenced this issue Aug 11, 2020
In bootstrap and restore we install salt-minion on the node so we need
to pin the salt version we want to install and not just install the one
yum will find depending on various things (like available versions,
priority on repos, ...)

Fixes: #2704
TeddyAndrieux added a commit that referenced this issue Aug 11, 2020
In bootstrap and restore we install salt-minion on the node so we need
to pin the salt version we want to install and not just install the one
yum will find depending on various things (like available versions,
priority on repos, ...).
Also set the priority to 1 on all our repos so that our repositories has
priority over others if the `yum-plugin-priorities` package is
installed.
NOTE: If `yum-plugin-priorities` is installed and priority is set on one
repos then other repos with the same package will just be ignored
(e.g.: epel installed with priority=98 we cannot install `salt-3000.3`
as salt-3000.3 is excluded because a repo with some priority has the
package in a different version)

Fixes: #2704
TeddyAndrieux added a commit that referenced this issue Aug 11, 2020
In bootstrap and restore we install salt-minion on the node so we need
to pin the salt version we want to install and not just install the one
yum will find depending on various things (like available versions,
priority on repos, ...).
Also set the priority to 1 on all our repos so that our repositories has
priority over others if the `yum-plugin-priorities` package is
installed.
NOTE: If `yum-plugin-priorities` is installed and priority is set on one
repos then other repos with the same package will just be ignored
(e.g.: epel installed with priority=98 we cannot install `salt-3000.3`
as salt-3000.3 is excluded because a repo with some priority has the
package in a different version)

Fixes: #2704
TeddyAndrieux added a commit that referenced this issue Aug 11, 2020
In bootstrap and restore we install salt-minion on the node so we need
to pin the salt version we want to install and not just install the one
yum will find depending on various things (like available versions,
priority on repos, ...).
Also set the priority to 1 on all our repos so that our repositories has
priority over others if the `yum-plugin-priorities` package is
installed.
NOTE: If `yum-plugin-priorities` is installed and priority is set on one
repos then other repos with the same package will just be ignored
(e.g.: epel installed with priority=98 we cannot install `salt-3000.3`
as salt-3000.3 is excluded because a repo with some priority has the
package in a different version)

Fixes: #2704
bert-e added a commit that referenced this issue Aug 11, 2020
…o tmp/octopus/w/2.6/bugfix/GH-2704-pin-salt-version-in-bootstrap
bert-e added a commit that referenced this issue Aug 12, 2020
…octopus/w/2.5/bugfix/GH-2704-pin-salt-version-in-bootstrap
bert-e added a commit that referenced this issue Aug 12, 2020
bert-e added a commit that referenced this issue Aug 12, 2020
…nd 'q/2734/2.5/bugfix/GH-2704-pin-salt-version-in-bootstrap' into tmp/octopus/q/2.6
@bert-e bert-e closed this as completed in e869013 Aug 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
complexity:medium Something that requires one or few days to fix kind:bug Something isn't working priority:medium Medium priority issues, should only be postponed if no other option severity:medium Medium impact (usability) on live deployments topic:deployment Bugs in or enhancements to deployment stages
Projects
None yet
Development

No branches or pull requests

1 participant