Toshio Kuratomi 8c2ef0
diff -up ansible-1.9.1/lib/ansible/modules/extras/packaging/os/dnf.py.bak ansible-1.9.1/lib/ansible/modules/extras/packaging/os/dnf.py
Toshio Kuratomi 8c2ef0
--- ansible-1.9.1/lib/ansible/modules/extras/packaging/os/dnf.py.bak	2015-04-28 11:42:28.000000000 -0700
Toshio Kuratomi 8c2ef0
+++ ansible-1.9.1/lib/ansible/modules/extras/packaging/os/dnf.py	2015-05-27 08:14:09.175829546 -0700
Toshio Kuratomi 8c2ef0
@@ -92,8 +92,10 @@ options:
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
 notes: []
Toshio Kuratomi 8c2ef0
 # informational: requirements for nodes
Toshio Kuratomi 8c2ef0
-requirements: [ dnf ]
Toshio Kuratomi 8c2ef0
-author: Cristian van Ee
Toshio Kuratomi 8c2ef0
+requirements:
Toshio Kuratomi 8c2ef0
+  - dnf
Toshio Kuratomi 8c2ef0
+  - yum-utils (for repoquery)
Toshio Kuratomi 8c2ef0
+author: '"Cristian van Ee (@DJMuggs)" <cristian at cvee.org>'
Toshio Kuratomi 8c2ef0
 '''
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
 EXAMPLES = '''
Toshio Kuratomi 8c2ef0
@@ -137,18 +139,12 @@ def log(msg):
Toshio Kuratomi 8c2ef0
 def dnf_base(conf_file=None, cachedir=False):
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
     my = dnf.Base()
Toshio Kuratomi 8c2ef0
-    my.logging.verbose_level=0
Toshio Kuratomi 8c2ef0
-    my.logging.verbose_level=0
Toshio Kuratomi 8c2ef0
+    my.conf.debuglevel=0
Toshio Kuratomi 8c2ef0
     if conf_file and os.path.exists(conf_file):
Toshio Kuratomi 8c2ef0
-        my.config = conf_file
Toshio Kuratomi 8c2ef0
-    if cachedir or os.geteuid() != 0:
Toshio Kuratomi 8c2ef0
-     if cachedir or os.geteuid() != 0:
Toshio Kuratomi 8c2ef0
-         if hasattr(my, 'setCacheDir'):
Toshio Kuratomi 8c2ef0
-             my.setCacheDir()
Toshio Kuratomi 8c2ef0
-         else:
Toshio Kuratomi 8c2ef0
-             cachedir = cachedir.dnf.Conf()
Toshio Kuratomi 8c2ef0
-             my.repos.setCacheDir(cachedir)
Toshio Kuratomi 8c2ef0
-             my.conf.cache = 0
Toshio Kuratomi 8c2ef0
+        my.conf.config_file_path = conf_file
Toshio Kuratomi 8c2ef0
+        my.conf.read()
Toshio Kuratomi 8c2ef0
+    my.read_all_repos()
Toshio Kuratomi 8c2ef0
+    my.fill_sack()
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
     return my
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
@@ -157,7 +153,7 @@ def install_dnf_utils(module):
Toshio Kuratomi 8c2ef0
     if not module.check_mode:
Toshio Kuratomi 8c2ef0
         dnf_path = module.get_bin_path('dnf')
Toshio Kuratomi 8c2ef0
         if dnf_path:
Toshio Kuratomi 8c2ef0
-            rc, so, se = module.run_command('%s -y install dnf-plugins-core' % dnf_path)
Toshio Kuratomi 8c2ef0
+            rc, so, se = module.run_command('%s -y install yum-utils' % dnf_path)
Toshio Kuratomi 8c2ef0
             if rc == 0:
Toshio Kuratomi 8c2ef0
                 this_path = module.get_bin_path('repoquery')
Toshio Kuratomi 8c2ef0
                 global repoquery
Toshio Kuratomi 8c2ef0
@@ -812,9 +808,9 @@ def main():
Toshio Kuratomi 8c2ef0
     if params['install_repoquery'] and not repoquery and not module.check_mode:
Toshio Kuratomi 8c2ef0
         install_dnf_utils(module)
Toshio Kuratomi 8c2ef0
 
Toshio Kuratomi 8c2ef0
+    if not repoquery:
Toshio Kuratomi 8c2ef0
+        module.fail_json(msg="repoquery is required to use this module at this time. Please install the yum-utils package.")
Toshio Kuratomi 8c2ef0
     if params['list']:
Toshio Kuratomi 8c2ef0
-        if not repoquery:
Toshio Kuratomi 8c2ef0
-            module.fail_json(msg="repoquery is required to use list= with this module. Please install the dnf-utils package.")
Toshio Kuratomi 8c2ef0
         results = dict(results=list_stuff(module, params['conf_file'], params['list']))
Toshio Kuratomi 8c2ef0
         module.exit_json(**results)
Toshio Kuratomi 8c2ef0