Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
salt.4202
0011-Fix-module-import-being-Py3-and-P2.6-compa...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0011-Fix-module-import-being-Py3-and-P2.6-compatible.patch of Package salt.4202
From 3d586f38f579d344c000d504d5dae24d7829e5f6 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk <bo@suse.de> Date: Thu, 16 Jul 2015 14:21:17 +0200 Subject: [PATCH 11/38] 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 767de67..aef6f67 100644 --- a/salt/modules/node.py +++ b/salt/modules/node.py @@ -46,11 +46,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.10.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