salt/split-only-strings-if-they-are-such.patch

51 lines
2.0 KiB
Diff
Raw Normal View History

From 358d18a0cc635b04503d5392ce337227c1f191af Mon Sep 17 00:00:00 2001
From: Bo Maryniuk <bo@suse.de>
Date: Thu, 14 Dec 2017 14:43:52 +0100
Subject: [PATCH] Split only strings, if they are such
* Use unicode literals
* Lintfix: PEP8
See: https://bugzilla.suse.com/show_bug.cgi?id=1072218
https://github.com/saltstack/salt/pull/44991
---
salt/pillar/sql_base.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/salt/pillar/sql_base.py b/salt/pillar/sql_base.py
index e7abceb134..a59c45331f 100644
--- a/salt/pillar/sql_base.py
+++ b/salt/pillar/sql_base.py
@@ -168,7 +168,7 @@ More complete example for MySQL (to also show configuration)
as_list: True
with_lists: [1,3]
'''
-from __future__ import absolute_import
+from __future__ import absolute_import, unicode_literals
# Please don't strip redundant parentheses from this file.
# I have added some for clarity.
@@ -275,7 +275,7 @@ class SqlBaseExtPillar(six.with_metaclass(abc.ABCMeta, object)):
# May set 'as_list' from qb[1][2].
else:
defaults.update(qb[1])
- if defaults['with_lists']:
+ if defaults['with_lists'] and isinstance(defaults['with_lists'], six.string_types):
defaults['with_lists'] = [
int(i) for i in defaults['with_lists'].split(',')
]
@@ -437,8 +437,7 @@ class SqlBaseExtPillar(six.with_metaclass(abc.ABCMeta, object)):
cursor.execute(details['query'], (minion_id,))
# Extract the field names the db has returned and process them
- self.process_fields([row[0] for row in cursor.description],
- details['depth'])
+ self.process_fields([row[0] for row in cursor.description], details['depth'])
self.enter_root(root)
self.as_list = details['as_list']
if details['with_lists']:
--
2.15.1