From d5f661c691b4f5bd8553a86a93a34521f872eb554a19d037cfb4ba303804f5fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= Date: Wed, 16 Sep 2020 12:19:07 +0000 Subject: [PATCH] osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:355 OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=174 --- _lastrevision | 2 +- backport-virt-patches-from-3001-256.patch | 104 +-- ...ed-six.itermitems-and-six.-_type-262.patch | 776 ++++++++++++++++++ fix-virt.update-with-cpu-defined-263.patch | 31 + ...rrors-when-running-test_btrfs-unit-t.patch | 27 + ....0.0-requirement-in-the-installed-me.patch | 495 +++++++++++ salt.changes | 32 + salt.spec | 13 + 8 files changed, 1427 insertions(+), 53 deletions(-) create mode 100644 fix-the-removed-six.itermitems-and-six.-_type-262.patch create mode 100644 fix-virt.update-with-cpu-defined-263.patch create mode 100644 prevent-import-errors-when-running-test_btrfs-unit-t.patch create mode 100644 remove-msgpack-1.0.0-requirement-in-the-installed-me.patch diff --git a/_lastrevision b/_lastrevision index 2ef0b09..392034d 100644 --- a/_lastrevision +++ b/_lastrevision @@ -1 +1 @@ -b193a24466b79150ec137a7e4cc144362b588ef0 \ No newline at end of file +8afd80f388d6e97b882f8564a8afa1acab63e014 \ No newline at end of file diff --git a/backport-virt-patches-from-3001-256.patch b/backport-virt-patches-from-3001-256.patch index 078633b..0e6785a 100644 --- a/backport-virt-patches-from-3001-256.patch +++ b/backport-virt-patches-from-3001-256.patch @@ -1,4 +1,4 @@ -From e6def0c2b8820ca4cd8e1267419300970721a15a Mon Sep 17 00:00:00 2001 +From 5bd071081ccb8ae3938643831d2e5632712b48b7 Mon Sep 17 00:00:00 2001 From: Cedric Bosdonnat Date: Mon, 7 Sep 2020 15:00:40 +0200 Subject: [PATCH] Backport virt patches from 3001+ (#256) @@ -417,7 +417,7 @@ Co-authored-by: Daniel A. Wozniak salt/modules/virt.py | 442 ++++--- salt/states/virt.py | 171 ++- salt/templates/virt/libvirt_domain.jinja | 2 +- - salt/utils/data.py | 977 +++++++++------ + salt/utils/data.py | 976 +++++++++------ salt/utils/xmlutil.py | 251 +++- tests/pytests/unit/utils/test_data.py | 57 + tests/pytests/unit/utils/test_xmlutil.py | 169 +++ @@ -425,7 +425,7 @@ Co-authored-by: Daniel A. Wozniak tests/unit/states/test_virt.py | 98 +- tests/unit/utils/test_data.py | 1399 ++++++++++++---------- tests/unit/utils/test_xmlutil.py | 164 +-- - 14 files changed, 2588 insertions(+), 1363 deletions(-) + 14 files changed, 2588 insertions(+), 1362 deletions(-) create mode 100644 changelog/56454.fixed create mode 100644 changelog/57544.added create mode 100644 changelog/58331.fixed @@ -1957,11 +1957,11 @@ index aac6283eb0..04a61ffa78 100644 {% if boot %} {% if 'kernel' in boot %} diff --git a/salt/utils/data.py b/salt/utils/data.py -index 8f84c2ea42..5a7acc9e7c 100644 +index 8f84c2ea42..1c4c22efb3 100644 --- a/salt/utils/data.py +++ b/salt/utils/data.py -@@ -1,22 +1,15 @@ --# -*- coding: utf-8 -*- +@@ -1,22 +1,16 @@ + # -*- coding: utf-8 -*- -''' +""" Functions for manipulating, inspecting, or otherwise working with data types @@ -1986,7 +1986,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 # Import Salt libs import salt.utils.dictupdate -@@ -24,13 +17,22 @@ import salt.utils.stringutils +@@ -24,13 +18,22 @@ import salt.utils.stringutils import salt.utils.yaml from salt.defaults import DEFAULT_TARGET_DELIM from salt.exceptions import SaltException @@ -2013,7 +2013,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 try: import jmespath -@@ -41,15 +43,16 @@ log = logging.getLogger(__name__) +@@ -41,15 +44,16 @@ log = logging.getLogger(__name__) class CaseInsensitiveDict(MutableMapping): @@ -2034,7 +2034,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 self._data = OrderedDict() self.update(init or {}, **kwargs) -@@ -67,7 +70,7 @@ class CaseInsensitiveDict(MutableMapping): +@@ -67,7 +71,7 @@ class CaseInsensitiveDict(MutableMapping): return self._data[to_lowercase(key)][1] def __iter__(self): @@ -2043,7 +2043,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 def __eq__(self, rval): if not isinstance(rval, Mapping): -@@ -76,28 +79,28 @@ class CaseInsensitiveDict(MutableMapping): +@@ -76,28 +80,28 @@ class CaseInsensitiveDict(MutableMapping): return dict(self.items_lower()) == dict(CaseInsensitiveDict(rval).items_lower()) def __repr__(self): @@ -2081,7 +2081,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 try: return getattr(data, attr)() except AttributeError: -@@ -107,73 +110,120 @@ def __change_case(data, attr, preserve_dict_class=False): +@@ -107,73 +111,120 @@ def __change_case(data, attr, preserve_dict_class=False): if isinstance(data, Mapping): return (data_type if preserve_dict_class else dict)( @@ -2231,7 +2231,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Generic function which will decode whichever type is passed, if necessary. Optionally use to_str=True to ensure strings are str types and not unicode on Python 2. -@@ -199,22 +249,55 @@ def decode(data, encoding=None, errors='strict', keep=False, +@@ -199,22 +250,55 @@ def decode(data, encoding=None, errors='strict', keep=False, two strings above, in which "й" is represented as two code points (i.e. one for the base character, and one for the breve mark). Normalizing allows for a more reliable test case. @@ -2299,7 +2299,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 try: data = _decode_func(data, encoding, errors, normalize) except TypeError: -@@ -228,25 +311,48 @@ def decode(data, encoding=None, errors='strict', keep=False, +@@ -228,25 +312,48 @@ def decode(data, encoding=None, errors='strict', keep=False, return data @@ -2361,7 +2361,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: key = _decode_func(key, encoding, errors, normalize) -@@ -260,17 +366,50 @@ def decode_dict(data, encoding=None, errors='strict', keep=False, +@@ -260,17 +367,50 @@ def decode_dict(data, encoding=None, errors='strict', keep=False, raise if isinstance(value, list): @@ -2421,7 +2421,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: value = _decode_func(value, encoding, errors, normalize) -@@ -287,30 +426,69 @@ def decode_dict(data, encoding=None, errors='strict', keep=False, +@@ -287,30 +427,69 @@ def decode_dict(data, encoding=None, errors='strict', keep=False, return ret @@ -2507,7 +2507,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: item = _decode_func(item, encoding, errors, normalize) -@@ -327,21 +505,35 @@ def decode_list(data, encoding=None, errors='strict', keep=False, +@@ -327,21 +506,35 @@ def decode_list(data, encoding=None, errors='strict', keep=False, return ret @@ -2552,7 +2552,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Generic function which will encode whichever type is passed, if necessary If `strict` is True, and `keep` is False, and we fail to encode, a -@@ -349,18 +541,27 @@ def encode(data, encoding=None, errors='strict', keep=False, +@@ -349,18 +542,27 @@ def encode(data, encoding=None, errors='strict', keep=False, original value to silently be returned in cases where encoding fails. This can be useful for cases where the data passed to this function is likely to contain binary blobs. @@ -2589,7 +2589,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 try: return salt.utils.stringutils.to_bytes(data, encoding, errors) except TypeError: -@@ -374,20 +575,31 @@ def encode(data, encoding=None, errors='strict', keep=False, +@@ -374,20 +576,31 @@ def encode(data, encoding=None, errors='strict', keep=False, return data @@ -2632,7 +2632,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: key = salt.utils.stringutils.to_bytes(key, encoding, errors) -@@ -401,16 +613,21 @@ def encode_dict(data, encoding=None, errors='strict', keep=False, +@@ -401,16 +614,21 @@ def encode_dict(data, encoding=None, errors='strict', keep=False, raise if isinstance(value, list): @@ -2662,7 +2662,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: value = salt.utils.stringutils.to_bytes(value, encoding, errors) -@@ -427,26 +644,40 @@ def encode_dict(data, encoding=None, errors='strict', keep=False, +@@ -427,26 +645,40 @@ def encode_dict(data, encoding=None, errors='strict', keep=False, return ret @@ -2717,7 +2717,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: try: item = salt.utils.stringutils.to_bytes(item, encoding, errors) -@@ -463,42 +694,37 @@ def encode_list(data, encoding=None, errors='strict', keep=False, +@@ -463,42 +695,37 @@ def encode_list(data, encoding=None, errors='strict', keep=False, return ret @@ -2775,7 +2775,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 ret = None # Default value would be an empty list if lookup not found val = traverse_dict_and_list(traverse, lookup, []) -@@ -507,10 +733,8 @@ def filter_by(lookup_dict, +@@ -507,10 +734,8 @@ def filter_by(lookup_dict, # lookup_dict keys for each in val if isinstance(val, list) else [val]: for key in lookup_dict: @@ -2788,7 +2788,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if fnmatch.fnmatchcase(test_each, test_key): ret = lookup_dict[key] break -@@ -528,14 +752,13 @@ def filter_by(lookup_dict, +@@ -528,14 +753,13 @@ def filter_by(lookup_dict, elif isinstance(base_values, Mapping): if not isinstance(ret, Mapping): raise SaltException( @@ -2806,7 +2806,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if ret is None: ret = merge -@@ -546,12 +769,12 @@ def filter_by(lookup_dict, +@@ -546,12 +770,12 @@ def filter_by(lookup_dict, def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): @@ -2821,7 +2821,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 ptr = data try: for each in key.split(delimiter): -@@ -562,9 +785,9 @@ def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): +@@ -562,9 +786,9 @@ def traverse_dict(data, key, default=None, delimiter=DEFAULT_TARGET_DELIM): return ptr @@ -2833,7 +2833,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Traverse a dict or list using a colon-delimited (or otherwise delimited, using the 'delimiter' param) target string. The target 'foo:bar:0' will return data['foo']['bar'][0] if this value exists, and will otherwise -@@ -573,7 +796,7 @@ def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DEL +@@ -573,7 +797,7 @@ def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DEL The target 'foo:bar:0' will return data['foo']['bar'][0] if data like {'foo':{'bar':['baz']}} , if data like {'foo':{'bar':{'0':'baz'}}} then return data['foo']['bar']['0'] @@ -2842,7 +2842,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 ptr = data for each in key.split(delimiter): if isinstance(ptr, list): -@@ -605,18 +828,17 @@ def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DEL +@@ -605,18 +829,17 @@ def traverse_dict_and_list(data, key, default=None, delimiter=DEFAULT_TARGET_DEL return ptr @@ -2867,7 +2867,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 def _match(target, pattern, regex_match=False, exact_match=False): # The reason for using six.text_type first and _then_ using # to_unicode as a fallback is because we want to eventually have -@@ -628,11 +850,11 @@ def subdict_match(data, +@@ -628,11 +851,11 @@ def subdict_match(data, # begin with is that (by design) to_unicode will raise a TypeError if a # non-string/bytestring/bytearray value is passed. try: @@ -2881,7 +2881,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 except UnicodeDecodeError: pattern = salt.utils.stringutils.to_unicode(pattern).lower() -@@ -640,48 +862,54 @@ def subdict_match(data, +@@ -640,48 +863,54 @@ def subdict_match(data, try: return re.match(pattern, target) except Exception: # pylint: disable=broad-except @@ -2956,7 +2956,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 return True return ret -@@ -695,7 +923,7 @@ def subdict_match(data, +@@ -695,7 +924,7 @@ def subdict_match(data, # want to use are 3, 2, and 1, in that order. for idx in range(num_splits - 1, 0, -1): key = delimiter.join(splits[:idx]) @@ -2965,7 +2965,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 # We are matching on everything under the top level, so we need to # treat the match as the entire data being passed in matchstr = expr -@@ -703,54 +931,55 @@ def subdict_match(data, +@@ -703,54 +932,55 @@ def subdict_match(data, else: matchstr = delimiter.join(splits[idx:]) match = traverse_dict_and_list(data, key, {}, delimiter=delimiter) @@ -3044,7 +3044,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if isinstance(data, list): for element in data: if isinstance(element, dict): -@@ -762,16 +991,12 @@ def is_dictlist(data): +@@ -762,16 +992,12 @@ def is_dictlist(data): return False @@ -3065,7 +3065,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 try: data = salt.utils.yaml.safe_load(data) except salt.utils.yaml.parser.ParserError as err: -@@ -783,7 +1008,7 @@ def repack_dictlist(data, +@@ -783,7 +1009,7 @@ def repack_dictlist(data, if val_cb is None: val_cb = lambda x, y: y @@ -3074,7 +3074,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if isinstance(data, list): for element in data: if isinstance(element, valid_non_dict): -@@ -791,21 +1016,21 @@ def repack_dictlist(data, +@@ -791,21 +1017,21 @@ def repack_dictlist(data, if isinstance(element, dict): if len(element) != 1: log.error( @@ -3103,7 +3103,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 ) return {} -@@ -821,8 +1046,8 @@ def repack_dictlist(data, +@@ -821,8 +1047,8 @@ def repack_dictlist(data, ret[key_cb(key)] = repack_dictlist(val, recurse=recurse) elif strict: log.error( @@ -3114,7 +3114,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 ) return {} else: -@@ -832,17 +1057,17 @@ def repack_dictlist(data, +@@ -832,17 +1058,17 @@ def repack_dictlist(data, return ret @@ -3138,7 +3138,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Test if an object is iterable, but not a string type. Test if an object is an iterator or is iterable itself. By default this -@@ -853,7 +1078,7 @@ def is_iter(thing, ignore=six.string_types): +@@ -853,7 +1079,7 @@ def is_iter(thing, ignore=six.string_types): dictionaries or named tuples. Based on https://bitbucket.org/petershinners/yter @@ -3147,7 +3147,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if ignore and isinstance(thing, ignore): return False try: -@@ -863,9 +1088,9 @@ def is_iter(thing, ignore=six.string_types): +@@ -863,9 +1089,9 @@ def is_iter(thing, ignore=six.string_types): return False @@ -3159,7 +3159,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Sort a list of strings ignoring case. >>> L = ['foo', 'Foo', 'bar', 'Bar'] -@@ -874,19 +1099,19 @@ def sorted_ignorecase(to_sort): +@@ -874,19 +1100,19 @@ def sorted_ignorecase(to_sort): >>> sorted(L, key=lambda x: x.lower()) ['bar', 'Bar', 'foo', 'Foo'] >>> @@ -3182,7 +3182,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 # First, try int/float conversion try: value = int(value) -@@ -898,26 +1123,26 @@ def is_true(value=None): +@@ -898,26 +1124,26 @@ def is_true(value=None): pass # Now check for truthiness @@ -3218,7 +3218,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 for comp in range(len(comps)): comps[comp] = comps[comp].strip() if len(headers) > 1: -@@ -934,14 +1159,14 @@ def mysql_to_dict(data, key): +@@ -934,14 +1160,14 @@ def mysql_to_dict(data, key): def simple_types_filter(data): @@ -3236,7 +3236,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 simpletypes_values = tuple(list(simpletypes_keys) + [list, tuple]) if isinstance(data, (list, tuple)): -@@ -957,7 +1182,7 @@ def simple_types_filter(data): +@@ -957,7 +1183,7 @@ def simple_types_filter(data): if isinstance(data, dict): simpledict = {} @@ -3245,7 +3245,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if key is not None and not isinstance(key, simpletypes_keys): key = repr(key) if value is not None and isinstance(value, (dict, list, tuple)): -@@ -971,23 +1196,23 @@ def simple_types_filter(data): +@@ -971,23 +1197,23 @@ def simple_types_filter(data): def stringify(data): @@ -3275,7 +3275,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Query data using JMESPath language (http://jmespath.org). Requires the https://github.com/jmespath/jmespath.py library. -@@ -1009,16 +1234,16 @@ def json_query(data, expr): +@@ -1009,16 +1235,16 @@ def json_query(data, expr): .. code-block:: text [80, 25, 22] @@ -3295,7 +3295,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Helper function for filter_falsey to determine if something is not to be considered falsey. -@@ -1026,12 +1251,12 @@ def _is_not_considered_falsey(value, ignore_types=()): +@@ -1026,12 +1252,12 @@ def _is_not_considered_falsey(value, ignore_types=()): :param list ignore_types: The types to ignore when considering the value. :return bool @@ -3310,7 +3310,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Helper function to remove items from an iterable with falsey value. Removes ``None``, ``{}`` and ``[]``, 0, '' (but does not remove ``False``). Recurses into sub-iterables if ``recurse`` is set to ``True``. -@@ -1045,37 +1270,42 @@ def filter_falsey(data, recurse_depth=None, ignore_types=()): +@@ -1045,37 +1271,42 @@ def filter_falsey(data, recurse_depth=None, ignore_types=()): :return type(data) .. versionadded:: 3000 @@ -3374,7 +3374,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 Performs a recursive diff on mappings and/or iterables and returns the result in a {'old': values, 'new': values}-style. Compares dicts and sets unordered (obviously), OrderedDicts and Lists ordered -@@ -1090,12 +1320,16 @@ def recursive_diff( +@@ -1090,12 +1321,16 @@ def recursive_diff( but missing in ``new``. Only works for regular dicts. :return dict: Returns dict with keys 'old' and 'new' containing the differences. @@ -3393,7 +3393,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 append_old, append_new = [], [] if len(old) != len(new): min_length = min(len(old), len(new)) -@@ -1114,13 +1348,14 @@ def recursive_diff( +@@ -1114,13 +1349,14 @@ def recursive_diff( new[key_new], ignore_keys=ignore_keys, ignore_order=ignore_order, @@ -3411,7 +3411,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 else: if key_old in ignore_keys: del ret_old[key_old] -@@ -1131,7 +1366,7 @@ def recursive_diff( +@@ -1131,7 +1367,7 @@ def recursive_diff( ret_old[item] = old[item] for item in append_new: ret_new[item] = new[item] @@ -3420,7 +3420,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 elif isinstance(old, Mapping) and isinstance(new, Mapping): # Compare unordered for key in set(list(old) + list(new)): -@@ -1146,16 +1381,17 @@ def recursive_diff( +@@ -1146,16 +1382,17 @@ def recursive_diff( new[key], ignore_keys=ignore_keys, ignore_order=ignore_order, @@ -3443,7 +3443,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 elif is_iter(old) and is_iter(new): # Create a list so we can edit on an index-basis. list_old = list(ret_old) -@@ -1168,7 +1404,8 @@ def recursive_diff( +@@ -1168,7 +1405,8 @@ def recursive_diff( item_new, ignore_keys=ignore_keys, ignore_order=ignore_order, @@ -3453,7 +3453,7 @@ index 8f84c2ea42..5a7acc9e7c 100644 if not res: list_old.remove(item_old) list_new.remove(item_new) -@@ -1181,19 +1418,87 @@ def recursive_diff( +@@ -1181,19 +1419,87 @@ def recursive_diff( iter_new, ignore_keys=ignore_keys, ignore_order=ignore_order, diff --git a/fix-the-removed-six.itermitems-and-six.-_type-262.patch b/fix-the-removed-six.itermitems-and-six.-_type-262.patch new file mode 100644 index 0000000..78cf626 --- /dev/null +++ b/fix-the-removed-six.itermitems-and-six.-_type-262.patch @@ -0,0 +1,776 @@ +From 5b6ac3bb81f24bbb8c39f80c71c490c339cce756 Mon Sep 17 00:00:00 2001 +From: Cedric Bosdonnat +Date: Tue, 15 Sep 2020 13:46:06 +0200 +Subject: [PATCH] Fix the removed six.itermitems and six.*_type* (#262) + +* Fix the removed six.itermitems and six.*_type* + +Upstream py2 to py3 cleanup tool removes a bunch of six calls that we +still need when backporting since our Salt minion might still be running +on python 2.7. + +* fixup! Fix the removed six.itermitems and six.*_type* +--- + salt/_compat.py | 1 + + salt/modules/virt.py | 57 +++++++++++----------- + salt/states/virt.py | 15 +++--- + salt/utils/data.py | 51 ++++++++++---------- + salt/utils/xmlutil.py | 5 +- + tests/unit/modules/test_virt.py | 2 +- + tests/unit/utils/test_data.py | 85 ++++++++++++++++++--------------- + 7 files changed, 115 insertions(+), 101 deletions(-) + +diff --git a/salt/_compat.py b/salt/_compat.py +index 965bb90da3..22daaa31a0 100644 +--- a/salt/_compat.py ++++ b/salt/_compat.py +@@ -39,6 +39,7 @@ except Exception: # pylint: disable=broad-except + # True if we are running on Python 3. + PY3 = sys.version_info.major == 3 + ++import xml.sax.saxutils as saxutils + + if PY3: + import builtins +diff --git a/salt/modules/virt.py b/salt/modules/virt.py +index cd80fbe608..c07fabb406 100644 +--- a/salt/modules/virt.py ++++ b/salt/modules/virt.py +@@ -88,8 +88,6 @@ import string # pylint: disable=deprecated-module + import subprocess + import sys + import time +-from xml.etree import ElementTree +-from xml.sax import saxutils + + # Import third party libs + import jinja2.exceptions +@@ -104,7 +102,10 @@ import salt.utils.templates + import salt.utils.xmlutil as xmlutil + import salt.utils.yaml + from salt._compat import ipaddress ++from salt._compat import ElementTree ++from salt._compat import saxutils + from salt.exceptions import CommandExecutionError, SaltInvocationError ++from salt.ext import six + from salt.ext.six.moves import range # pylint: disable=import-error,redefined-builtin + from salt.ext.six.moves.urllib.parse import urlparse, urlunparse + from salt.utils.virt import check_remote, download_remote +@@ -657,8 +658,8 @@ def _gen_xml( + context = { + "hypervisor": hypervisor, + "name": name, +- "cpu": str(cpu), +- "mem": str(mem), ++ "cpu": six.text_type(cpu), ++ "mem": six.text_type(mem), + } + if hypervisor in ["qemu", "kvm"]: + context["controller_model"] = False +@@ -722,7 +723,7 @@ def _gen_xml( + "target_dev": _get_disk_target(targets, len(diskp), prefix), + "disk_bus": disk["model"], + "format": disk.get("format", "raw"), +- "index": str(i), ++ "index": six.text_type(i), + } + targets.append(disk_context["target_dev"]) + if disk.get("source_file"): +@@ -827,8 +828,8 @@ def _gen_vol_xml( + "name": name, + "target": {"permissions": permissions, "nocow": nocow}, + "format": format, +- "size": str(size), +- "allocation": str(int(allocation) * 1024), ++ "size": six.text_type(size), ++ "allocation": six.text_type(int(allocation) * 1024), + "backingStore": backing_store, + } + fn_ = "libvirt_volume.jinja" +@@ -1253,7 +1254,7 @@ def _disk_profile(conn, profile, hypervisor, disks, vm_name): + ) + + # Transform the list to remove one level of dictionary and add the name as a property +- disklist = [dict(d, name=name) for disk in disklist for name, d in disk.items()] ++ disklist = [dict(d, name=name) for disk in disklist for name, d in six.iteritems(disk)] + + # Merge with the user-provided disks definitions + if disks: +@@ -1274,7 +1275,7 @@ def _disk_profile(conn, profile, hypervisor, disks, vm_name): + disk["model"] = "ide" + + # Add the missing properties that have defaults +- for key, val in overlay.items(): ++ for key, val in six.iteritems(overlay): + if key not in disk: + disk[key] = val + +@@ -1422,7 +1423,7 @@ def _complete_nics(interfaces, hypervisor): + """ + Apply the default overlay to attributes + """ +- for key, value in overlays[hypervisor].items(): ++ for key, value in six.iteritems(overlays[hypervisor]): + if key not in attributes or not attributes[key]: + attributes[key] = value + +@@ -1449,7 +1450,7 @@ def _nic_profile(profile_name, hypervisor): + """ + Append dictionary profile data to interfaces list + """ +- for interface_name, attributes in profile_dict.items(): ++ for interface_name, attributes in six.iteritems(profile_dict): + attributes["name"] = interface_name + interfaces.append(attributes) + +@@ -1520,7 +1521,7 @@ def _handle_remote_boot_params(orig_boot): + """ + saltinst_dir = None + new_boot = orig_boot.copy() +- keys = orig_boot.keys() ++ keys = set(orig_boot.keys()) + cases = [ + {"efi"}, + {"kernel", "initrd", "efi"}, +@@ -2380,8 +2381,8 @@ def update( + # Update the cpu + cpu_node = desc.find("vcpu") + if cpu and int(cpu_node.text) != cpu: +- cpu_node.text = str(cpu) +- cpu_node.set("current", str(cpu)) ++ cpu_node.text = six.text_type(cpu) ++ cpu_node.set("current", six.text_type(cpu)) + need_update = True + + def _set_loader(node, value): +@@ -2394,7 +2395,7 @@ def update( + node.set("template", value) + + def _set_with_mib_unit(node, value): +- node.text = str(value) ++ node.text = six.text_type(value) + node.set("unit", "MiB") + + # Update the kernel boot parameters +@@ -2426,7 +2427,7 @@ def update( + }, + ] + +- data = {k: v for k, v in locals().items() if bool(v)} ++ data = {k: v for k, v in six.iteritems(locals()) if bool(v)} + if boot_dev: + data["boot_dev"] = {i + 1: dev for i, dev in enumerate(boot_dev.split())} + need_update = need_update or salt.utils.xmlutil.change_xml( +@@ -2547,7 +2548,7 @@ def update( + # Attaching device + if source_file: + ElementTree.SubElement( +- updated_disk, "source", attrib={"file": source_file} ++ updated_disk, "source", file=source_file + ) + + changes["disk"]["new"] = new_disks +@@ -2609,7 +2610,7 @@ def update( + except libvirt.libvirtError as err: + if "errors" not in status: + status["errors"] = [] +- status["errors"].append(str(err)) ++ status["errors"].append(six.text_type(err)) + + conn.close() + return status +@@ -2823,7 +2824,7 @@ def _node_info(conn): + info = { + "cpucores": raw[6], + "cpumhz": raw[3], +- "cpumodel": str(raw[0]), ++ "cpumodel": six.text_type(raw[0]), + "cpus": raw[2], + "cputhreads": raw[7], + "numanodes": raw[4], +@@ -3628,7 +3629,7 @@ def _define_vol_xml_str(conn, xml, pool=None): # pylint: disable=redefined-oute + poolname = ( + pool if pool else __salt__["config.get"]("virt:storagepool", default_pool) + ) +- pool = conn.storagePoolLookupByName(str(poolname)) ++ pool = conn.storagePoolLookupByName(six.text_type(poolname)) + ret = pool.createXML(xml, 0) is not None + return ret + +@@ -3829,7 +3830,7 @@ def seed_non_shared_migrate(disks, force=False): + + salt '*' virt.seed_non_shared_migrate + """ +- for _, data in disks.items(): ++ for _, data in six.iteritems(disks): + fn_ = data["file"] + form = data["file format"] + size = data["virtual size"].split()[1][1:] +@@ -4852,7 +4853,7 @@ def capabilities(**kwargs): + try: + caps = _capabilities(conn) + except libvirt.libvirtError as err: +- raise CommandExecutionError(str(err)) ++ raise CommandExecutionError(six.text_type(err)) + finally: + conn.close() + return caps +@@ -5352,7 +5353,7 @@ def network_info(name=None, **kwargs): + for net in nets + } + except libvirt.libvirtError as err: +- log.debug("Silenced libvirt error: %s", str(err)) ++ log.debug("Silenced libvirt error: %s", six.text_type(err)) + finally: + conn.close() + return result +@@ -6214,7 +6215,7 @@ def pool_info(name=None, **kwargs): + ] + result = {pool.name(): _pool_extract_infos(pool) for pool in pools} + except libvirt.libvirtError as err: +- log.debug("Silenced libvirt error: %s", str(err)) ++ log.debug("Silenced libvirt error: %s", six.text_type(err)) + finally: + conn.close() + return result +@@ -6591,12 +6592,12 @@ def volume_infos(pool=None, volume=None, **kwargs): + if vol.path(): + as_backing_store = { + path +- for (path, all_paths) in backing_stores.items() ++ for (path, all_paths) in six.iteritems(backing_stores) + if vol.path() in all_paths + } + used_by = [ + vm_name +- for (vm_name, vm_disks) in disks.items() ++ for (vm_name, vm_disks) in six.iteritems(disks) + if vm_disks & as_backing_store or vol.path() in vm_disks + ] + +@@ -6625,9 +6626,9 @@ def volume_infos(pool=None, volume=None, **kwargs): + } + for pool_obj in pools + } +- return {pool_name: volumes for (pool_name, volumes) in vols.items() if volumes} ++ return {pool_name: volumes for (pool_name, volumes) in six.iteritems(vols) if volumes} + except libvirt.libvirtError as err: +- log.debug("Silenced libvirt error: %s", str(err)) ++ log.debug("Silenced libvirt error: %s", six.text_type(err)) + finally: + conn.close() + return result +diff --git a/salt/states/virt.py b/salt/states/virt.py +index 3d99fd53c8..1a0c889d58 100644 +--- a/salt/states/virt.py ++++ b/salt/states/virt.py +@@ -23,6 +23,7 @@ import salt.utils.files + import salt.utils.stringutils + import salt.utils.versions + from salt.exceptions import CommandExecutionError, SaltInvocationError ++from salt.ext import six + + try: + import libvirt # pylint: disable=import-error +@@ -97,7 +98,7 @@ def keys(name, basepath="/etc/pki", **kwargs): + # rename them to something hopefully unique to avoid + # overriding anything existing + pillar_kwargs = {} +- for key, value in kwargs.items(): ++ for key, value in six.iteritems(kwargs): + pillar_kwargs["ext_pillar_virt.{}".format(key)] = value + + pillar = __salt__["pillar.ext"]({"libvirt": "_"}, pillar_kwargs) +@@ -187,7 +188,7 @@ def _virt_call( + else: + noaction_domains.append(targeted_domain) + except libvirt.libvirtError as err: +- ignored_domains.append({"domain": targeted_domain, "issue": str(err)}) ++ ignored_domains.append({"domain": targeted_domain, "issue": six.text_type(err)}) + if not changed_domains: + ret["result"] = not ignored_domains and bool(targeted_domains) + ret["comment"] = "No changes had happened" +@@ -461,7 +462,7 @@ def defined( + ret["comment"] = "Domain {} defined".format(name) + except libvirt.libvirtError as err: + # Something bad happened when defining / updating the VM, report it +- ret["comment"] = str(err) ++ ret["comment"] = six.text_type(err) + ret["result"] = False + + return ret +@@ -704,7 +705,7 @@ def running( + + except libvirt.libvirtError as err: + # Something bad happened when starting / updating the VM, report it +- ret["comment"] = str(err) ++ ret["comment"] = six.text_type(err) + ret["result"] = False + + return ret +@@ -867,7 +868,7 @@ def reverted( + } + except CommandExecutionError as err: + if len(domains) > 1: +- ignored_domains.append({"domain": domain, "issue": str(err)}) ++ ignored_domains.append({"domain": domain, "issue": six.text_type(err)}) + if len(domains) > 1: + if result: + ret["changes"]["reverted"].append(result) +@@ -885,9 +886,9 @@ def reverted( + if not ret["changes"]["reverted"]: + ret["changes"].pop("reverted") + except libvirt.libvirtError as err: +- ret["comment"] = str(err) ++ ret["comment"] = six.text_type(err) + except CommandExecutionError as err: +- ret["comment"] = str(err) ++ ret["comment"] = six.text_type(err) + + return ret + +diff --git a/salt/utils/data.py b/salt/utils/data.py +index 1c4c22efb3..d98b56e06f 100644 +--- a/salt/utils/data.py ++++ b/salt/utils/data.py +@@ -4,6 +4,7 @@ Functions for manipulating, inspecting, or otherwise working with data types + and data structures. + """ + ++from __future__ import absolute_import, print_function, unicode_literals + + # Import Python libs + import copy +@@ -71,7 +72,7 @@ class CaseInsensitiveDict(MutableMapping): + return self._data[to_lowercase(key)][1] + + def __iter__(self): +- return (item[0] for item in self._data.values()) ++ return (item[0] for item in six.itervalues(self._data)) + + def __eq__(self, rval): + if not isinstance(rval, Mapping): +@@ -80,20 +81,20 @@ class CaseInsensitiveDict(MutableMapping): + return dict(self.items_lower()) == dict(CaseInsensitiveDict(rval).items_lower()) + + def __repr__(self): +- return repr(dict(self.items())) ++ return repr(dict(six.iteritems(self))) + + def items_lower(self): + """ + Returns a generator iterating over keys and values, with the keys all + being lowercase. + """ +- return ((key, val[1]) for key, val in self._data.items()) ++ return ((key, val[1]) for key, val in six.iteritems(self._data)) + + def copy(self): + """ + Returns a copy of the object + """ +- return CaseInsensitiveDict(self._data.items()) ++ return CaseInsensitiveDict(six.iteritems(self._data)) + + + def __change_case(data, attr, preserve_dict_class=False): +@@ -115,7 +116,7 @@ def __change_case(data, attr, preserve_dict_class=False): + __change_case(key, attr, preserve_dict_class), + __change_case(val, attr, preserve_dict_class), + ) +- for key, val in data.items() ++ for key, val in six.iteritems(data) + ) + if isinstance(data, Sequence): + return data_type( +@@ -145,7 +146,7 @@ def compare_dicts(old=None, new=None): + dict describing the changes that were made. + """ + ret = {} +- for key in set(new or {}).union(old or {}): ++ for key in set((new or {})).union((old or {})): + if key not in old: + # New key + ret[key] = {"old": "", "new": new[key]} +@@ -205,7 +206,7 @@ def _remove_circular_refs(ob, _seen=None): + if isinstance(ob, dict): + res = { + _remove_circular_refs(k, _seen): _remove_circular_refs(v, _seen) +- for k, v in ob.items() ++ for k, v in six.iteritems(ob) + } + elif isinstance(ob, (list, tuple, set, frozenset)): + res = type(ob)(_remove_circular_refs(v, _seen) for v in ob) +@@ -336,7 +337,7 @@ def decode_dict( + ) + # Make sure we preserve OrderedDicts + ret = data.__class__() if preserve_dict_class else {} +- for key, value in data.items(): ++ for key, value in six.iteritems(data): + if isinstance(key, tuple): + key = ( + decode_tuple( +@@ -592,7 +593,7 @@ def encode_dict( + # Clean data object before encoding to avoid circular references + data = _remove_circular_refs(data) + ret = data.__class__() if preserve_dict_class else {} +- for key, value in data.items(): ++ for key, value in six.iteritems(data): + if isinstance(key, tuple): + key = ( + encode_tuple(key, encoding, errors, keep, preserve_dict_class) +@@ -734,8 +735,8 @@ def filter_by(lookup_dict, lookup, traverse, merge=None, default="default", base + # lookup_dict keys + for each in val if isinstance(val, list) else [val]: + for key in lookup_dict: +- test_key = key if isinstance(key, str) else str(key) +- test_each = each if isinstance(each, str) else str(each) ++ test_key = key if isinstance(key, six.string_types) else six.text_type(key) ++ test_each = each if isinstance(each, six.string_types) else six.text_type(each) + if fnmatch.fnmatchcase(test_each, test_key): + ret = lookup_dict[key] + break +@@ -851,11 +852,11 @@ def subdict_match( + # begin with is that (by design) to_unicode will raise a TypeError if a + # non-string/bytestring/bytearray value is passed. + try: +- target = str(target).lower() ++ target = six.text_type(target).lower() + except UnicodeDecodeError: + target = salt.utils.stringutils.to_unicode(target).lower() + try: +- pattern = str(pattern).lower() ++ pattern = six.text_type(pattern).lower() + except UnicodeDecodeError: + pattern = salt.utils.stringutils.to_unicode(pattern).lower() + +@@ -997,7 +998,7 @@ def repack_dictlist(data, strict=False, recurse=False, key_cb=None, val_cb=None) + Takes a list of one-element dicts (as found in many SLS schemas) and + repacks into a single dictionary. + """ +- if isinstance(data, str): ++ if isinstance(data, six.string_types): + try: + data = salt.utils.yaml.safe_load(data) + except salt.utils.yaml.parser.ParserError as err: +@@ -1009,7 +1010,7 @@ def repack_dictlist(data, strict=False, recurse=False, key_cb=None, val_cb=None) + if val_cb is None: + val_cb = lambda x, y: y + +- valid_non_dict = ((str,), (int,), float) ++ valid_non_dict = (six.string_types, six.integer_types, float) + if isinstance(data, list): + for element in data: + if isinstance(element, valid_non_dict): +@@ -1067,7 +1068,7 @@ def is_list(value): + + + @jinja_filter("is_iter") +-def is_iter(thing, ignore=(str,)): ++def is_iter(thing, ignore=six.string_types): + """ + Test if an object is iterable, but not a string type. + +@@ -1124,10 +1125,10 @@ def is_true(value=None): + pass + + # Now check for truthiness +- if isinstance(value, ((int,), float)): ++ if isinstance(value, (six.integer_types, float)): + return value > 0 +- if isinstance(value, str): +- return str(value).lower() == "true" ++ if isinstance(value, six.string_types): ++ return six.text_type(value).lower() == "true" + return bool(value) + + +@@ -1167,7 +1168,7 @@ def simple_types_filter(data): + if data is None: + return data + +- simpletypes_keys = ((str,), str, (int,), float, bool) ++ simpletypes_keys = (six.string_types, six.text_type, six.integer_types, float, bool) + simpletypes_values = tuple(list(simpletypes_keys) + [list, tuple]) + + if isinstance(data, (list, tuple)): +@@ -1183,7 +1184,7 @@ def simple_types_filter(data): + + if isinstance(data, dict): + simpledict = {} +- for key, value in data.items(): ++ for key, value in six.iteritems(data): + if key is not None and not isinstance(key, simpletypes_keys): + key = repr(key) + if value is not None and isinstance(value, (dict, list, tuple)): +@@ -1205,8 +1206,8 @@ def stringify(data): + for item in data: + if six.PY2 and isinstance(item, str): + item = salt.utils.stringutils.to_unicode(item) +- elif not isinstance(item, str): +- item = str(item) ++ elif not isinstance(item, six.string_types): ++ item = six.text_type(item) + ret.append(item) + return ret + +@@ -1282,7 +1283,7 @@ def filter_falsey(data, recurse_depth=None, ignore_types=()): + + if isinstance(data, dict): + processed_elements = [ +- (key, filter_element(value)) for key, value in data.items() ++ (key, filter_element(value)) for key, value in six.iteritems(data) + ] + return type(data)( + [ +@@ -1472,7 +1473,7 @@ def get_value(obj, path, default=None): + if obj is None: + return res + if isinstance(obj, dict): +- items = obj.items() ++ items = six.iteritems(obj) + elif isinstance(obj, list): + items = enumerate(obj) + +diff --git a/salt/utils/xmlutil.py b/salt/utils/xmlutil.py +index 2b9c7bf43f..68191bc528 100644 +--- a/salt/utils/xmlutil.py ++++ b/salt/utils/xmlutil.py +@@ -9,6 +9,7 @@ from xml.etree import ElementTree + + # Import salt libs + import salt.utils.data ++from salt.ext import six + + + def _conv_name(x): +@@ -147,7 +148,7 @@ def set_node_text(node, value): + :param node: the node to set the text to + :param value: the value to set + """ +- node.text = str(value) ++ node.text = six.text_type(value) + + + def clean_node(parent_map, node, ignored=None): +@@ -162,7 +163,7 @@ def clean_node(parent_map, node, ignored=None): + has_text = node.text is not None and node.text.strip() + parent = parent_map.get(node) + if ( +- len(node.attrib.keys() - (ignored or [])) == 0 ++ len(set(node.attrib.keys()) - set(ignored or [])) == 0 + and not list(node) + and not has_text + ): +diff --git a/tests/unit/modules/test_virt.py b/tests/unit/modules/test_virt.py +index 5ec8de77e7..27c4b9d1b0 100644 +--- a/tests/unit/modules/test_virt.py ++++ b/tests/unit/modules/test_virt.py +@@ -48,7 +48,7 @@ class LibvirtMock(MagicMock): # pylint: disable=too-many-ancestors + """ + + def __init__(self, msg): +- super().__init__(msg) ++ super(Exception, self).__init__(msg) + self.msg = msg + + def get_error_message(self): +diff --git a/tests/unit/utils/test_data.py b/tests/unit/utils/test_data.py +index 8a6956d442..fb4a8cc3c2 100644 +--- a/tests/unit/utils/test_data.py ++++ b/tests/unit/utils/test_data.py +@@ -1,14 +1,17 @@ ++# -*- coding: utf-8 -*- + """ + Tests for salt.utils.data + """ + + # Import Python libs ++from __future__ import absolute_import, print_function, unicode_literals + + import logging + + # Import Salt libs + import salt.utils.data + import salt.utils.stringutils ++from salt.ext import six + + # Import 3rd party libs + from salt.ext.six.moves import ( # pylint: disable=import-error,redefined-builtin +@@ -414,18 +417,19 @@ class DataTestCase(TestCase): + ) + self.assertEqual(ret, expected) + +- # The binary data in the data structure should fail to decode, even +- # using the fallback, and raise an exception. +- self.assertRaises( +- UnicodeDecodeError, +- salt.utils.data.decode, +- self.test_data, +- keep=False, +- normalize=True, +- preserve_dict_class=True, +- preserve_tuples=True, +- to_str=True, +- ) ++ if six.PY3: ++ # The binary data in the data structure should fail to decode, even ++ # using the fallback, and raise an exception. ++ self.assertRaises( ++ UnicodeDecodeError, ++ salt.utils.data.decode, ++ self.test_data, ++ keep=False, ++ normalize=True, ++ preserve_dict_class=True, ++ preserve_tuples=True, ++ to_str=True, ++ ) + + # Now munge the expected data so that we get what we would expect if we + # disable preservation of dict class and tuples +@@ -469,9 +473,14 @@ class DataTestCase(TestCase): + + # Test binary blob + self.assertEqual(salt.utils.data.decode(BYTES, keep=True, to_str=True), BYTES) +- self.assertRaises( +- UnicodeDecodeError, salt.utils.data.decode, BYTES, keep=False, to_str=True, +- ) ++ if six.PY3: ++ self.assertRaises( ++ UnicodeDecodeError, ++ salt.utils.data.decode, ++ BYTES, ++ keep=False, ++ to_str=True, ++ ) + + def test_decode_fallback(self): + """ +@@ -666,7 +675,7 @@ class DataTestCase(TestCase): + self.assertRaises(TypeError, salt.utils.data.stringify, 9) + self.assertEqual( + salt.utils.data.stringify( +- ["one", "two", "three", 4, 5] ++ ["one", "two", str("three"), 4, 5] + ), # future lint: disable=blacklisted-function + ["one", "two", "three", "4", "5"], + ) +@@ -720,7 +729,7 @@ class FilterFalseyTestCase(TestCase): + # Check returned type equality + self.assertIs(type(old_list), type(new_list)) + # Test with set +- old_set = {"foo", "bar"} ++ old_set = set(["foo", "bar"]) + new_set = salt.utils.data.filter_falsey(old_set) + self.assertEqual(old_set, new_set) + # Check returned type equality +@@ -839,9 +848,9 @@ class FilterFalseyTestCase(TestCase): + Test filtering a set without recursing. + Note that a set cannot contain unhashable types, so recursion is not possible. + """ +- old_set = {"foo", None, 0, ""} ++ old_set = set(["foo", None, 0, ""]) + new_set = salt.utils.data.filter_falsey(old_set) +- expect_set = {"foo"} ++ expect_set = set(["foo"]) + self.assertEqual(expect_set, new_set) + self.assertIs(type(expect_set), type(new_set)) + +@@ -1053,13 +1062,13 @@ class FilterRecursiveDiff(TestCase): + """ + Test cases where equal sets are compared. + """ +- test_set = {0, 1, 2, 3, "foo"} ++ test_set = set([0, 1, 2, 3, "foo"]) + self.assertEqual({}, salt.utils.data.recursive_diff(test_set, test_set)) + + # This is a bit of an oddity, as python seems to sort the sets in memory + # so both sets end up with the same ordering (0..3). +- set_one = {0, 1, 2, 3} +- set_two = {3, 2, 1, 0} ++ set_one = set([0, 1, 2, 3]) ++ set_two = set([3, 2, 1, 0]) + self.assertEqual({}, salt.utils.data.recursive_diff(set_one, set_two)) + + def test_tuple_equality(self): +@@ -1149,13 +1158,13 @@ class FilterRecursiveDiff(TestCase): + Tricky as the sets are compared zipped, so shuffled sets of equal values + are considered different. + """ +- set_one = {0, 1, 2, 4} +- set_two = {0, 1, 3, 4} +- expected_result = {"old": {2}, "new": {3}} ++ set_one = set([0, 1, 2, 4]) ++ set_two = set([0, 1, 3, 4]) ++ expected_result = {"old": set([2]), "new": set([3])} + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(set_one, set_two) + ) +- expected_result = {"new": {2}, "old": {3}} ++ expected_result = {"new": set([2]), "old": set([3])} + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(set_two, set_one) + ) +@@ -1164,8 +1173,8 @@ class FilterRecursiveDiff(TestCase): + # Python 2.7 seems to sort it (i.e. set_one below becomes {0, 1, 'foo', 'bar'} + # However Python 3.6.8 stores it differently each run. + # So just test for "not equal" here. +- set_one = {0, "foo", 1, "bar"} +- set_two = {"foo", 1, "bar", 2} ++ set_one = set([0, "foo", 1, "bar"]) ++ set_two = set(["foo", 1, "bar", 2]) + expected_result = {} + self.assertNotEqual( + expected_result, salt.utils.data.recursive_diff(set_one, set_two) +@@ -1203,18 +1212,18 @@ class FilterRecursiveDiff(TestCase): + expected_result, salt.utils.data.recursive_diff(list_two, list_one) + ) + +- mixed_one = {"foo": {0, 1, 2}, "bar": [0, 1, 2]} +- mixed_two = {"foo": {1, 2, 3}, "bar": [1, 2, 3]} ++ mixed_one = {"foo": set([0, 1, 2]), "bar": [0, 1, 2]} ++ mixed_two = {"foo": set([1, 2, 3]), "bar": [1, 2, 3]} + expected_result = { +- "old": {"foo": {0}, "bar": [0, 1, 2]}, +- "new": {"foo": {3}, "bar": [1, 2, 3]}, ++ "old": {"foo": set([0]), "bar": [0, 1, 2]}, ++ "new": {"foo": set([3]), "bar": [1, 2, 3]}, + } + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(mixed_one, mixed_two) + ) + expected_result = { +- "new": {"foo": {0}, "bar": [0, 1, 2]}, +- "old": {"foo": {3}, "bar": [1, 2, 3]}, ++ "new": {"foo": set([0]), "bar": [0, 1, 2]}, ++ "old": {"foo": set([3]), "bar": [1, 2, 3]}, + } + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(mixed_two, mixed_one) +@@ -1236,7 +1245,7 @@ class FilterRecursiveDiff(TestCase): + Test case comparing a list with a set, will be compared unordered. + """ + mixed_one = [1, 2, 3] +- mixed_two = {3, 2, 1} ++ mixed_two = set([3, 2, 1]) + expected_result = {} + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(mixed_one, mixed_two) +@@ -1351,9 +1360,9 @@ class FilterRecursiveDiff(TestCase): + Test case comparing two sets of unequal length. + This does not do anything special, as it is unordered. + """ +- set_one = {1, 2, 3} +- set_two = {4, 3, 2, 1} +- expected_result = {"old": set(), "new": {4}} ++ set_one = set([1, 2, 3]) ++ set_two = set([4, 3, 2, 1]) ++ expected_result = {"old": set([]), "new": set([4])} + self.assertEqual( + expected_result, salt.utils.data.recursive_diff(set_one, set_two) + ) +-- +2.28.0 + + diff --git a/fix-virt.update-with-cpu-defined-263.patch b/fix-virt.update-with-cpu-defined-263.patch new file mode 100644 index 0000000..e61f0d8 --- /dev/null +++ b/fix-virt.update-with-cpu-defined-263.patch @@ -0,0 +1,31 @@ +From 37800f008e46a7321bcd4b88b4858d3ea1fabcdf Mon Sep 17 00:00:00 2001 +From: Cedric Bosdonnat +Date: Tue, 15 Sep 2020 16:03:30 +0200 +Subject: [PATCH] Fix virt.update with cpu defined (#263) + +In case the cpu was defined the rest of the definition wasn't completely +updated. +--- + salt/modules/virt.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/salt/modules/virt.py b/salt/modules/virt.py +index c07fabb406..4a8a55ced6 100644 +--- a/salt/modules/virt.py ++++ b/salt/modules/virt.py +@@ -2430,9 +2430,9 @@ def update( + data = {k: v for k, v in six.iteritems(locals()) if bool(v)} + if boot_dev: + data["boot_dev"] = {i + 1: dev for i, dev in enumerate(boot_dev.split())} +- need_update = need_update or salt.utils.xmlutil.change_xml( ++ need_update = salt.utils.xmlutil.change_xml( + desc, data, params_mapping +- ) ++ ) or need_update + + # Update the XML definition with the new disks and diff changes + devices_node = desc.find("devices") +-- +2.28.0 + + diff --git a/prevent-import-errors-when-running-test_btrfs-unit-t.patch b/prevent-import-errors-when-running-test_btrfs-unit-t.patch new file mode 100644 index 0000000..399bdf2 --- /dev/null +++ b/prevent-import-errors-when-running-test_btrfs-unit-t.patch @@ -0,0 +1,27 @@ +From 116141f87df4179962dcd643d914260121447712 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= + +Date: Wed, 16 Sep 2020 12:40:47 +0100 +Subject: [PATCH] Prevent import errors when running test_btrfs unit + tests + +--- + tests/unit/states/test_btrfs.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/unit/states/test_btrfs.py b/tests/unit/states/test_btrfs.py +index c722630aef..c54579e681 100644 +--- a/tests/unit/states/test_btrfs.py ++++ b/tests/unit/states/test_btrfs.py +@@ -37,6 +37,7 @@ from tests.support.mock import ( + + from salt.exceptions import CommandExecutionError + import salt.states.btrfs as btrfs ++import salt.utils.platform + + import pytest + +-- +2.28.0 + + diff --git a/remove-msgpack-1.0.0-requirement-in-the-installed-me.patch b/remove-msgpack-1.0.0-requirement-in-the-installed-me.patch new file mode 100644 index 0000000..da34628 --- /dev/null +++ b/remove-msgpack-1.0.0-requirement-in-the-installed-me.patch @@ -0,0 +1,495 @@ +From 1b17b0afa2f9567e71062fb7bec20efa609cd471 Mon Sep 17 00:00:00 2001 +From: Duncan Mac-Vicar P +Date: Wed, 16 Sep 2020 12:08:40 +0200 +Subject: [PATCH] Remove msgpack<1.0.0 requirement in the installed + metadata (#261) + +We do run Salt with msgpack>=1.0.0. A program using this metadata to +check if dependencies are satisfied will break, as salt-sproxy does. + +update msgpack + +fix msg_test + +fix .decode + +fix .decode 2 + +fix failing tests + +undo decode 2 + +fix strict_map_key + +fix tab error + +add back raw True + +fix upack kwargs + +add raw false + +move raw false + +raw=false move + +clean up +--- + pkg/osx/req.txt | 2 +- + requirements/base.txt | 2 +- + requirements/static/py2.7/darwin.txt | 4 +- + requirements/static/py2.7/linux.txt | 2 +- + requirements/static/py2.7/windows.txt | 4 +- + requirements/static/py3.4/linux.txt | 2 +- + requirements/static/py3.5/darwin.txt | 4 +- + requirements/static/py3.5/linux.txt | 2 +- + requirements/static/py3.5/windows.txt | 4 +- + requirements/static/py3.6/darwin.txt | 4 +- + requirements/static/py3.6/linux.txt | 2 +- + requirements/static/py3.6/windows.txt | 4 +- + requirements/static/py3.7/darwin.txt | 4 +- + requirements/static/py3.7/linux.txt | 2 +- + requirements/static/py3.7/windows.txt | 4 +- + requirements/static/py3.8/darwin.txt | 4 +- + requirements/static/py3.8/linux.txt | 2 +- + requirements/static/py3.9/darwin.txt | 4 +- + requirements/static/py3.9/linux.txt | 2 +- + salt/serializers/msgpack.py | 22 +++++++- + salt/utils/msgpack.py | 9 +-- + tests/unit/utils/test_msgpack.py | 80 ++++++++++++++++++++++++++- + 22 files changed, 131 insertions(+), 38 deletions(-) + +diff --git a/pkg/osx/req.txt b/pkg/osx/req.txt +index e65ac89f3e..5716834001 100644 +--- a/pkg/osx/req.txt ++++ b/pkg/osx/req.txt +@@ -15,7 +15,7 @@ jinja2==2.10.1 + linode-python==1.1.1 + Mako==1.0.7 + markupsafe==1.1.1 +-msgpack-python==0.5.6 ++msgpack==1.0.0 + psutil==5.6.1 + pyasn1==0.4.5 + pycparser==2.19 +diff --git a/requirements/base.txt b/requirements/base.txt +index 8adf76a2a0..d822973bcb 100644 +--- a/requirements/base.txt ++++ b/requirements/base.txt +@@ -1,5 +1,5 @@ + Jinja2 +-msgpack>=0.5,!=0.5.5,<1.0.0 ++msgpack>=0.5,!=0.5.5 + PyYAML + MarkupSafe + requests>=1.0.0 +diff --git a/requirements/static/py2.7/darwin.txt b/requirements/static/py2.7/darwin.txt +index 1139683ede..abad9aaacb 100644 +--- a/requirements/static/py2.7/darwin.txt ++++ b/requirements/static/py2.7/darwin.txt +@@ -73,8 +73,8 @@ meld3==1.0.2 # via supervisor + mock==3.0.5 ; python_version < "3.6" + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py2.7/linux.txt b/requirements/static/py2.7/linux.txt +index b6bab5e0f6..512e843e56 100644 +--- a/requirements/static/py2.7/linux.txt ++++ b/requirements/static/py2.7/linux.txt +@@ -69,7 +69,7 @@ meld3==1.0.2 # via supervisor + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py2.7/windows.txt b/requirements/static/py2.7/windows.txt +index 446e3c2cda..92374b3b07 100644 +--- a/requirements/static/py2.7/windows.txt ++++ b/requirements/static/py2.7/windows.txt +@@ -64,8 +64,8 @@ meld3==1.0.2 # via supervisor + mock==3.0.5 ; python_version < "3.6" + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + packaging==19.2 # via pytest + patch==1.16 + pathlib2==2.3.3 # via importlib-metadata, pytest +diff --git a/requirements/static/py3.4/linux.txt b/requirements/static/py3.4/linux.txt +index 4bc5ed8cc9..697ec567f5 100644 +--- a/requirements/static/py3.4/linux.txt ++++ b/requirements/static/py3.4/linux.txt +@@ -59,7 +59,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.5/darwin.txt b/requirements/static/py3.5/darwin.txt +index d01d1c93ff..967a7a1f52 100644 +--- a/requirements/static/py3.5/darwin.txt ++++ b/requirements/static/py3.5/darwin.txt +@@ -64,8 +64,8 @@ markupsafe==1.1.1 + mock==3.0.5 ; python_version < "3.6" + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.5/linux.txt b/requirements/static/py3.5/linux.txt +index 9309059b6c..464a2264f1 100644 +--- a/requirements/static/py3.5/linux.txt ++++ b/requirements/static/py3.5/linux.txt +@@ -59,7 +59,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.5/windows.txt b/requirements/static/py3.5/windows.txt +index 7918945e00..a5ea817671 100644 +--- a/requirements/static/py3.5/windows.txt ++++ b/requirements/static/py3.5/windows.txt +@@ -54,8 +54,8 @@ markupsafe==1.1.1 + mock==3.0.5 ; python_version < "3.6" + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + packaging==19.2 # via pytest + patch==1.16 + pathlib2==2.3.3 # via pytest +diff --git a/requirements/static/py3.6/darwin.txt b/requirements/static/py3.6/darwin.txt +index 2dc822beb8..f07bc77fff 100644 +--- a/requirements/static/py3.6/darwin.txt ++++ b/requirements/static/py3.6/darwin.txt +@@ -64,8 +64,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.6/linux.txt b/requirements/static/py3.6/linux.txt +index e5eead5572..3f6b0795b5 100644 +--- a/requirements/static/py3.6/linux.txt ++++ b/requirements/static/py3.6/linux.txt +@@ -59,7 +59,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.6/windows.txt b/requirements/static/py3.6/windows.txt +index 83896f9d3f..b6548ed329 100644 +--- a/requirements/static/py3.6/windows.txt ++++ b/requirements/static/py3.6/windows.txt +@@ -54,8 +54,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + packaging==19.2 # via pytest + patch==1.16 + pathtools==0.1.2 # via watchdog +diff --git a/requirements/static/py3.7/darwin.txt b/requirements/static/py3.7/darwin.txt +index 616563d7b6..490ba230f7 100644 +--- a/requirements/static/py3.7/darwin.txt ++++ b/requirements/static/py3.7/darwin.txt +@@ -63,8 +63,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.7/linux.txt b/requirements/static/py3.7/linux.txt +index 92eedc94d5..a3d00a0b83 100644 +--- a/requirements/static/py3.7/linux.txt ++++ b/requirements/static/py3.7/linux.txt +@@ -59,7 +59,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.7/windows.txt b/requirements/static/py3.7/windows.txt +index d6499eaacd..27d619b1d6 100644 +--- a/requirements/static/py3.7/windows.txt ++++ b/requirements/static/py3.7/windows.txt +@@ -53,8 +53,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + packaging==19.2 # via pytest + patch==1.16 + pathtools==0.1.2 # via watchdog +diff --git a/requirements/static/py3.8/darwin.txt b/requirements/static/py3.8/darwin.txt +index 95bcd7748d..3164168937 100644 +--- a/requirements/static/py3.8/darwin.txt ++++ b/requirements/static/py3.8/darwin.txt +@@ -62,8 +62,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.8/linux.txt b/requirements/static/py3.8/linux.txt +index 5d42a310fa..217f07267e 100644 +--- a/requirements/static/py3.8/linux.txt ++++ b/requirements/static/py3.8/linux.txt +@@ -57,7 +57,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.9/darwin.txt b/requirements/static/py3.9/darwin.txt +index 419f8ee1d1..c5f02fd7a5 100644 +--- a/requirements/static/py3.9/darwin.txt ++++ b/requirements/static/py3.9/darwin.txt +@@ -62,8 +62,8 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack-python==0.5.6 +-msgpack==0.5.6 ++msgpack==1.0.0 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/requirements/static/py3.9/linux.txt b/requirements/static/py3.9/linux.txt +index b7eb8320de..8db5efa224 100644 +--- a/requirements/static/py3.9/linux.txt ++++ b/requirements/static/py3.9/linux.txt +@@ -57,7 +57,7 @@ markupsafe==1.1.1 + mock==3.0.5 + more-itertools==5.0.0 + moto==1.3.7 +-msgpack==0.5.6 ++msgpack==1.0.0 + ncclient==0.6.4 # via junos-eznc + netaddr==0.7.19 # via junos-eznc + oscrypto==1.2.0 # via certvalidator +diff --git a/salt/serializers/msgpack.py b/salt/serializers/msgpack.py +index 6082686cba..667ff8b12e 100644 +--- a/salt/serializers/msgpack.py ++++ b/salt/serializers/msgpack.py +@@ -32,6 +32,24 @@ if not available: + def _deserialize(stream_or_string, **options): + _fail() + ++ ++elif salt.utils.msgpack.version >= (1, 0, 0): ++ ++ def _serialize(obj, **options): ++ try: ++ return salt.utils.msgpack.dumps(obj, **options) ++ except Exception as error: # pylint: disable=broad-except ++ raise SerializationError(error) ++ ++ def _deserialize(stream_or_string, **options): ++ try: ++ options.setdefault("use_list", True) ++ options.setdefault("raw", False) ++ return salt.utils.msgpack.loads(stream_or_string, **options) ++ except Exception as error: # pylint: disable=broad-except ++ raise DeserializationError(error) ++ ++ + elif salt.utils.msgpack.version >= (0, 2, 0): + + def _serialize(obj, **options): +@@ -42,8 +60,8 @@ elif salt.utils.msgpack.version >= (0, 2, 0): + + def _deserialize(stream_or_string, **options): + try: +- options.setdefault('use_list', True) +- options.setdefault('encoding', 'utf-8') ++ options.setdefault("use_list", True) ++ options.setdefault("encoding", "utf-8") + return salt.utils.msgpack.loads(stream_or_string, **options) + except Exception as error: # pylint: disable=broad-except + raise DeserializationError(error) +diff --git a/salt/utils/msgpack.py b/salt/utils/msgpack.py +index 027fe81a18..4a97a87522 100644 +--- a/salt/utils/msgpack.py ++++ b/salt/utils/msgpack.py +@@ -76,10 +76,11 @@ def _sanitize_msgpack_unpack_kwargs(kwargs): + https://github.com/msgpack/msgpack-python/blob/master/ChangeLog.rst + """ + assert isinstance(kwargs, dict) +- if version >= (1, 0, 0) and kwargs.get("raw", None) is None: +- log.info("adding `raw=True` argument to msgpack call") +- kwargs["raw"] = True +- ++ if version >= (1, 0, 0): ++ kwargs.setdefault("raw", True) ++ kwargs.setdefault("strict_map_key", False) ++ if "encoding" in kwargs: ++ del kwargs["encoding"] + return _sanitize_msgpack_kwargs(kwargs) + + +diff --git a/tests/unit/utils/test_msgpack.py b/tests/unit/utils/test_msgpack.py +index cac7c1e9b1..f3e7b74f64 100644 +--- a/tests/unit/utils/test_msgpack.py ++++ b/tests/unit/utils/test_msgpack.py +@@ -182,7 +182,78 @@ class TestMsgpack(TestCase): + + msgpack_items = set(x for x in dir(msgpack) if not x.startswith('_') and sanitized(x)) + msgpack_util_items = set(dir(salt.utils.msgpack)) +- self.assertFalse(msgpack_items - msgpack_util_items, 'msgpack functions with no alias in `salt.utils.msgpack`') ++ self.assertFalse( ++ msgpack_items - msgpack_util_items, ++ "msgpack functions with no alias in `salt.utils.msgpack`", ++ ) ++ ++ def test_sanitize_msgpack_kwargs(self): ++ """ ++ Test helper function _sanitize_msgpack_kwargs ++ """ ++ version = salt.utils.msgpack.version ++ ++ kwargs = {"strict_map_key": True, "raw": True, "use_bin_type": True} ++ salt.utils.msgpack.version = (0, 6, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_kwargs(kwargs), ++ {"raw": True, "strict_map_key": True, "use_bin_type": True}, ++ ) ++ ++ kwargs = {"strict_map_key": True, "raw": True, "use_bin_type": True} ++ salt.utils.msgpack.version = (0, 5, 2) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_kwargs(kwargs), ++ {"raw": True, "use_bin_type": True}, ++ ) ++ ++ kwargs = {"strict_map_key": True, "raw": True, "use_bin_type": True} ++ salt.utils.msgpack.version = (0, 4, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_kwargs(kwargs), {"use_bin_type": True} ++ ) ++ ++ kwargs = {"strict_map_key": True, "raw": True, "use_bin_type": True} ++ salt.utils.msgpack.version = (0, 3, 0) ++ self.assertEqual(salt.utils.msgpack._sanitize_msgpack_kwargs(kwargs), {}) ++ salt.utils.msgpack.version = version ++ ++ def test_sanitize_msgpack_unpack_kwargs(self): ++ """ ++ Test helper function _sanitize_msgpack_unpack_kwargs ++ """ ++ version = salt.utils.msgpack.version ++ ++ kwargs = {"strict_map_key": True, "use_bin_type": True, "encoding": "utf-8"} ++ salt.utils.msgpack.version = (1, 0, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_unpack_kwargs(kwargs.copy()), ++ {"raw": True, "strict_map_key": True, "use_bin_type": True}, ++ ) ++ ++ salt.utils.msgpack.version = (0, 6, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_unpack_kwargs(kwargs.copy()), ++ {"strict_map_key": True, "use_bin_type": True, "encoding": "utf-8"}, ++ ) ++ ++ salt.utils.msgpack.version = (0, 5, 2) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_unpack_kwargs(kwargs.copy()), ++ {"use_bin_type": True, "encoding": "utf-8"}, ++ ) ++ ++ salt.utils.msgpack.version = (0, 4, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_unpack_kwargs(kwargs.copy()), ++ {"use_bin_type": True, "encoding": "utf-8"}, ++ ) ++ kwargs = {"strict_map_key": True, "use_bin_type": True} ++ salt.utils.msgpack.version = (0, 3, 0) ++ self.assertEqual( ++ salt.utils.msgpack._sanitize_msgpack_unpack_kwargs(kwargs.copy()), {} ++ ) ++ salt.utils.msgpack.version = version + + def _test_base(self, pack_func, unpack_func): + ''' +@@ -207,7 +278,6 @@ class TestMsgpack(TestCase): + # Sanity check, we are not borking the BytesIO read function + self.assertNotEqual(BytesIO.read, buffer.read) + buffer.read = buffer.getvalue +- + pack_func(data, buffer) + # Sanity Check + self.assertTrue(buffer.getvalue()) +@@ -216,7 +286,11 @@ class TestMsgpack(TestCase): + + # Reverse the packing and the result should be equivalent to the original data + unpacked = unpack_func(buffer) +- self.assertEqual(data, unpacked.decode()) ++ ++ if isinstance(unpacked, bytes): ++ unpacked = unpacked.decode() ++ ++ self.assertEqual(data, unpacked) + + def test_buffered_base_pack(self): + self._test_buffered_base(pack_func=salt.utils.msgpack.pack, unpack_func=msgpack.unpack) +-- +2.28.0 + + diff --git a/salt.changes b/salt.changes index 7e4af5a..aabb69b 100644 --- a/salt.changes +++ b/salt.changes @@ -1,3 +1,35 @@ +------------------------------------------------------------------- +Wed Sep 16 11:52:33 UTC 2020 - Pablo Suárez Hernández + +- Prevent import errors when running test_btrfs unit tests + +- Added: + * prevent-import-errors-when-running-test_btrfs-unit-t.patch + +------------------------------------------------------------------- +Wed Sep 16 10:57:15 UTC 2020 - Pablo Suárez Hernández + +- Remove msgpack < 1.0.0 from base requirements (bsc#1176293) + +- Added: + * remove-msgpack-1.0.0-requirement-in-the-installed-me.patch + +------------------------------------------------------------------- +Tue Sep 15 14:22:12 UTC 2020 - Pablo Suárez Hernández + +- Fix virt.update with CPU defined + +- Added: + * fix-virt.update-with-cpu-defined-263.patch + +------------------------------------------------------------------- +Tue Sep 15 12:15:16 UTC 2020 - Pablo Suárez Hernández + +- Fix virt issues and invalid input errors from 'salt.utils.data' (bsc#1176480) + +- Added: + * fix-the-removed-six.itermitems-and-six.-_type-262.patch + ------------------------------------------------------------------- Tue Sep 8 12:59:11 UTC 2020 - Jochen Breuer diff --git a/salt.spec b/salt.spec index 26fbc75..6435ab8 100644 --- a/salt.spec +++ b/salt.spec @@ -336,6 +336,15 @@ Patch125: do-not-raise-streamclosederror-traceback-but-only-lo.patch Patch126: opensuse-3000.2-virt-backports-236-257.patch # PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/256 Patch127: backport-virt-patches-from-3001-256.patch +# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/262 +Patch128: fix-the-removed-six.itermitems-and-six.-_type-262.patch +# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/263 +Patch129: fix-virt.update-with-cpu-defined-263.patch +# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/261 +# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/57571 +Patch130: remove-msgpack-1.0.0-requirement-in-the-installed-me.patch +# PATCH-FIX_OPENSUSE: https://github.com/openSUSE/salt/commit/bc20f38d0fa492af70321fef7fe2530937dfc86a +Patch131: prevent-import-errors-when-running-test_btrfs-unit-t.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: logrotate @@ -969,6 +978,10 @@ cp %{S:5} ./.travis.yml %patch125 -p1 %patch126 -p1 %patch127 -p1 +%patch128 -p1 +%patch129 -p1 +%patch130 -p1 +%patch131 -p1 %build # Putting /usr/bin at the front of $PATH is needed for RHEL/RES 7. Without this