[blivet] get action_test into working order
by David Lehman
blivet/deviceaction.py | 2 +-
blivet/devices.py | 22 +++---
tests/action_test.py | 201 +++++++++++++++++++++++++++--------------------
tests/storagetestcase.py | 72 +++++++----------
4 files changed, 159 insertions(+), 138 deletions(-)
10 years, 2 months
[blivet:rhel7/master] make savePassphrase not crash
by Anne Mulhern
It turns out that this problem is in rhel7 as well as master, and
current version of anaconda does seem to call this method.
I think it's definitely worth considering for a push to rhel7 given the nature
of the bug and the obviousness of the fix.
mulhern (1):
An obvious fix to blivet.Blivet.savePassphrase.
blivet/__init__.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
1.8.3.1
10 years, 2 months
[PATCH] Add an option to disable even installing the core group.
by Chris Lumens
Use this one wisely - it may result in a system that doesn't do anything.
---
pykickstart/parser.py | 6 ++++++
pykickstart/sections.py | 14 +++++++++++++-
tests/parser/packages.py | 22 ++++++++++++++++++++++
3 files changed, 41 insertions(+), 1 deletion(-)
diff --git a/pykickstart/parser.py b/pykickstart/parser.py
index 94b21bb..0e3cb71 100644
--- a/pykickstart/parser.py
+++ b/pykickstart/parser.py
@@ -262,6 +262,9 @@ class Packages(KickstartObject):
addBase -- Should the Base group be installed even if it is
not specified?
+ nocore -- Should the Core group be skipped? This results in
+ a %packages section that basically only installs the
+ packages you list, and may not be a usable system.
default -- Should the default package set be selected?
environment -- What base environment should be selected? Only one
may be chosen at a time.
@@ -290,6 +293,7 @@ class Packages(KickstartObject):
KickstartObject.__init__(self, *args, **kwargs)
self.addBase = True
+ self.nocore = False
self.default = False
self.environment = None
self.excludedList = []
@@ -341,6 +345,8 @@ class Packages(KickstartObject):
retval += " --excludedocs"
if not self.addBase:
retval += " --nobase"
+ if self.nocore:
+ retval += " --nocore"
if self.handleMissing == constants.KS_MISSING_IGNORE:
retval += " --ignoremissing"
if self.instLangs:
diff --git a/pykickstart/sections.py b/pykickstart/sections.py
index 51c304a..bd98fb1 100644
--- a/pykickstart/sections.py
+++ b/pykickstart/sections.py
@@ -3,7 +3,7 @@
#
# Chris Lumens <clumens(a)redhat.com>
#
-# Copyright 2011 Red Hat, Inc.
+# Copyright 2011, 2014 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use, modify,
# copy, or redistribute it subject to the terms and conditions of the GNU
@@ -30,9 +30,13 @@ is necessary is to create a new subclass of Section and call
parser.registerSection with an instance of your new class.
"""
from constants import *
+from errors import KickstartParseError, formatErrorMsg
from options import KSOptionParser
from version import *
+import gettext
+_ = lambda x: gettext.ldgettext("pykickstart", x)
+
class Section(object):
"""The base class for defining kickstart sections. You are free to
subclass this as appropriate.
@@ -226,6 +230,8 @@ class PackageSection(Section):
action="store_true", default=False)
op.add_option("--nobase", dest="nobase", action="store_true",
default=False, deprecated=F18)
+ op.add_option("--nocore", dest="nocore", action="store_true",
+ default=False, introduced=F21)
op.add_option("--ignoredeps", dest="resolveDeps", action="store_false",
deprecated=FC4, removed=F9)
op.add_option("--resolvedeps", dest="resolveDeps", action="store_true",
@@ -239,6 +245,11 @@ class PackageSection(Section):
(opts, extra) = op.parse_args(args=args[1:], lineno=lineno)
+ if opts.defaultPackages and opts.nobase:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nobase cannot be used together")))
+ elif opts.defaultPackages and opts.nocore:
+ raise KickstartParseError(formatErrorMsg(lineno, msg=_("--default and --nocore cannot be used together")))
+
self.handler.packages.excludeDocs = opts.excludedocs
self.handler.packages.addBase = not opts.nobase
if opts.ignoremissing:
@@ -252,5 +263,6 @@ class PackageSection(Section):
if opts.instLangs:
self.handler.packages.instLangs = opts.instLangs
+ self.handler.packages.nocore = opts.nocore
self.handler.packages.multiLib = opts.multiLib
self.handler.packages.seen = True
diff --git a/tests/parser/packages.py b/tests/parser/packages.py
index 560a59f..ac764fa 100644
--- a/tests/parser/packages.py
+++ b/tests/parser/packages.py
@@ -51,6 +51,28 @@ bash
self.parser.readKickstartFromString(self.ks)
self.assertEqual(len(w), 0)
+class Packages_Contains_Nobase_Default_TestCase(ParserTest):
+ ks = """
+%packages --nobase --default
+%end
+"""
+
+ def runTest(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ self.assertRaises(KickstartParseError, self.parser.readKickstartFromString, self.ks)
+
+class Packages_Contains_Nocore_Default_TestCase(ParserTest):
+ ks = """
+%packages --nocore --default
+%end
+"""
+
+ def runTest(self):
+ with warnings.catch_warnings(record=True) as w:
+ warnings.simplefilter("always")
+ self.assertRaises(KickstartParseError, self.parser.readKickstartFromString, self.ks)
+
class Packages_Contains_Environment_1_TestCase(ParserTest):
ks = """
%packages
--
1.8.3.1
10 years, 2 months
[blivet:master 0/4] Make blivet pylintable
by Anne Mulhern
These patches add ability to run pylint on blivet similarly to how it is
run on anaconda.
There is an additional script that can be run to show only pylint errors that
correspond to lines added since commit <SHA1>. It requires that diff-cover
be installed and diff-quality be in your path.
I would like this patch set reviewed and pushed
before I begin sending patches addressing
existing pylint errors for review. I hope the included script will
encourage people to run pylint on their new code and fix errors in that
code. I believe that the review process for patches that fix existing
errors will be lengthy and that it is better to be able to use pylint now
on new code than to wait until all existing pylint errors are dealt with.
mulhern (4):
Do an initial setup for running pylint tests in blivet.
Change output format so that it is suitable for diff-cover.
Add a script to relate pylint errors to lines changed.
Remove non-doing check target
Makefile | 4 -
scripts/pylintcodediff | 143 ++++++++++++++++++++++++++++++++++++
tests/pylint/intl.py | 63 ++++++++++++++++
tests/pylint/pylint-false-positives | 0
tests/pylint/pylint-one.sh | 33 +++++++++
tests/pylint/runpylint.sh | 127 ++++++++++++++++++++++++++++++++
tests/testenv.sh | 13 ++++
7 files changed, 379 insertions(+), 4 deletions(-)
create mode 100755 scripts/pylintcodediff
create mode 100644 tests/pylint/intl.py
create mode 100644 tests/pylint/pylint-false-positives
create mode 100755 tests/pylint/pylint-one.sh
create mode 100755 tests/pylint/runpylint.sh
create mode 100644 tests/testenv.sh
--
1.8.3.1
10 years, 2 months
[master][PATCH] Drop the vconsole.font boot arg (#1074113)
by Vratislav Podzimek
It doesn't bring any good anymore and causes issues. Also remove the old comment
that is no longer needed.
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/bootloader.py | 7 +------
pyanaconda/keyboard.py | 8 --------
pyanaconda/kickstart.py | 3 ---
3 files changed, 1 insertion(+), 17 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 914d25d..f930752 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -2392,13 +2392,8 @@ def writeBootLoader(storage, payload, instClass, ksdata):
# set up dracut/fips boot args
# XXX FIXME: do this from elsewhere?
- #storage.bootloader.set_boot_args(keyboard=anaconda.keyboard,
- # storage=anaconda.storage,
- # language=anaconda.instLanguage,
- # network=anaconda.network)
storage.bootloader.set_boot_args(storage=storage,
- payload=payload,
- keyboard=ksdata.keyboard)
+ payload=payload)
try:
storage.bootloader.write()
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 9e322f2..4f8323e 100644
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -253,14 +253,6 @@ def write_keyboard_config(keyboard, root, convert=True):
if errors:
raise KeyboardConfigError("\n".join(errors))
-def dracut_setup_args():
- """Function returning dracut setup args."""
-
- args = set()
- args.add("vconsole.font=%s" % DEFAULT_VC_FONT)
-
- return args
-
def _try_to_load_keymap(keymap):
"""
Method that tries to load keymap and returns boolean indicating if it was
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 53c6d6f..398cafa 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1559,9 +1559,6 @@ class Keyboard(commands.keyboard.F18_Keyboard):
def execute(self, *args):
keyboard.write_keyboard_config(self, ROOT_PATH)
- def dracutSetupArgs(self, *args):
- return keyboard.dracut_setup_args()
-
class Upgrade(commands.upgrade.F20_Upgrade):
# Upgrade is no longer supported. If an upgrade command was included in
# a kickstart, warn the user and exit.
--
1.8.5.3
10 years, 2 months
[PATCH] Get the DBus session bus address in a method
by David Shea
It turns out that just getting the session address will try to launch
things that can fail.
---
pyanaconda/safe_dbus.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/safe_dbus.py b/pyanaconda/safe_dbus.py
index e9ddfbb..e8e4c31 100644
--- a/pyanaconda/safe_dbus.py
+++ b/pyanaconda/safe_dbus.py
@@ -27,8 +27,11 @@ from pyanaconda.constants import DEFAULT_DBUS_TIMEOUT
DBUS_PROPS_IFACE = "org.freedesktop.DBus.Properties"
DBUS_SYSTEM_BUS_ADDR = Gio.dbus_address_get_for_bus_sync(Gio.BusType.SYSTEM,
None)
-DBUS_SESSION_BUS_ADDR = Gio.dbus_address_get_for_bus_sync(Gio.BusType.SESSION,
- None)
+
+# This one is a method instead of a constant because getting the address
+# for the session attempts to run dbus-launch and can fail
+def _get_dbus_session_bus_addr():
+ return Gio.dbus_address_get_for_bus_sync(Gio.BusType.SESSION, None)
class SafeDBusError(Exception):
"""Class for exceptions defined in this module."""
@@ -161,7 +164,7 @@ def dbus_get_session_connection():
try:
connection = Gio.DBusConnection.new_for_address_sync(
- DBUS_SESSION_BUS_ADDR,
+ _get_dbus_session_bus_addr(),
Gio.DBusConnectionFlags.AUTHENTICATION_CLIENT|
Gio.DBusConnectionFlags.MESSAGE_BUS_CONNECTION,
None, None)
--
1.9.0
10 years, 2 months
[blivet:rhel7/master] Remove all dependent devices leaves first when hiding (#1078163)
by Anne Mulhern
Resolves: rhbz#1078163
The major change is that the recursive structure of the function goes
away. In the new structure all actions are removed and then all dependent
devices are removed, including the device itself.
all) We use getDependentDevices to get the dependent devices, hopefully all
of them.
leaves first) We iteratively remove leaf devices from the list of
dependent devices until the list is empty.
We believe that at this stage, if actions have been canceled correctly,
that there is no device in the list of dependent devices that has
already been removed.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
blivet/devicetree.py | 45 +++++++++++++++++++--------------------------
1 file changed, 19 insertions(+), 26 deletions(-)
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 8ec0852..674efec 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -1824,31 +1824,17 @@ class DeviceTree(object):
If a device exists, performs some special actions and places
it on a list of hidden devices.
- Mixes recursion and side effects, most significantly in the code
- that removes all the actions. However, this code is a null op
- in every case except the first base case that is reached,
- where all actions are removed. This means that when a device
- is removed explicitly in this function by means of a direct call to
- _removeDevices it is guaranteed that all actions have already
- been canceled.
-
- The recursion guarantees that when a device is removed by an explicit
- _removeDevice call it is a leaf device.
-
- It also guarantees that hidden devices are added to self._hidden
+ The method guarantees that hidden devices are added to self._hidden
in a topologically sorted order (assuming edges are child
relationships), leaves first.
If a device does not exist then it must have been removed by the
- cancelation of all the actions, so it does not need to be removed
- explicitly.
+ cancelation of all the actions. All devices that are explicitly
+ removed in this method are, consequently, existent devices.
"""
if device in self._hidden:
return
- for d in self.getChildren(device):
- self.hide(d)
-
log.info("hiding device %s %s (id %d)" % (device.type,
device.name,
device.id))
@@ -1856,19 +1842,26 @@ class DeviceTree(object):
for action in reversed(self._actions):
self.cancelAction(action)
- if not device.exists:
- return
+ dependents = self.getDependentDevices(device)
+ dependents.reverse()
+ dependents.append(device)
+
+ while dependents:
+ leaves = [ dev for dev in dependents if dev.isleaf ]
+ for leaf in leaves:
+
+ self._removeDevice(leaf, moddisk=False)
- self._removeDevice(device, moddisk=False)
+ self._hidden.append(leaf)
+ lvm.lvm_cc_addFilterRejectRegexp(leaf.name)
- self._hidden.append(device)
- lvm.lvm_cc_addFilterRejectRegexp(device.name)
+ if isinstance(leaf, DASDDevice):
+ self.dasd.remove(leaf)
- if isinstance(device, DASDDevice):
- self.dasd.remove(device)
+ if leaf.name not in self.names:
+ self.names.append(leaf.name)
- if device.name not in self.names:
- self.names.append(device.name)
+ dependents.remove(leaf)
def unhide(self, device):
# the hidden list should be in leaves-first order
--
1.8.3.1
10 years, 2 months
[master] Fix pylint error in yumpayload.
by Samantha N. Bueno
---
pyanaconda/packaging/yumpayload.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 06ee464..b1955b6 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1190,7 +1190,7 @@ reposdir=%s
# If we're doing non-interactive ks install, raise CmdlineError,
# otherwise the system will just reboot automatically
if flags.automatedInstall and not flags.ksprompt:
- errtxt = _("CmdlineError: Missing package: %s" %str(exn))
+ errtxt = _("CmdlineError: Missing package: %s") % str(exn)
log.error(errtxt)
raise CmdlineError(errtxt)
elif errorHandler.cb(exn, str(exn), adding) == ERROR_RAISE:
--
1.8.3.1
10 years, 2 months
[PATCH 5/5] Changes to allow pylint checks to be run on a distribution of the source.
by Anne Mulhern
That is, we allow for the fact that sometime the top source directory
may not actually be a git working directory.
Changes taken from anaconda commit 67dd55b7d532dadd5ac05cb89e63435b9d76be39.
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
tests/lib/testlib.sh | 37 +++++++++++++++++++++++++++++++++++++
tests/pylint/runpylint.sh | 17 +++++++----------
2 files changed, 44 insertions(+), 10 deletions(-)
create mode 100644 tests/lib/testlib.sh
diff --git a/tests/lib/testlib.sh b/tests/lib/testlib.sh
new file mode 100644
index 0000000..896d884
--- /dev/null
+++ b/tests/lib/testlib.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+# Shell functions for use by anaconda tests
+#
+# Copyright (C) 2014 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published
+# by the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: David Shea <dshea(a)redhat.com>
+
+# Print a list of files to test on stdout
+# Takes filter arguments identical to the find utility, for example
+# findtestfiles -name '*.py'. Note that pruning directories will not
+# work since find is passed a list of filenames as the path arguments.
+findtestfiles()
+{
+ # If the test is being run from a git work tree, use a list of all files
+ # known to git
+ if [ -d "${top_srcdir}/.git" ]; then
+ findpath=$(git ls-files -c "${top_srcdir}")
+ # Otherwise list everything under $top_srcdir
+ else
+ findpath="${top_srcdir} -type f"
+ fi
+
+ find $findpath "$@"
+}
diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh
index 5d452b8..e0ec7de 100755
--- a/tests/pylint/runpylint.sh
+++ b/tests/pylint/runpylint.sh
@@ -27,6 +27,8 @@ if [ -z "$top_srcdir" ]; then
. ${top_srcdir}/tests/testenv.sh
fi
+. ${top_srcdir}/tests/lib/testlib.sh
+
srcdir="${top_srcdir}/tests/pylint"
builddir="${top_builddir}/tests/pylint"
@@ -89,16 +91,11 @@ fi
# run pylint one file / module at a time, otherwise it sometimes gets
# confused
if [ -z "$FILES" ]; then
- # Find any file in the git working tree that either ends in .py
- # or contains #!/usr/bin/python in the first line.
- # Scan everything except old_tests
- for testfile in $(git ls-files -c "${top_srcdir}" | egrep -v '(^|/)old_tests/') ; do
- if [ -f "${testfile}" ] && \
- ( [ "${testfile%.py}" != "${testfile}" ] || \
- head -1 "${testfile}" | grep -q '^#!/usr/bin/python' ) ; then
- FILES="$FILES $testfile"
- fi
- done
+ # Test any file that either ends in .py or contains #!/usr/bin/python in
+ # the first line. Scan everything except old_tests
+ FILES=$(findtestfiles \( -name '*.py' -o \
+ -exec /bin/sh -c "head -1 {} | grep -q '#!/usr/bin/python'" \; \) -print | \
+ egrep -v '(|/)old_tests/')
fi
num_cpus=$(getconf _NPROCESSORS_ONLN)
--
1.8.3.1
10 years, 2 months
[master] Inhibit the screensaver
by David Shea
And fix a couple of DBus surprises along the way
David Shea (3):
Convert errors raised during dbus connection to DBusCallError
Handle the dbus method call not returning anything.
Inhibit the screen saver on live installs (#928825)
anaconda | 15 ++++++++
data/liveinst/console.apps/liveinst | 4 +-
pyanaconda/anaconda.py | 4 ++
pyanaconda/safe_dbus.py | 62 ++++++++++++++++++++++++++++---
pyanaconda/screensaver.py | 73 +++++++++++++++++++++++++++++++++++++
5 files changed, 152 insertions(+), 6 deletions(-)
create mode 100644 pyanaconda/screensaver.py
--
1.8.5.3
10 years, 2 months