Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

dnf uses repoquery which calls out to yum-utils, yum and dnf are not 1:1 compatible repo config files which causes failure #834

Closed
maxamillion opened this issue Aug 14, 2015 · 2 comments

Comments

@maxamillion
Copy link
Contributor

The include and includepkgs directives for repofiles found in /etc/yum.repos.d/ differ in yum vs dnf and the ansible dnf module currently uses repoquery from the yum-utils package which uses yum on the backend to parse the config files and if you are using the dnf nomenclature for include it causes repoquery to fail.

TASK: [Pre Req Packages] ******************************************************
failed: [localhost] => (item=python-keyczar,yum-utils,python-simplejson,libselinux-python,python-libcloud) => {"failed": true, "item": "python-keyczar,yum-utils,python-simplejson,libselinux-python,python-libcloud"}
msg: Error from repoquery: ['/usr/bin/repoquery', '--show-duplicates', '--plugins', '--quiet', '-q', '--disablerepo=*', '--pkgnarrow=installed', '--qf', '%{name}-%{version}-%{release}.%{arch}', 'python-keyczar']:
Yum-utils package has been deprecated, use dnf instead.
See 'man yum2dnf' for more information.


Traceback (most recent call last):
  File "/usr/bin/repoquery", line 1552, in <module>
    main(sys.argv)
  File "/usr/bin/repoquery", line 1510, in main
    for repo in repoq.repos.findRepos(repo_match):
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 1091, in <lambda>
    repos = property(fget=lambda self: self._getRepos(),
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 715, in _getRepos
    self.getReposFromConfig()
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 584, in getReposFromConfig
    self.getReposFromConfigFile(repofn, repo_age=thisrepo_age)
  File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 468, in getReposFromConfigFile
    parser.readfp(confpp_obj)
  File "/usr/lib/python2.7/site-packages/iniparse/compat.py", line 113, in readfp
    self.data._readfp(fp)
  File "/usr/lib/python2.7/site-packages/iniparse/ini.py", line 556, in _readfp
    for line in readline_iterator(fp):
  File "/usr/lib/python2.7/site-packages/iniparse/ini.py", line 431, in readline_iterator
    line = f.readline()
  File "/usr/lib/python2.7/site-packages/yum/parser.py", line 142, in readline
    fo = self._pushfile( url )
  File "/usr/lib/python2.7/site-packages/yum/parser.py", line 207, in _pushfile
    'Error accessing file for config %s' % (absurl)
yum.Errors.ConfigError: Error accessing file for config file:///etc/yum.repos.d/oneplay-gstreamer-codecs-pack


FATAL: all hosts have already failed -- aborting

Effectively the problem is that in dnf the include directive means "include this list of packages" (from the man page):

include
     list

     Include packages of this repository, specified by a name or a glob and separated by a comma, from  all
     operations.   Inverse  of  exclude,  DNF will exclude any package in the repo. that doesn't match this
     list. This works in conjunction with exclude and doesn't override it, so if you  'exclude=*.i386'  and
     'include=python*'  then only packages starting with python that do not have an i386 arch. will be seen
     by DNF in this repo.  Can be disabled using --disableexcludes command line switch.

However, in yum the include directive means "include the contents of this other file" (from the man page):

URL INCLUDE SYNTAX
       The  inclusion  of  external  configuration  files  is supported for /etc/yum.conf and the .repo files in the
       /etc/yum.repos.d directory. To include a URL, use a line of the following format:

       include=url://to/some/location

       The configuration file will be inserted at the position of the "include=" line.  Included files  may  contain
       further include lines. Yum will abort with an error if an inclusion loop is detected.
@bcoca
Copy link
Member

bcoca commented Aug 14, 2015

cc @DJMuggs

@abadger
Copy link
Contributor

abadger commented Sep 18, 2015

We've just merged a rewrite of the dnf module to devel: https://raw.githubusercontent.com/ansible/ansible-modules-extras/devel/packaging/os/dnf.py The new dnf module doesn't use repoquery so I believe this is fixed. Since this is such a big change it may not be something that we backport to 1.9.x. If you need it before 2.0 is out you can try downloading the new version of the module to use in place of the one that ships with 1.9.x.

Closing This Ticket

Hi!

We believe recent commits (likely detailed above) should resolve this question or problem for you.

This will also be included in the next major release.

If you continue seeing any problems related to this issue, or if you have any further questions, please let us know by stopping by one of the two mailing lists, as appropriate:

Because this project is very active, we're unlikely to see comments made on closed tickets, but the mailing list is a great way to ask questions, or post if you don't think this particular
issue is resolved.

Thank you!

@abadger abadger closed this as completed Sep 18, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants