[blivet][rhel7-branch] work around older python-six
by David Lehman
This is only going to be carried on rhel7-branch due to old version
of python-six in rhel7. six has MIT license, so as far as I know it
is acceptable to crib the code for add_metaclass. If I am wrong,
please let me know.
9 years, 9 months
[blivet][master/rhel7-branch] Prefer ID_SERIAL over ID_SERIAL_SHORT (#1138254)
by Vratislav Podzimek
While there are devices that export multiple block devices with the same
ID_SERIAL_SHORT (e.g. card readers) they use different ID_SERIAL values for
those block devices. Using ID_SERIAL_SHORT instead of ID_SERIAL results in all
the card reader's block devices being considered "obvious multipath devices"
where multipathd lost the race condition game and didn't assemble them
correctly. Which is terribly wrong.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
blivet/devices.py | 3 ++-
blivet/udev.py | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index 016f61a..8340b8f 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -1192,7 +1192,8 @@ class DiskDevice(StorageDevice):
:type sysfsPath: str
:keyword removable: whether or not this is a removable device
:type removable: bool
- :keyword serial: the ID_SERIAL_SHORT for this device
+ :keyword serial: the ID_SERIAL_RAW, ID_SERIAL or ID_SERIAL_SHORT for
+ this device (which one is available)
:type serial: str
:keyword vendor: the manufacturer of this Device
:type vendor: str
diff --git a/blivet/udev.py b/blivet/udev.py
index 107d12e..5755d0c 100644
--- a/blivet/udev.py
+++ b/blivet/udev.py
@@ -262,7 +262,7 @@ def device_is_loop(info):
def device_get_serial(udev_info):
""" Get the serial number/UUID from the device as reported by udev. """
- return udev_info.get("ID_SERIAL_RAW", udev_info.get("ID_SERIAL_SHORT", udev_info.get("ID_SERIAL")))
+ return udev_info.get("ID_SERIAL_RAW", udev_info.get("ID_SERIAL", udev_info.get("ID_SERIAL_SHORT")))
def device_get_wwid(udev_info):
""" The WWID of a device is typically just its serial number, but with
--
1.9.3
9 years, 9 months
[master/f21-branch][PATCH] Do not try to disable no firstboot services (#1139621)
by Vratislav Podzimek
If there are no first boot services installed, just return early from the
ksdata.firstboot.execute instead of trying to run 'systemctl disable' on those
non-existing services as that may lead to issues.
This is what we do on the rhel7-branch.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/kickstart.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index cb86c9f..8891d0b 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -661,6 +661,13 @@ class Firstboot(commands.firstboot.FC3_Firstboot):
def execute(self, *args):
action = "enable"
+ services = ["initial-setup-graphical.service",
+ "initial-setup-text.service"]
+
+ if not any(os.path.exists(iutil.getSysroot() + "/lib/systemd/system/" + path)
+ for path in services):
+ # none of the first boot utilities installed, nothing to do here
+ return
if self.firstboot == FIRSTBOOT_SKIP:
action = "disable"
@@ -668,8 +675,7 @@ class Firstboot(commands.firstboot.FC3_Firstboot):
f = open(iutil.getSysroot() + "/etc/reconfigSys", "w+")
f.close()
- iutil.execInSysroot("systemctl", [action, "initial-setup-graphical.service",
- "initial-setup-text.service"])
+ iutil.execInSysroot("systemctl", [action] + services)
class Group(commands.group.F12_Group):
def execute(self, storage, ksdata, instClass, users):
--
1.9.3
9 years, 9 months
[pykickstart][rhel7-branch/master][v2][PATCH 0/2] Validate network interface name when parsing the kickstart
by Martin Kolman
Changes from v1:
* refactored the validation function out of the parse method
* the function returns an error message if it finds an invalid interface name,
but None if it does not find an error
- like this there is just a single raise statement instead of 4
* error messages read as sentences
* hopefully more readable message for the invalid vlan.<vlan id> interface name
* out of range error message reports the valid range
* tests correctly inherit from F20 tests
Martin Kolman (2):
Validate network interface name when parsing the kickstart (#1081982)
Add tests for --interfacename validation
pykickstart/commands/network.py | 55 +++++++++++++++++++++++++++++++++++++++++
tests/commands/network.py | 28 +++++++++++++++++++++
2 files changed, 83 insertions(+)
--
1.9.3
9 years, 9 months
[master/f21] Revert productName repo name change (#1128474)
by Brian C. Lane
The products want the ability to make Product specific netinst isos.
Personally, I think this is the wrong approach, but in order to allow them the
flexibility I'll revert my .buildstamp Product patch.
This means that when making a compose the composer has to be sure they include
a package installing a repo to /etc/yum.repos.d/ that has an id matching the
lower-case version of the product name (eg. fedora-server or
fedora-workstation). Without this the closest mirror option will not work
because anaconda doesn't know the name of the repo to use.
---
pyanaconda/packaging/__init__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index b657a27..18d6297 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -639,7 +639,7 @@ class ArchivePayload(ImagePayload):
class PackagePayload(Payload):
""" A PackagePayload installs a set of packages onto the target system. """
- DEFAULT_REPOS = [productName.split('-')[0].lower(), "rawhide"]
+ DEFAULT_REPOS = [productName.lower(), "rawhide"]
def __init__(self, data):
if self.__class__ is PackagePayload:
--
1.9.3
9 years, 9 months
[rhel7-branch][PATCH] Put spokes' windows into our windows group
by Vratislav Podzimek
And use the window group to get the top-level window when asked for a lightbox.
This way we can use the global (singleton, if you prefer) window group to get
the current window to show lightbox over.
Related: rhbz#1073679
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/ui/gui/__init__.py | 10 +++++-----
pyanaconda/ui/gui/hubs/__init__.py | 5 ++++-
2 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/ui/gui/__init__.py b/pyanaconda/ui/gui/__init__.py
index 4df9426..c80833b 100644
--- a/pyanaconda/ui/gui/__init__.py
+++ b/pyanaconda/ui/gui/__init__.py
@@ -339,11 +339,11 @@ class GraphicalUserInterface(UserInterface):
from gi.repository import AnacondaWidgets
- # if there are no actions (not populated yet), we can do nothing
- if len(self._actions) > 0 and self._currentAction:
- lightbox = AnacondaWidgets.lb_show_over(self._currentAction.window)
- ANACONDA_WINDOW_GROUP.add_window(lightbox)
- window.main_window.set_transient_for(lightbox)
+ # show lightbox over the current top-level window
+ top_window = ANACONDA_WINDOW_GROUP.list_windows()[-1]
+ lightbox = AnacondaWidgets.lb_show_over(top_window)
+ ANACONDA_WINDOW_GROUP.add_window(lightbox)
+ window.main_window.set_transient_for(lightbox)
def _instantiateAction(self, actionClass):
from spokes import StandaloneSpoke
diff --git a/pyanaconda/ui/gui/hubs/__init__.py b/pyanaconda/ui/gui/hubs/__init__.py
index 3bec451..ec47707 100644
--- a/pyanaconda/ui/gui/hubs/__init__.py
+++ b/pyanaconda/ui/gui/hubs/__init__.py
@@ -30,7 +30,7 @@ from pyanaconda.i18n import _
from pyanaconda.product import distributionText
from pyanaconda.ui import common
-from pyanaconda.ui.gui import GUIObject
+from pyanaconda.ui.gui import GUIObject, ANACONDA_WINDOW_GROUP
from pyanaconda.ui.gui.categories import collect_categories
from pyanaconda.ui.gui.spokes import StandaloneSpoke, collect_spokes
from pyanaconda.ui.gui.utils import gtk_call_once
@@ -101,6 +101,9 @@ class Hub(GUIObject, common.Hub):
def _runSpoke(self, action):
from gi.repository import Gtk
+ # add the spoke's window to our window group
+ ANACONDA_WINDOW_GROUP.add_window(action.window)
+
# This duplicates code in widgets/src/BaseWindow.c, but we want to make sure
# maximize gets called every time a spoke is displayed to prevent the 25%
# UI from showing up.
--
1.9.3
9 years, 9 months
[PATCH] A couple updates to installclasses.
by Chris Lumens
* hidden and showHidden should be booleans, not ints in disguise.
* Get rid of default and id. These are unused.
* Stop marking names for translation and remove mnemonics. These haven't been
used since the days of workstation/server/custom selection in the UI. Does
anyone else even still remember this?
---
po/POTFILES.in | 4 ----
pyanaconda/installclass.py | 15 ++++++---------
pyanaconda/installclasses/fedora.py | 7 ++-----
pyanaconda/installclasses/rhel.py | 7 ++-----
4 files changed, 10 insertions(+), 23 deletions(-)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b3cc906..5a1302e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -23,10 +23,6 @@ pyanaconda/text.py
pyanaconda/users.py
pyanaconda/vnc.py
-# Install class definitions
-pyanaconda/installclasses/fedora.py
-pyanaconda/installclasses/rhel.py
-
# Packaging module source files
pyanaconda/packaging/__init__.py
pyanaconda/packaging/livepayload.py
diff --git a/pyanaconda/installclass.py b/pyanaconda/installclass.py
index 3a52f65..cba3c6a 100644
--- a/pyanaconda/installclass.py
+++ b/pyanaconda/installclass.py
@@ -37,7 +37,7 @@ from pyanaconda.kickstart import getAvailableDiskSpace
class BaseInstallClass(object):
# default to not being hidden
- hidden = 0
+ hidden = False
name = "base"
bootloaderTimeoutDefault = None
bootloaderExtraArgs = []
@@ -58,9 +58,6 @@ class BaseInstallClass(object):
# Blivet uses by default.
defaultFS = None
- # don't select this class by default
- default = 0
-
@property
def l10n_domain(self):
if self._l10n_domain is None:
@@ -122,8 +119,8 @@ class BaseInstallClass(object):
allClasses = []
allClasses_hidden = []
-# returns ( className, classObject, classLogo ) tuples
-def availableClasses(showHidden=0):
+# returns ( className, classObject ) tuples
+def availableClasses(showHidden=False):
global allClasses
global allClasses_hidden
@@ -198,7 +195,7 @@ def availableClasses(showHidden=0):
# If it's got these two methods, it's an InstallClass.
if hasattr(obj, "setDefaultPartitioning") and hasattr(obj, "setPackageSelection"):
sortOrder = getattr(obj, "sortPriority", 0)
- if obj.hidden == 0 or showHidden == 1:
+ if not obj.hidden or showHidden:
lst.append(((obj.name, obj), sortOrder))
except (ImportError, AttributeError):
log.warning ("module import of %s failed: %s", mainName, sys.exc_type)
@@ -217,8 +214,8 @@ def availableClasses(showHidden=0):
def getBaseInstallClass():
# figure out what installclass we should base on.
- allavail = availableClasses(showHidden = 1)
- avail = availableClasses(showHidden = 0)
+ allavail = availableClasses(showHidden=True)
+ avail = availableClasses(showHidden=False)
if len(avail) == 1:
(cname, cobject) = avail[0]
diff --git a/pyanaconda/installclasses/fedora.py b/pyanaconda/installclasses/fedora.py
index d2dbb73..84acfb7 100644
--- a/pyanaconda/installclasses/fedora.py
+++ b/pyanaconda/installclasses/fedora.py
@@ -21,15 +21,12 @@ from pyanaconda.installclass import BaseInstallClass
from pyanaconda.product import productName
from pyanaconda import network
from pyanaconda import nm
-from pyanaconda.i18n import N_
class FedoraBaseInstallClass(BaseInstallClass):
- # name has underscore used for mnemonics, strip if you dont need it
- id = "fedora"
- name = N_("_Fedora")
+ name = "Fedora"
sortPriority = 10000
if productName.startswith("Red Hat "):
- hidden = 1
+ hidden = True
_l10n_domain = "anaconda"
diff --git a/pyanaconda/installclasses/rhel.py b/pyanaconda/installclasses/rhel.py
index 5931432..5dc39f2 100644
--- a/pyanaconda/installclasses/rhel.py
+++ b/pyanaconda/installclasses/rhel.py
@@ -17,19 +17,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-from pyanaconda.i18n import N_
from pyanaconda.installclass import BaseInstallClass
from pyanaconda.product import productName
from pyanaconda import network
from pyanaconda import nm
class RHELBaseInstallClass(BaseInstallClass):
- # name has underscore used for mnemonics, strip if you dont need it
- id = "rhel"
- name = N_("Red Hat Enterprise Linux")
+ name = "Red Hat Enterprise Linux"
sortPriority = 10000
if not productName.startswith("Red Hat "):
- hidden = 1
+ hidden = True
defaultFS = "xfs"
bootloaderTimeoutDefault = 5
--
1.9.3
9 years, 9 months
[master/rhel7] Add more tools for rescue mode (#1109785)
by Brian C. Lane
This adds od, hexdump, hexedit, gdisk, and binaries from sg3_utils
Resolves: rhbz#1109785
---
share/runtime-cleanup.tmpl | 4 ++--
share/runtime-install.tmpl | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/share/runtime-cleanup.tmpl b/share/runtime-cleanup.tmpl
index 3f5323f..1bd5968 100644
--- a/share/runtime-cleanup.tmpl
+++ b/share/runtime-cleanup.tmpl
@@ -148,7 +148,7 @@ removefrom coreutils /usr/bin/expand /usr/bin/factor
removefrom coreutils /usr/bin/fold /usr/bin/groups /usr/bin/hostid
removefrom coreutils /usr/bin/install /usr/bin/join /usr/bin/logname
removefrom coreutils /usr/bin/mkfifo /usr/bin/nl /usr/bin/nohup /usr/bin/nproc
-removefrom coreutils /usr/bin/od /usr/bin/paste /usr/bin/pathchk
+removefrom coreutils /usr/bin/paste /usr/bin/pathchk
removefrom coreutils /usr/bin/pinky /usr/bin/pr /usr/bin/printenv
removefrom coreutils /usr/bin/printf /usr/bin/ptx /usr/bin/runcon /usr/bin/seq
removefrom coreutils /usr/bin/sha224sum /usr/bin/sha384sum
@@ -319,7 +319,7 @@ removefrom util-linux --allbut \
/etc/mtab /etc/pam.d/login /etc/pam.d/remote \
/usr/sbin/{agetty,blkid,blockdev,clock,fdisk,fsck,fstrim,hwclock,losetup} \
/usr/sbin/{mkswap,nologin,sfdisk,swapoff,swapon,wipefs,partx} \
- /usr/bin/logger
+ /usr/bin/{logger,hexdump}
removefrom volume_key-libs /usr/share/locale/*
removefrom wget /etc/* /usr/share/locale/*
removefrom xorg-x11-drv-intel /usr/${libdir}/libI*
diff --git a/share/runtime-install.tmpl b/share/runtime-install.tmpl
index 0050124..84d0b30 100644
--- a/share/runtime-install.tmpl
+++ b/share/runtime-install.tmpl
@@ -134,7 +134,7 @@ installpkg libreport-plugin-bugzilla libreport-plugin-reportuploader
installpkg vim-minimal strace lsof dump xz less eject
installpkg wget rsync rsh bind-utils ftp mtr
installpkg spice-vdagent
-installpkg gdisk
+installpkg gdisk hexedit sg3_utils
## yum plugins
installpkg yum-langpacks
--
1.9.3
9 years, 9 months
[pykickstart][rhel7-branch/master][PATCH 1/2] Validate network interface name when parsing the kickstart (#1081982)
by Martin Kolman
Resolves: rhbz#1081982
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
pykickstart/commands/network.py | 42 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/pykickstart/commands/network.py b/pykickstart/commands/network.py
index 7b1341c..d48aec2 100644
--- a/pykickstart/commands/network.py
+++ b/pykickstart/commands/network.py
@@ -523,3 +523,45 @@ class RHEL7_Network(F20_Network):
op.add_option("--interfacename", dest="interfacename", action="store",
default="")
return op
+
+ def parse(self, args):
+ # call the overridden command to do it's job first
+ retval = F20_Network.parse(self, args)
+
+ # validate the device name
+ # (for reference see the NetworkManager source code:
+ # NetworkManager/src/settings/plugins/ifcfg-rh/reader.c
+ # and the make_vlan_setting function)
+
+ min_vlan_id = 0
+ max_vlan_id = 4095
+ vlan_id = None
+
+ # if it contains '.', vlan id should follow (eg 'ens7.171', 'mydev.171')
+ split_name = retval.interfacename.split(".", 1)
+ if len(split_name) > 1:
+ # 'vlan' can't be followed by a '.'
+ if split_name[0] == "vlan":
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg=_("for network --interfacename 'vlan' can't be followed by a '.'")))
+ try:
+ vlan_id = int(split_name[1])
+ except ValueError:
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg=_("if network --interfacename contains a '.', valid vlan id should follow")))
+
+ # if it starts with 'vlan', vlan id should follow ('vlan171')
+ if retval.interfacename.startswith("vlan"):
+ try:
+ vlan_id = int(retval.interfacename.strip("vlan"))
+ except ValueError:
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg=_("if network --interfacename starts with 'vlan', valid vlan id should follow")))
+
+ # check if the vlan id is in range
+ if vlan_id is not None:
+ if not(min_vlan_id <= vlan_id <= max_vlan_id):
+ raise KickstartValueError(formatErrorMsg(self.lineno,
+ msg=_("vlan id out of range")))
+
+ return retval
--
1.9.3
9 years, 9 months
[blivet:master/rhel7] Pylint inspired cleanup (#1070115)
by Anne Mulhern
Related: rhbz#1070115
Should have gone in with commit 601010a242bf51d810600b3385d77a9399e40a30.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/devicelibs/dasd.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/blivet/devicelibs/dasd.py b/blivet/devicelibs/dasd.py
index 79530e9..b558fef 100644
--- a/blivet/devicelibs/dasd.py
+++ b/blivet/devicelibs/dasd.py
@@ -136,7 +136,7 @@ def online_dasd(dev):
online = "/sys/bus/ccw/drivers/dasd-eckd/%s/online" % (dev)
if not os.path.exists(online):
- log.info("Freeing DASD device %s" % dev)
+ log.info("Freeing DASD device %s", dev)
util.run_program(["dasd_cio_free", "-d", dev])
if not os.path.exists(online):
@@ -150,7 +150,7 @@ def online_dasd(dev):
raise ValueError(_("Device %s is already online.") % dev)
else:
with open(online, "w") as f:
- log.debug("echo %s > %s" % ("1", online))
+ log.debug("echo %s > %s", "1", online)
f.write("%s\n" % ("1"))
except IOError as e:
raise ValueError(_("Could not set DASD device %(dev)s online (%(e)s).") \
--
1.9.3
9 years, 9 months