File fixed-bug-lvm-has-no-parttion-type.-the-scipt-later-.patch of Package salt.20998

From 17ad05e3cbb3718ca12cef20600be81aa5d42d33 Mon Sep 17 00:00:00 2001
From: tyl0re <andreas@vogler.name>
Date: Wed, 17 Jul 2019 10:13:09 +0200
Subject: [PATCH] Fixed Bug LVM has no Parttion Type. the Scipt Later
 it is checked if fs_type: cmd = ('parted', '-m', '-s', '--', device,
 'mkpart', part_type, fs_type, start, end) else: cmd = ('parted', '-m', '-s',
 '--', device, 'mkpart', part_type, start, end) But never reached. The Check
 was in earlier Versions with parted.py 443 if fs_type and fs_type not in
 set(['ext2', 'fat32', 'fat16', 'linux-swap', 'reiserfs', 444 'hfs', 'hfs+',
 'hfsx', 'NTFS', 'ufs', 'xfs', 'zfs']):

So the check on not defined fs_type is missing
---
 salt/modules/parted_partition.py | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/salt/modules/parted_partition.py b/salt/modules/parted_partition.py
index 015d4cbc29..bb34cd58b4 100644
--- a/salt/modules/parted_partition.py
+++ b/salt/modules/parted_partition.py
@@ -552,10 +552,23 @@ def mkpartfs(device, part_type, fs_type=None, start=None, end=None):
 
     .. code-block:: bash
 
-        salt '*' partition.mkpartfs /dev/sda primary fs_type=fat32 start=0 end=639
-        salt '*' partition.mkpartfs /dev/sda primary start=0 end=639
+        salt '*' partition.mkpartfs /dev/sda logical ext2 440 670
     """
-    out = mkpart(device, part_type, fs_type, start, end)
+    _validate_device(device)
+
+    if part_type not in {"primary", "logical", "extended"}:
+        raise CommandExecutionError("Invalid part_type passed to partition.mkpartfs")
+
+    if fs_type and not _is_fstype(fs_type):
+        raise CommandExecutionError("Invalid fs_type passed to partition.mkpartfs")
+
+    _validate_partition_boundary(start)
+    _validate_partition_boundary(end)
+
+    cmd = "parted -m -s -- {} mkpart {} {} {} {}".format(
+        device, part_type, fs_type, start, end
+    )
+    out = __salt__["cmd.run"](cmd).splitlines()
     return out
 
 
-- 
2.29.2


openSUSE Build Service is sponsored by