SHA256
1
0
forked from pool/salt

osc copypac from project:systemsmanagement:saltstack:testing package:salt revision:314

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=158
This commit is contained in:
Pablo Suárez Hernández 2019-12-12 10:37:03 +00:00 committed by Git OBS Bridge
parent a8810c88a2
commit 4ead0d0098
4 changed files with 121 additions and 1 deletions

View File

@ -1 +1 @@
f0c179a11cfb8bbbff31619eba7d716bc800704a
119d230d13c22207b56ca0276f65a25692e8f4bf

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Thu Dec 12 10:21:15 UTC 2019 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>
- Add missing bugzilla references:
Properly handle colons in inline dicts with yamlloader (bsc#1095651)
Fix corrupt public key with m2crypto python3 (bsc#1099323)
Add missing dateutils import (bsc#1099945)
Fix UnicodeDecodeError using is_binary check (bsc#1100225)
Prevent payload crash on decoding binary data (bsc#1100697)
Fix file.blockreplace to avoid throwing IndexError (bsc#1101812)
Add API log rotation on SUSE package (bsc#1102218)
Fix wrong recurse behavior on for linux_acl.present (bsc#1106164)
Handle anycast IPv6 addresses on network.routes (bsc#1114474)
Crontab module fix: file attributes option missing (bsc#1114824)
Add metadata to accepted keyword arguments (bsc#1122680)
Bugfix: properly refresh pillars (bsc#1125015)
-------------------------------------------------------------------
Wed Dec 11 14:27:24 UTC 2019 - Mihai Dincă <mihai.dinca@suse.com>
- xfs: do not fail if type is not present (bsc#1153611)
- Added:
* xfs-do-not-fails-if-type-is-not-present.patch
-------------------------------------------------------------------
Tue Dec 10 12:56:45 UTC 2019 - Pablo Suárez Hernández <pablo.suarezhernandez@suse.com>

View File

@ -270,6 +270,8 @@ Patch95: let-salt-ssh-use-platform-python-binary-in-rhel8-191.patch
Patch96: align-virt-full-info-fixes-with-upstream-192.patch
# PATCH-FIX_UPSTREAM: https://github.com/saltstack/salt/pull/55351
Patch97: fix-virt.get_hypervisor-188.patch
# PATCH_FIX_OPENSUSE: https://github.com/openSUSE/salt/pull/193
Patch98: xfs-do-not-fails-if-type-is-not-present.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: logrotate
@ -883,6 +885,7 @@ cp %{S:5} ./.travis.yml
%patch95 -p1
%patch96 -p1
%patch97 -p1
%patch98 -p1
%build
%if 0%{?build_py2}

View File

@ -0,0 +1,92 @@
From 4a922d62a899cacf15a80882b2d1aff7ab66097c Mon Sep 17 00:00:00 2001
From: Alberto Planas <aplanas@gmail.com>
Date: Tue, 11 Jun 2019 17:21:05 +0200
Subject: [PATCH] xfs: do not fails if type is not present
The command `blkid -o export` not always provides a 'TYPE' output
for all the devices. One example is non-formatted partitions, like for
example the BIOS partition.
This patch do not force the presence of this field in the blkid
output.
(cherry picked from commit 88df6963470007aa4fe2adb09f000311f48226a8)
---
salt/modules/xfs.py | 2 +-
tests/unit/modules/test_xfs.py | 50 ++++++++++++++++++++++++++++++++++
2 files changed, 51 insertions(+), 1 deletion(-)
create mode 100644 tests/unit/modules/test_xfs.py
diff --git a/salt/modules/xfs.py b/salt/modules/xfs.py
index 6546603ed6..e133ec83e1 100644
--- a/salt/modules/xfs.py
+++ b/salt/modules/xfs.py
@@ -329,7 +329,7 @@ def _blkid_output(out):
for items in flt(dev_meta.strip().split("\n")):
key, val = items.split("=", 1)
dev[key.lower()] = val
- if dev.pop("type") == "xfs":
+ if dev.pop("type", None) == "xfs":
dev['label'] = dev.get('label')
data[dev.pop("devname")] = dev
diff --git a/tests/unit/modules/test_xfs.py b/tests/unit/modules/test_xfs.py
new file mode 100644
index 0000000000..4b423d69d1
--- /dev/null
+++ b/tests/unit/modules/test_xfs.py
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+# Import Python libs
+from __future__ import absolute_import, print_function, unicode_literals
+import textwrap
+
+# Import Salt Testing Libs
+from tests.support.mixins import LoaderModuleMockMixin
+from tests.support.unit import skipIf, TestCase
+from tests.support.mock import (
+ NO_MOCK,
+ NO_MOCK_REASON,
+ MagicMock,
+ patch)
+
+# Import Salt Libs
+import salt.modules.xfs as xfs
+
+
+@skipIf(NO_MOCK, NO_MOCK_REASON)
+@patch('salt.modules.xfs._get_mounts', MagicMock(return_value={}))
+class XFSTestCase(TestCase, LoaderModuleMockMixin):
+ '''
+ Test cases for salt.modules.xfs
+ '''
+ def setup_loader_modules(self):
+ return {xfs: {}}
+
+ def test__blkid_output(self):
+ '''
+ Test xfs._blkid_output when there is data
+ '''
+ blkid_export = textwrap.dedent('''
+ DEVNAME=/dev/sda1
+ UUID=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+ TYPE=xfs
+ PARTUUID=YYYYYYYY-YY
+
+ DEVNAME=/dev/sdb1
+ PARTUUID=ZZZZZZZZ-ZZZZ-ZZZZ-ZZZZ-ZZZZZZZZZZZZ
+ ''')
+ # We expect to find only data from /dev/sda1, nothig from
+ # /dev/sdb1
+ self.assertEqual(xfs._blkid_output(blkid_export), {
+ '/dev/sda1': {
+ 'label': None,
+ 'partuuid': 'YYYYYYYY-YY',
+ 'uuid': 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX'
+ }
+ })
--
2.23.0