Hello community, here is the log from the commit of package salt for openSUSE:Factory checked in at 2020-09-18 14:31:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/salt (Old) and /work/SRC/openSUSE:Factory/.salt.new.4249 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "salt" Fri Sep 18 14:31:22 2020 rev:109 rq:834906 version:3000.3 Changes: -------- --- /work/SRC/openSUSE:Factory/salt/salt.changes 2020-09-10 22:48:31.931850736 +0200 +++ /work/SRC/openSUSE:Factory/.salt.new.4249/salt.changes 2020-09-18 14:35:23.875680916 +0200 @@ -1,0 +2,32 @@ +Wed Sep 16 11:52:33 UTC 2020 - Pablo Suárez Hernández <[email protected]> + +- 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 <[email protected]> + +- 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 <[email protected]> + +- 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 <[email protected]> + +- Fix virt issues and invalid input errors from 'salt.utils.data' (bsc#1176480) + +- Added: + * fix-the-removed-six.itermitems-and-six.-_type-262.patch + +------------------------------------------------------------------- New: ---- fix-the-removed-six.itermitems-and-six.-_type-262.patch fix-virt.update-with-cpu-defined-263.patch prevent-import-errors-when-running-test_btrfs-unit-t.patch remove-msgpack-1.0.0-requirement-in-the-installed-me.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ salt.spec ++++++ --- /var/tmp/diff_new_pack.fy6zc5/_old 2020-09-18 14:35:38.619694075 +0200 +++ /var/tmp/diff_new_pack.fy6zc5/_new 2020-09-18 14:35:38.627694082 +0200 @@ -336,6 +336,15 @@ 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 @@ %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 ++++++ _lastrevision ++++++ --- /var/tmp/diff_new_pack.fy6zc5/_old 2020-09-18 14:35:38.691694139 +0200 +++ /var/tmp/diff_new_pack.fy6zc5/_new 2020-09-18 14:35:38.691694139 +0200 @@ -1 +1 @@ -b193a24466b79150ec137a7e4cc144362b588ef0 \ No newline at end of file +8afd80f388d6e97b882f8564a8afa1acab63e014 \ No newline at end of file ++++++ backport-virt-patches-from-3001-256.patch ++++++ --- /var/tmp/diff_new_pack.fy6zc5/_old 2020-09-18 14:35:38.767694207 +0200 +++ /var/tmp/diff_new_pack.fy6zc5/_new 2020-09-18 14:35:38.771694211 +0200 @@ -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 <[email protected]> Date: Mon, 7 Sep 2020 15:00:40 +0200 Subject: [PATCH] Backport virt patches from 3001+ (#256) @@ -417,7 +417,7 @@ 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 @@ 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 @@ {% 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 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ # 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 @@ 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 @@ 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 @@ 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 @@ ) 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 @@ ) return {} else: -@@ -832,17 +1057,17 @@ def repack_dictlist(data, +@@ -832,17 +1058,17 @@ def repack_dictlist(data, return ret @@ -3138,7 +3138,7 @@ 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 @@ 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 @@ 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 @@ # 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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, ++++++ fix-the-removed-six.itermitems-and-six.-_type-262.patch ++++++ ++++ 776 lines (skipped) ++++++ fix-virt.update-with-cpu-defined-263.patch ++++++ >From 37800f008e46a7321bcd4b88b4858d3ea1fabcdf Mon Sep 17 00:00:00 2001 From: Cedric Bosdonnat <[email protected]> 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 ++++++ prevent-import-errors-when-running-test_btrfs-unit-t.patch ++++++ >From 116141f87df4179962dcd643d914260121447712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Su=C3=A1rez=20Hern=C3=A1ndez?= <[email protected]> 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 ++++++ remove-msgpack-1.0.0-requirement-in-the-installed-me.patch ++++++ >From 1b17b0afa2f9567e71062fb7bec20efa609cd471 Mon Sep 17 00:00:00 2001 From: Duncan Mac-Vicar P <[email protected]> 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
