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

pkg.check_db is not available in salt 2016.3? #36292

Closed
lorengordon opened this issue Sep 14, 2016 · 5 comments
Closed

pkg.check_db is not available in salt 2016.3? #36292

lorengordon opened this issue Sep 14, 2016 · 5 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior Documentation Relates to Salt documentation Execution-Module P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@lorengordon
Copy link
Contributor

lorengordon commented Sep 14, 2016

Description of Issue/Question

As titled, simply running pkg.check_db results in a 'not available' message. I checked issues and pull requests really quick, but didn't see anything about it being deprecated.

Setup

  1. Install salt-minion v2016.3.3 to a fresh build, centos6 in my case.
  2. Run salt-call --local pkg.check_db gdm. (any package name would end up with the same result)

Steps to Reproduce Issue

# salt-call --local -l debug pkg.check_db gdm
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Using cached minion ID from /etc/salt/minion_id: xxx.ec2.internal
[DEBUG   ] Configuration file path: /etc/salt/minion
[WARNING ] Insecure logging configuration detected! Sensitive data may be logged.
[DEBUG   ] Reading configuration from /etc/salt/minion
[DEBUG   ] Please install 'virt-what' to improve results of the 'virtual' grain.
/usr/lib/python2.6/site-packages/salt/grains/core.py:1493: DeprecationWarning: The "osmajorrelease" will be a type of an integer.
[DEBUG   ] Determining pillar cache
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded jinja.render
[DEBUG   ] LazyLoaded yaml.render
[DEBUG   ] LazyLoaded config.get
[DEBUG   ] LazyLoaded boto.assign_funcs
[DEBUG   ] boto_elb requires boto 2.33.0.
[DEBUG   ] boto_kms requires boto 2.38.0.
[ERROR   ] boto_route53 requires at least boto 2.35.0.
[DEBUG   ] Could not LazyLoad pkg.check_db
'pkg.check_db' is not available.

Versions Report

# salt-call --versions-report
Salt Version:
           Salt: 2016.3.3

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.3
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 6.8 Final
        machine: x86_64
        release: 2.6.32-642.3.1.el6.x86_64
         system: Linux
        version: CentOS 6.8 Final
@lorengordon
Copy link
Contributor Author

Found the PR where the function was removed, #29496.

@terminalmage, is there a workaround, maybe another function that is equivalent to pkg.check_db? It's not really clear just reading the discussion or the commit messages why the function was removed...

@lorengordon lorengordon changed the title pkg.check_db is not available in salt 2016.3.3? pkg.check_db is not available in salt 2016.3? Sep 14, 2016
@Ch3LL
Copy link
Contributor

Ch3LL commented Sep 14, 2016

@lorengordon I do want to wait on terminalimages words. right now I'll label this as a documentation bug since we should document in release notes that its not longer available and in the module docs. Depending on his response this might change to a code bug. Thanks

@Ch3LL Ch3LL added Documentation Relates to Salt documentation Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P4 Priority 4 labels Sep 14, 2016
@Ch3LL Ch3LL added this to the Approved milestone Sep 14, 2016
@terminalmage
Copy link
Contributor

Repoquery was removed as a dependency. Since repoquery provided the package suggestions, pkg.check_db was removed.

The main reason for the removal of repoquery was performance. It slowed yumpkg down considerably. It also was not very reliable and when there would be breakage around it, pkg states would fail unless skip_suggestions was set to True.

If you want to get suggestions, provided that you have repoquery available, you can run a command like the below with cmd.run:

YUM (requires yum-utils)

repoquery --plugins --all --quiet --whatprovides somepackage

DNF (requires dnf-plugins-core)

dnf repoquery --plugins --all --quiet --whatprovides somepackage

@lorengordon
Copy link
Contributor Author

Thanks @terminalmage. The use case was more that we have a package we want to install if it is available, but not fail a state if it is not available (because we do not control this particular repo, so we could not just use pkg.installed). We were wrapping the state using pkg.check_db in a jinja test to see if the pkg was available. After I submitted the issue, we tested pkg.latest_version instead and it works for our use case. pkg.list_repo_pkgs also works for this case.

I'm fine closing this now. If you want to keep it open as a placeholder to update the docs, that's fine as well. :)

terminalmage added a commit to terminalmage/salt that referenced this issue Sep 15, 2016
@terminalmage terminalmage modified the milestones: C 4, Approved Sep 15, 2016
@terminalmage terminalmage self-assigned this Sep 15, 2016
@terminalmage
Copy link
Contributor

OK, cool. For your use case, keep in mind that pkg.latest_version returns a non-empty string in 2 cases:

  1. Package available for installation but not currently installed.
  2. Package installed and update is available.

So if you're using this, it would need to be paired with a call to pkg.version or something to determine whether or not the package is already installed.

I added the note to the 2016.3.0 release notes in #36350.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Documentation Relates to Salt documentation Execution-Module P4 Priority 4 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants