[master/rhel7] driverdisk: Parse all blkid output (#857248)
by Brian C. Lane
blkid output may not include all the expected fields, and according to
the manpage they may not even be in the same order. This replaces the
regex matching with shlex parsing of the line (to retain spaces in
quoted fields).
Resolves: rhbz#857248
Related: rhbz#1036765
---
dracut/driver-updates | 44 +++++++++++++++++++++++++++++++++-----------
1 file changed, 33 insertions(+), 11 deletions(-)
diff --git a/dracut/driver-updates b/dracut/driver-updates
index e7f3e58..ea73981 100755
--- a/dracut/driver-updates
+++ b/dracut/driver-updates
@@ -611,6 +611,35 @@ class DeviceInfo(object):
return "%-10s %-20s %-15s %s" % (self.device or "", self.fs_type or "",
self.label or "", self.uuid or "")
+def parse_blkid(line):
+ """ Parse a line of output from blkid
+
+ :param line: line of output from blkid
+ :param type: string
+ :returns: {} or dict of NAME=VALUE pairs including "device"
+ :rtype: dict
+
+ blkid output cannot be trusted. labels may be missing or in a different
+ order so we parse what we get and return a dict with their values.
+ """
+ import shlex
+
+ device = {"device":None, "label":None, "uuid":None, "fs_type":None}
+ fields = shlex.split(line)
+ if len(fields) < 2 or not fields[0].startswith("/dev/"):
+ return {}
+
+ # device is in [0] and the remainder are NAME=VALUE with possible spaces
+ # Use the sda1 part of device "/dev/sda1:"
+ device['device'] = fields[0][5:-1]
+ for f in fields[1:]:
+ if "=" in f:
+ (key, val) = f.split("=", 1)
+ if key == "TYPE":
+ key = "fs_type"
+ device[key.lower()] = val
+ return device
+
def select_iso():
""" Let user select device and DD ISO on it.
@@ -618,19 +647,12 @@ def select_iso():
or (None, None) if no ISO file is selected
:rtype: (str, str)
"""
-
- dev_prefix = "/dev/"
- blkid_out_regex = re.compile(r'^/dev/(?P<device>[^:]+):\s+' # device
- r'UUID="(?P<uuid>[^"]+)"\s+' # UUID
- r'(UUID_SUB="[^"]+"\s+)?' # UUID_SUB
- r'(LABEL="(?P<label>[^"]+)"\s+)?' # label
- r'TYPE="(?P<fs_type>[^"]+)"') # type
_ret, out = run_cmd(["blkid"])
devices = []
for line in out.splitlines():
- match = blkid_out_regex.match(line)
- if match:
- devices.append(DeviceInfo(**match.groupdict()))
+ dev = parse_blkid(line)
+ if dev:
+ devices.append(DeviceInfo(**dev))
header = " %-10s %-20s %-15s %s" % ("DEVICE", "TYPE", "LABEL", "UUID")
iso_dev = selection_menu(devices, "Driver disk device selection\n" + header,
@@ -651,7 +673,7 @@ def select_iso():
isos += (iso_file for iso_file in files if iso_file.endswith(".iso"))
if not isos:
- print("===No ISO files found on %s!===\n" % iso_dev)
+ print("===No ISO files found on %s!===\n" % iso_dev.device)
umount(mnt)
return select_iso()
else:
--
1.8.5.3
10 years, 3 months
[blivet:rhel7 0/6] A bunch of small test suite patches
by Anne Mulhern
Most of them are direct cherry-picks from master branch, and they all just
affect the tests, not our code.
The only one that isn't a total cherry-pick is "Update tests...".
mulhern (6):
Fix some size_test.py ERRORs (#1065443)
Fix failing udev_test (#1065431)
Skip a test if device isn't available (#1065431)
Update tests/storagetestcase.py (#1065437)
Fix some problems with action_test.py (#1065437)
Disable tests in action_test.py (#1065437)
tests/action_test.py | 89 ++++++++++++++++--------------------------------
tests/size_test.py | 14 ++++----
tests/storagetestcase.py | 17 ++-------
tests/udev_test.py | 74 ++++++++++++++++++++++++----------------
4 files changed, 85 insertions(+), 109 deletions(-)
--
1.8.3.1
10 years, 3 months
[anaconda:rhel7/master] Since supported() is a class method, change syntax for call (#1065422)
by Anne Mulhern
Related: rhbz#1065442
Blivet version bumped as appropriate for this change.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index 61506fc..4562f3c 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -214,7 +214,7 @@ def populate_mountpoint_store(store, used_mountpoints):
paths += ["swap"]
for fmt in ["appleboot", "biosboot", "prepboot"]:
- if getFormat(fmt).supported:
+ if getFormat(fmt).supported():
paths += [fmt]
for path in paths:
@@ -762,7 +762,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
# btrfs is always handled by on_device_type_changed
supported_fs = (obj.type != "btrfs" and
- obj.supported and obj.formattable and
+ obj.supported() and obj.formattable and
(isinstance(obj, FS) or
obj.type in ["biosboot", "prepboot", "swap"]))
if supported_fs:
@@ -2834,7 +2834,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
if new_type == DEVICE_TYPE_BTRFS:
# add btrfs to the fstype combo and lock it in
test_fmt = getFormat("btrfs")
- include_btrfs = test_fmt.supported and test_fmt.formattable
+ include_btrfs = test_fmt.supported() and test_fmt.formattable
fs_type_sensitive = False
with ui_storage_logger():
factory = devicefactory.get_device_factory(self.__storage,
--
1.8.3.1
10 years, 3 months
[PATCH rhel7/master] Error on "bootloader --location=partition" when using grub2 (#969095).
by Chris Lumens
---
pyanaconda/kickstart.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index c8ac223..07decce 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -58,6 +58,7 @@ from pyanaconda.desktop import Desktop
from pyanaconda.i18n import _
from .ui.common import collect
from .addons import AddonSection, AddonData, AddonRegistry, collect_addon_paths
+from pyanaconda.bootloader import GRUB2, get_bootloader
from pykickstart.base import KickstartCommand
from pykickstart.constants import *
@@ -266,6 +267,14 @@ class Bootloader(commands.bootloader.F19_Bootloader):
commands.bootloader.F19_Bootloader.__init__(self, *args, **kwargs)
self.location = "mbr"
+ def parse(self, args):
+ commands.bootloader.F19_Bootloader.parse(self, args)
+ if self.location == "partition" and isinstance(get_bootloader(), GRUB2):
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg="GRUB2 does not support installation to a partition."))
+
+ return self
+
def execute(self, storage, ksdata, instClass):
if flags.imageInstall and blivet.arch.isS390():
self.location = "none"
--
1.8.3.1
10 years, 3 months
[PATCH] Fix the handling of kernel parameters with no = (#1065704)
by David Shea
---
dracut/parse-kickstart | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dracut/parse-kickstart b/dracut/parse-kickstart
index b7a02d2..8bcb47b 100755
--- a/dracut/parse-kickstart
+++ b/dracut/parse-kickstart
@@ -47,7 +47,7 @@ def read_cmdline(f):
# pylint: disable-msg=W0621
for line in lines:
for arg in line.split():
- k,v = arg.split("=", 1)
+ k,_e,v = arg.partition("=")
args[k] = v
return args
--
1.8.5.3
10 years, 3 months
[master/rhel7-branch] Disallow /boot on RAID on s390x. (#1027670)
by Samantha N. Bueno
ZIPL can not handle this configuration, so until it does, disallow users
from creating /boot on RAID.
Resolves: rhbz#1027670
---
pyanaconda/bootloader.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index eea75ab..eec8022 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2037,8 +2037,7 @@ class ZIPL(BootLoader):
packages = ["s390utils-base"]
# stage2 device requirements
- stage2_device_types = ["partition", "mdarray", "lvmlv"]
- stage2_device_raid_levels = [mdraid.RAID1]
+ stage2_device_types = ["partition", "lvmlv"]
@property
def stage2_format_types(self):
--
1.8.3.1
10 years, 3 months
[PATCH 0/3] Fix the handling of format strings and glade
by David Shea
I happened to click on Bulgarian on the welcome screen, and the installer
crashed because of a format string problem. This ensures that it never happens
again.
Wiki change (and a fix to the Bulgarian translation) forthcoming
David Shea (3):
Use a single script to run the glade tests.
Added a check for translatable format strings in glade.
Move translatable format strings into python.
pyanaconda/ui/gui/hubs/progress.glade | 4 +-
pyanaconda/ui/gui/hubs/progress.py | 7 +-
pyanaconda/ui/gui/spokes/welcome.glade | 2 +-
pyanaconda/ui/gui/spokes/welcome.py | 8 +--
tests/Makefile.am | 13 ++--
tests/glade/accelerators/run_check_accelerators.sh | 23 -------
tests/glade/format_string/check_format_string.py | 78 ++++++++++++++++++++++
tests/glade/markup/run_check_markup.sh | 21 ------
tests/glade/pw_visibility/check_pw_visibility.py | 17 +++--
.../glade/pw_visibility/run_check_pw_visibility.sh | 6 --
tests/glade/run_glade_tests.sh | 30 +++++++++
tests/glade/validity/check_glade_validity.py | 15 ++++-
tests/glade/validity/run_check_glade_validity.sh | 10 ---
13 files changed, 149 insertions(+), 85 deletions(-)
delete mode 100755 tests/glade/accelerators/run_check_accelerators.sh
create mode 100755 tests/glade/format_string/check_format_string.py
delete mode 100755 tests/glade/markup/run_check_markup.sh
delete mode 100755 tests/glade/pw_visibility/run_check_pw_visibility.sh
create mode 100755 tests/glade/run_glade_tests.sh
delete mode 100755 tests/glade/validity/run_check_glade_validity.sh
--
1.8.5.3
10 years, 3 months
[lorax/rhel7-branch 1/2] Remove unneeded packages from runtime-install (#1065557)
by Brian C. Lane
These aren't shipped or needed by rhel7 so remove them, cleaning up the
output from lorax a bit.
Resolves: rhbz#1065557
---
share/runtime-install.tmpl | 24 +++++-------------------
1 file changed, 5 insertions(+), 19 deletions(-)
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index 479ce4c..49e5882 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -7,17 +7,11 @@ installpkg anaconda anaconda-widgets
installpkg tmux
installpkg firstboot
installpkg iscsi-initiator-utils
-## speed up compression on multicore systems
-installpkg pigz
-
-## firstaidkit (rescue mode) packages
-installpkg firstaidkit-plugin-{passwd,key-recovery,mdadm-conf}
## kernel and firmware
installpkg kernel
%if basearch != "s390x":
installpkg *-firmware
- installpkg b43-openfwwf
%endif
## arch-specific packages (bootloaders etc.)
@@ -48,12 +42,6 @@ installpkg plymouth
## extra dracut modules
installpkg anaconda-dracut dracut-network dracut-config-generic
-## fedup-dracut handles upgrades
-installpkg fedup-dracut fedup-dracut-plymouth
-## install other fedup scripts, if there are any. It's OK if there aren't.
-log "Looking for extra fedup-dracut packages..."
--installpkg *-fedup-dracut
-
## redhat-upgrade-dracut handles upgrades on RHEL
installpkg redhat-upgrade-dracut redhat-upgrade-dracut-plymouth
log "Looking for extra redhat-upgrade-dracut packages..."
@@ -87,7 +75,7 @@ installpkg gnome-keyring
installpkg python-imaging
## filesystem tools
-installpkg btrfs-progs jfsutils xfsprogs reiserfs-utils gfs2-utils ntfs-3g ntfsprogs
+installpkg btrfs-progs xfsprogs gfs2-utils
installpkg python-volume_key volume_key
installpkg system-storage-manager
installpkg device-mapper-persistent-data
@@ -107,7 +95,7 @@ installpkg net-tools
installpkg pciutils usbutils
installpkg mt-st smartmontools
%if basearch != "s390x":
-installpkg hdparm pcmciautils
+installpkg hdparm
%endif
installpkg libmlx4
@@ -132,18 +120,16 @@ installpkg xorg-x11-fonts-misc
installpkg gnome-themes-standard gnome-icon-theme-legacy
## branding & logos
-installpkg fedora-gnome-theme fedora-icon-theme
+installpkg fedora-gnome-theme
## debugging/bug reporting tools
installpkg gdb-gdbserver
-installpkg python-epdb
installpkg libreport-plugin-bugzilla libreport-plugin-reportuploader
-installpkg fpaste
## extra tools not required by anaconda
installpkg vim-minimal strace lsof dump xz less eject
-installpkg wget rsync rsh bind-utils ftp mtr vconfig
-installpkg icfg spice-vdagent
+installpkg wget rsync rsh bind-utils ftp mtr
+installpkg spice-vdagent
installpkg gdisk
## yum plugins
--
1.8.5.3
10 years, 3 months
[PATCH 1/2] Move environmentAddons into packaging
by Brian C. Lane
The environment addon refresh really only needs to be executed when new
metadata has been fetched so move it into packaging and call it after
metadata download. It was also running very slow from the other thread,
moving it speeds it up considerably.
This also removes the need to call it from software.py when the source
has changed, since it will already be updated when the spoke is entered.
---
pyanaconda/packaging/__init__.py | 33 ++++++++++++++++++++++++++++-
pyanaconda/packaging/dnfpayload.py | 1 +
pyanaconda/packaging/yumpayload.py | 3 +++
pyanaconda/ui/gui/spokes/software.py | 41 +++++++++---------------------------
4 files changed, 46 insertions(+), 32 deletions(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index bcf0ac5..b7a056a 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -644,6 +644,13 @@ class PackagePayload(Payload):
super(PackagePayload, self).__init__(data)
self.install_device = None
+ # Used to determine which add-ons to display for each environment.
+ # The dictionary keys are environment IDs. The dictionary values are two-tuples
+ # consisting of lists of add-on group IDs. The first list is the add-ons specific
+ # to the environment, and the second list is the other add-ons possible for the
+ # environment.
+ self._environmentAddons = {}
+
@property
def kernelPackages(self):
kernels = ["kernel"]
@@ -896,6 +903,31 @@ class PackagePayload(Payload):
def environmentGroups(self, environmentid):
raise NotImplementedError()
+ @property
+ def environmentAddons(self):
+ return self._environmentAddons
+
+ def _isGroupVisible(self, grp):
+ raise NotImplementedError()
+
+ def _groupHasInstallableMembers(self, grp):
+ raise NotImplementedError()
+
+ def _refreshEnvironmentAddons(self):
+ log.info("Refreshing environmentAddons")
+ self._environmentAddons = {}
+
+ for environment in self.environments:
+ self._environmentAddons[environment] = ([], [])
+
+ # Determine which groups are specific to this environment and which other groups
+ # are available in this environment.
+ for grp in self.groups:
+ if self.environmentHasOption(environment, grp):
+ self._environmentAddons[environment][0].append(grp)
+ elif self._isGroupVisible(grp) and self._groupHasInstallableMembers(grp):
+ self._environmentAddons[environment][1].append(grp)
+
###
### METHODS FOR WORKING WITH GROUPS
###
@@ -906,7 +938,6 @@ class PackagePayload(Payload):
def groupDescription(self, groupid):
raise NotImplementedError()
-
def payloadInitialize(storage, ksdata, payload):
from pyanaconda.threads import threadMgr
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py
index ecfba1d..347cf01 100644
--- a/pyanaconda/packaging/dnfpayload.py
+++ b/pyanaconda/packaging/dnfpayload.py
@@ -338,6 +338,7 @@ class DNFPayload(packaging.PackagePayload):
map(self._sync_metadata, self._base.repos.iter_enabled())
self._base.fill_sack(load_system_repo=False)
self._base.read_comps()
+ self._refreshEnvironmentAddons()
def install(self):
progressQ.send_message(_('Starting package installation process'))
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 43ce236..c4b00d3 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -609,6 +609,9 @@ reposdir=%s
repo_id, e)
self.disableRepo(repo_id)
+ # Make sure environmentAddon information is current
+ self._refreshEnvironmentAddons()
+
log.info("metadata retrieval complete")
@property
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 424a98a..1b26b28 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -33,6 +33,9 @@ from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog
from pyanaconda.ui.gui.utils import enlightbox, gtk_action_wait, escape_markup
from pyanaconda.ui.gui.categories.software import SoftwareCategory
+import logging
+log = logging.getLogger("anaconda")
+
import sys
__all__ = ["SoftwareSelectionSpoke"]
@@ -68,13 +71,6 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._environmentListBox = self.builder.get_object("environmentListBox")
self._addonListBox = self.builder.get_object("addonListBox")
- # Used to determine which add-ons to display for each environment.
- # The dictionary keys are environment IDs. The dictionary values are two-tuples
- # consisting of lists of add-on group IDs. The first list is the add-ons specific
- # to the environment, and the second list is the other add-ons possible for the
- # environment.
- self._environmentAddons = {}
-
# Used to store how the user has interacted with add-ons for the default add-on
# selection logic. The dictionary keys are group IDs, and the values are selection
# state constants. See refreshAddons for how the values are used.
@@ -249,19 +245,6 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._apply()
def _parseEnvironments(self):
- self._environmentAddons = {}
-
- for environment in self.payload.environments:
- self._environmentAddons[environment] = ([], [])
-
- # Determine which groups are specific to this environment and which other groups
- # are available in this environment.
- for grp in self.payload.groups:
- if self.payload.environmentHasOption(environment, grp):
- self._environmentAddons[environment][0].append(grp)
- elif self.payload._isGroupVisible(grp) and self.payload._groupHasInstallableMembers(grp):
- self._environmentAddons[environment][1].append(grp)
-
# Set all of the add-on selection states to the default
self._addonStates = {}
for grp in self.payload.groups:
@@ -347,11 +330,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._add_row(self._addonListBox, name, desc, check)
def refreshAddons(self):
- # The source was changed, make sure the list is current
- if not self.txid_valid:
- self._parseEnvironments()
-
- if self.environment and (self.environment in self._environmentAddons):
+ if self.environment and (self.environment in self.payload.environmentAddons):
self._clear_listbox(self._addonListBox)
# We have two lists: One of addons specific to this environment,
@@ -364,10 +343,10 @@ class SoftwareSelectionSpoke(NormalSpoke):
# state will be used. Otherwise, the add-on will be selected if it is a default
# for this environment.
- addSep = len(self._environmentAddons[self.environment][0]) > 0 and \
- len(self._environmentAddons[self.environment][1]) > 0
+ addSep = len(self.payload.environmentAddons[self.environment][0]) > 0 and \
+ len(self.payload.environmentAddons[self.environment][1]) > 0
- for grp in self._environmentAddons[self.environment][0]:
+ for grp in self.payload.environmentAddons[self.environment][0]:
self._addAddon(grp)
# This marks a separator in the view - only add it if there's both environment
@@ -375,7 +354,7 @@ class SoftwareSelectionSpoke(NormalSpoke):
if addSep:
self._addonListBox.insert(Gtk.Separator(), -1)
- for grp in self._environmentAddons[self.environment][1]:
+ for grp in self.payload.environmentAddons[self.environment][1]:
self._addAddon(grp)
self._selectFlag = True
@@ -386,9 +365,9 @@ class SoftwareSelectionSpoke(NormalSpoke):
self.clear_info()
def _allAddons(self):
- return self._environmentAddons[self.environment][0] + \
+ return self.payload.environmentAddons[self.environment][0] + \
[""] + \
- self._environmentAddons[self.environment][1]
+ self.payload.environmentAddons[self.environment][1]
def _get_selected_addons(self):
retval = []
--
1.8.5.3
10 years, 3 months