Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 652914 - app-admin/salt-2018.3.0 - salt-ssh fails to call pkg.installed even on installed packages
Summary: app-admin/salt-2018.3.0 - salt-ssh fails to call pkg.installed even on instal...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrick McLean
URL: https://github.com/saltstack/salt/iss...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-04-10 15:11 UTC by Deniss Gaplevsky
Modified: 2021-02-26 09:11 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fix reload(portage) issue (python3-reload-fix.patch,1.72 KB, text/plain)
2018-11-12 09:27 UTC, (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Deniss Gaplevsky 2018-04-10 15:11:17 UTC
salt-ssh fails to call pkg.installed even on installed packages after updating to app-admin/salt-2018.3.0:

          ID: iptables-package
    Function: pkg.installed
        Name: net-firewall/iptables
      Result: False
     Comment: The following packages failed to install/update: net-firewall/iptables
     Started: 18:05:53.483064
    Duration: 11688.891 ms
     Changes:   


app-admin/salt-2017.7.5 has no issue with same config
Comment 1 Mark Gomersbach 2018-04-24 12:41:19 UTC
It is because of this change: https://github.com/saltstack/salt/commit/ba7d00f58ef10dd441dbc90ea1d92f28eb92d7d1

And they are trying to solve it in this PR : https://github.com/saltstack/salt/pull/43345

But they state they need help from "upstream", being "us"
Anyone feel to help them with this.
Comment 2 Josh G 2018-06-25 01:09:26 UTC
This bug looks to have been fixed in the newly released salt-2018.3.1.
Comment 3 Josh G 2018-06-25 16:05:33 UTC
(In reply to Josh G from comment #2)
> This bug looks to have been fixed in the newly released salt-2018.3.1.

Aah maybe not. :/
Comment 4 Mark Gomersbach 2018-10-15 23:54:54 UTC
pkg.installed seems to work in 2018.3.3 for me!
Comment 5 Karl-Johan Karlsson 2018-10-28 12:09:34 UTC
Portage support is still broken for me in Salt 2018.3.3:

          ID: net-analyzer/zabbix
    Function: pkg.installed
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib64/python3.6/site-packages/salt/state.py", line 1913, in call
                  **cdata['kwargs'])
                File "/usr/lib64/python3.6/site-packages/salt/loader.py", line 1898, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib64/python3.6/site-packages/salt/states/pkg.py", line 1548, in installed
                  **kwargs)
                File "/usr/lib64/python3.6/site-packages/salt/states/pkg.py", line 521, in _find_install_targets
                  cur_pkgs = __salt__['pkg.list_pkgs'](versions_as_list=True, **kwargs)
                File "/usr/lib64/python3.6/site-packages/salt/modules/ebuild.py", line 426, in list_pkgs
                  pkgs = _vartree().dbapi.cpv_all()
                File "/usr/lib64/python3.6/site-packages/salt/modules/ebuild.py", line 68, in _vartree
                  portage = reload(portage)
              NameError: name 'reload' is not defined
     Started: 13:07:08.194100
    Duration: 3202.91 ms
     Changes:
Comment 6 Mark Gomersbach 2018-11-05 17:44:29 UTC
@Karl-Johan Karisson

My pull request for that error has just been merged and will soon be uppatched in newer versions
Comment 7 Mark Gomersbach 2018-11-05 17:44:45 UTC
@Karl-Johan Karisson

My pull request for that error has just been merged and will soon be uppatched in newer versions https://github.com/saltstack/salt/pull/50128
Comment 8 (retired) 2018-11-12 08:52:47 UTC
@Mark Gomersbach

I use python3.6 and salt-2018.3.3 with the following state defintion:

PKG__install__eix:
  pkg.latest:
    - name: app-portage/eix
    - cache_valid_time: 3600


Initially I encountered the same stacktrace as outlined in comment#5.

However after applying Marks patch manually, I got a different stack trace.

          ID: PKG__install__eix
    Function: pkg.latest
        Name: app-portage/eix
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/lib64/python3.6/site-packages/salt/state.py", line 1913, in call
                  **cdata['kwargs'])
                File "/usr/lib64/python3.6/site-packages/salt/loader.py", line 1898, in wrapper
                  return f(*args, **kwargs)
                File "/usr/lib64/python3.6/site-packages/salt/states/pkg.py", line 2452, in latest
                  and __salt__['portage_config.is_changed_uses'](pkg):
                File "/usr/lib64/python3.6/site-packages/salt/modules/portage_config.py", line 742, in is_changed_uses
                  cpv = _get_cpv(cp)
                File "/usr/lib64/python3.6/site-packages/salt/modules/portage_config.py", line 132, in _get_cpv
                  return _get_portage().db[portage.root]['vartree'].dep_bestmatch(cp)
                File "/usr/lib64/python3.6/site-packages/salt/modules/portage_config.py", line 60, in _get_portage
                  return reload(portage)
              NameError: name 'reload' is not defined


Looking into /usr/lib64/python3.6/site-packages/salt/modules/portage_config.py I found another occurance of reload in function '_get_portage()', around line 60.

Adding the conditional import from Marks pull request at line 20 of 'portage_config.py' resolves the "new" stacktrace.
Comment 9 (retired) 2018-11-12 09:27:12 UTC
Created attachment 554958 [details]
Fix reload(portage) issue

I was able to fix the issue using user patches
(see https://wiki.gentoo.org/wiki//etc/portage/patches)
by dropping attachmet 'python3-reload-fix.patch' into folder 
'/etc/portage/patches/app-admin/salt-2018.3.3'
and rebuilding salt using 'emerge -av =app-admin/salt-2018.3.3'

If 'emerge' displays
   * User patches applied.
during the build process applying the patch succeeded
Comment 10 Deniss Gaplevsky 2021-02-26 09:11:28 UTC
fixed in latest version of  app-admin/salt