Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
salt.3314
0063-Fix-module-import-being-Py3-and-P2.6-compa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0063-Fix-module-import-being-Py3-and-P2.6-compatible.patch of Package salt.3314
From 09b82f601304d719c0b8f3e2251e956dee4b5606 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <bo@suse.de> Date: Thu, 16 Jul 2015 14:21:17 +0200 Subject: [PATCH 63/63] Fix module import being Py3 and P2.6+ compatible. --- salt/modules/node.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/salt/modules/node.py b/salt/modules/node.py index 5df4c09..a20406d 100644 --- a/salt/modules/node.py +++ b/salt/modules/node.py @@ -45,11 +45,14 @@ def _(module): :return: ''' - # importlib is unavailable on python 2.6 - if module == 'collector': - mod = salt.modules.inspectlib.collector - elif module == 'query': - mod = salt.modules.inspectlib.query + + mod = None + try: + import importlib + mod = importlib.import_module("salt.modules.inspectlib.{0}".format(module)) + except ImportError as err: + # No importlib around (2.6) + mod = getattr(__import__("salt.modules.inspectlib", globals(), locals(), fromlist=[str(module)]), module) mod.__grains__ = __grains__ mod.__pillar__ = __pillar__ -- 2.9.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor