[rhel7-branch 1/1] Fix a covscan warning about fetch-driver-net
(#1269915)
by dashea
From: "Brian C. Lane" <bcl(a)redhat.com>
warning: Declare and assign separately to avoid masking return values.
[SC2155]
Related: rhbz#1269915
---
dracut/fetch-driver-net.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dracut/fetch-driver-net.sh b/dracut/fetch-driver-net.sh
index 38f75eb..d67a595 100755
--- a/dracut/fetch-driver-net.sh
+++ b/dracut/fetch-driver-net.sh
@@ -35,14 +35,14 @@ while read dd; do
info "Fetching RPM driverdisks from $dd directory"
# Following variables are set by nfs_to_var:
- local nfs="" server="" path="" options=""
+ local nfs="" server="" path="" options="" mntdir=""
nfs_to_var "$dd"
# Obtain mount directory and mount it
# (new unique name is generated if not already mounted)
mntdir=$(nfs_already_mounted "$server" "$path")
if [ -z "$mntdir" ]; then
- local mntdir="$(mkuniqdir /run nfs_mnt)"
+ mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs "$nfs:$server:$path$(options:+:$options)" "$mntdir"
fi
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/036721fefb3ab3b40b4a946a70...
7 years, 11 months
[3.0-devel 1/1] Quickfix of merge bugs
by dashea
From: Jan Pokorny <japokorn(a)redhat.com>
- fixed bugs from manual merging
- updated test
- bugs originated in: e5e2483441beb59749a9e3c4fa320deb90ad45fd,
2daaaab4edcc32f740a139fca87eb176eaa5a981
---
blivet/blivet.py | 1 -
blivet/devicetree.py | 2 +-
blivet/osinstall.py | 8 +++++++-
tests/blivet_test.py | 8 ++++----
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/blivet/blivet.py b/blivet/blivet.py
index 8faea58..978014a 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -69,7 +69,6 @@ def __init__(self, ksdata=None):
self.clear_part_choice = None
self.encrypted_autopart = False
self.encryption_passphrase = None
- self.autopart_type = AUTOPART_TYPE_LVM
self.encryption_cipher = None
self.escrow_certificates = {}
self.autopart_escrow_cert = None
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index dd6fd92..4f603ea 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -904,7 +904,7 @@ def __init__(self, passphrase=None, luks_dict=None, ignored_disks=None, exclusiv
self.luks_dict_passed = luks_dict
DeviceTreeBase.__init__(self, ignored_disks=ignored_disks, exclusive_disks=exclusive_disks)
- PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=luks_dict_passed, disk_images=disk_images)
+ PopulatorMixin.__init__(self, passphrase=passphrase, luks_dict=self.luks_dict_passed, disk_images=disk_images)
EventHandlerMixin.__init__(self)
# pylint: disable=arguments-differ
diff --git a/blivet/osinstall.py b/blivet/osinstall.py
index e49b7a4..f8936c8 100644
--- a/blivet/osinstall.py
+++ b/blivet/osinstall.py
@@ -1622,8 +1622,14 @@ def _update_custom_storage_ksdata(self):
MDRaidArrayDevice: ("RaidData", "raid"),
BTRFSDevice: ("BTRFSData", "btrfs")}
+ # list comprehension that builds device ancestors should not get None as a member
+ # when searching for bootloader devices
+ bootloader_devices = []
+ if self.bootloader_device is not None:
+ bootloader_devices.append(self.bootloader_device)
+
# make a list of ancestors of all used devices
- devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps
+ devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps + bootloader_devices
for a in d.ancestors))
# devices which share information with their distinct raw device
diff --git a/tests/blivet_test.py b/tests/blivet_test.py
index 597b42b..3cf57db 100644
--- a/tests/blivet_test.py
+++ b/tests/blivet_test.py
@@ -2,7 +2,7 @@
from unittest.mock import PropertyMock
from unittest.mock import patch
from pykickstart.version import returnClassForVersion
-from blivet import Blivet
+from blivet.osinstall import InstallerStorage
from blivet.devices import PartitionDevice
from blivet import formats
from blivet.size import Size
@@ -18,14 +18,14 @@ def test_bootloader_in_kickstart(self):
in the kickstart data
'''
- with patch('blivet.blivet.Blivet.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
- with patch('blivet.blivet.Blivet.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
+ with patch('blivet.osinstall.InstallerStorage.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
+ with patch('blivet.osinstall.InstallerStorage.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
# set up prepboot partition
bootloader_device_obj = PartitionDevice("test_partition_device")
bootloader_device_obj.size = Size('5 MiB')
bootloader_device_obj.format = formats.get_format("prepboot")
- blivet_obj = Blivet()
+ blivet_obj = InstallerStorage()
# mountpoints must exist for update_ksdata to run
mock_bootloader_device.return_value = bootloader_device_obj
--
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/1397b399b4c5c5fb290ae48745a9...
7 years, 11 months
Re: [rhinstaller/blivet/pulls/433 3.0-devel] Quickfix of merge bugs
by dashea
> @@ -18,21 +18,22 @@ def test_bootloader_in_kickstart(self):
> in the kickstart data
> '''
>
> - with patch('blivet.blivet.Blivet.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
> - with patch('blivet.blivet.Blivet.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
> + with patch('blivet.osinstall.InstallerStorage.bootloader_device', new_callable=PropertyMock) as mock_bootloader_device:
> + with patch('blivet.osinstall.InstallerStorage.mountpoints', new_callable=PropertyMock) as mock_mountpoints:
> # set up prepboot partition
> bootloader_device_obj = PartitionDevice("test_partition_device")
> bootloader_device_obj.size = Size('5 MiB')
> bootloader_device_obj.format = formats.get_format("prepboot")
>
> - blivet_obj = Blivet()
> + blivet_obj = InstallerStorage()
>
> # mountpoints must exist for update_ksdata to run
> mock_bootloader_device.return_value = bootloader_device_obj
> mock_mountpoints.values.return_value = []
>
> # initialize ksdata
> test_ksdata = returnClassForVersion()()
> +
Same here.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/433#discussion_r66049099
7 years, 11 months
Re: [rhinstaller/blivet/pulls/433 3.0-devel] Quickfix of merge bugs
by dashea
> @@ -1622,15 +1622,22 @@ def _update_custom_storage_ksdata(self):
> MDRaidArrayDevice: ("RaidData", "raid"),
> BTRFSDevice: ("BTRFSData", "btrfs")}
>
> + # list comprehension that builds device ancestors should not get None as a member
> + # when searching for bootloader devices
> + bootloader_devices = []
> + if self.bootloader_device is not None:
> + bootloader_devices.append(self.bootloader_device)
> +
> # make a list of ancestors of all used devices
> - devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps
> + devices = list(set(a for d in list(self.mountpoints.values()) + self.swaps + bootloader_devices
> for a in d.ancestors))
>
> # devices which share information with their distinct raw device
> complementary_devices = [d for d in devices if d.raw_device is not d]
>
> devices.sort(key=lambda d: len(d.ancestors))
> for device in devices:
> +
Extra blank line added.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/433#discussion_r66049085
7 years, 11 months