diff options
| author | Scott Dodson <sdodson@redhat.com> | 2016-11-28 10:45:42 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-28 10:45:42 -0500 | 
| commit | b93494b9161b5c74601efbea443479bdf461fee2 (patch) | |
| tree | 75b994e9e1e994229743e198baaff5b59f20dd2c | |
| parent | 68d883dd99c118c0374042f9d7ac5573aef0de7e (diff) | |
| parent | dadca6a277f9853e9b7f8d20249a8d4f33af2af0 (diff) | |
Merge pull request #2842 from mscherer/check_dbus_module
Verify the presence of dbus python binding
| -rwxr-xr-x | roles/openshift_facts/library/openshift_facts.py | 12 | 
1 files changed, 10 insertions, 2 deletions
diff --git a/roles/openshift_facts/library/openshift_facts.py b/roles/openshift_facts/library/openshift_facts.py index c23afbc26..ad4b1e47b 100755 --- a/roles/openshift_facts/library/openshift_facts.py +++ b/roles/openshift_facts/library/openshift_facts.py @@ -22,9 +22,14 @@ from distutils.util import strtobool  from distutils.version import LooseVersion  import struct  import socket -from dbus import SystemBus, Interface -from dbus.exceptions import DBusException +HAVE_DBUS=False +try: +    from dbus import SystemBus, Interface +    from dbus.exceptions import DBusException +    HAVE_DBUS=True +except ImportError: +    pass  DOCUMENTATION = '''  --- @@ -2293,6 +2298,9 @@ def main():          add_file_common_args=True,      ) +    if not HAVE_DBUS: +        module.fail_json(msg="This module requires dbus python bindings") +      module.params['gather_subset'] = ['hardware', 'network', 'virtual', 'facter']      module.params['gather_timeout'] = 10      module.params['filter'] = '*'  | 
