[PATCH rhel7-branch/master] If the network is disabled, also disable the network part of the source spoke.
by Chris Lumens
Otherwise, the user could be put into a confusing situation where they have
a network source entered, but the displayed error messages do not help the user
figure out that there's no network connection. For RHEL this is especially bad
since no network is the default.
Resolves: rhbz#1072453
---
pyanaconda/ui/gui/spokes/source.py | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 7a72785..812f01f 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -42,6 +42,7 @@ from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.packaging import PackagePayload, payloadMgr
from pyanaconda import constants
+from pyanaconda import nm
from blivet.util import get_mount_device, get_mount_paths
@@ -761,6 +762,18 @@ class SourceSpoke(NormalSpoke):
# that condition here too.
self.on_protocol_changed(self._protocolComboBox)
+ # If there's no network up (which is the default case), disable all the
+ # network-related stuff.
+ if not nm.nm_is_connected():
+ self._networkButton.set_sensitive(False)
+ self._networkBox.set_sensitive(False)
+
+ self.clear_info()
+ self.set_warning(_("You need to configure the network to use a network installation source."))
+ else:
+ self._networkButton.set_sensitive(True)
+ self._networkBox.set_sensitive(True)
+
@property
def showable(self):
return isinstance(self.payload, PackagePayload)
@@ -806,6 +819,10 @@ class SourceSpoke(NormalSpoke):
if len(ui_repo_names) != len(frozenset(ui_repo_names)):
return
else:
+ # Clear any error message on the bottom of the screen so that on
+ # the next visit to this spoke, the user doesn't see a stale message
+ # about no network being up.
+ self.clear_info()
NormalSpoke.on_back_clicked(self, button)
def on_chooser_clicked(self, button):
--
1.9.3
9 years, 7 months
[f21/master] Avoid the possibility of a variable being unset before use (#1146585)
by David Shea
---
pyanaconda/kickstart.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index fadc501..5ae8f71 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -776,7 +776,7 @@ class LogVolData(commands.logvol.F20_LogVolData):
raise KickstartValueError(formatErrorMsg(self.lineno,
msg="The size \"%s\" is invalid." % self.size))
except TypeError:
- pass
+ size = Size(0)
if self.mountpoint == "swap":
ty = "swap"
--
2.1.0
9 years, 7 months
[PATCH] Shut up, parallel
by David Shea
---
scripts/githooks/pre-push | 2 +-
tests/glade/run_glade_tests.sh | 2 +-
tests/pylint/runpylint.sh | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/scripts/githooks/pre-push b/scripts/githooks/pre-push
index 5cfbcca..ca84b53 100755
--- a/scripts/githooks/pre-push
+++ b/scripts/githooks/pre-push
@@ -77,7 +77,7 @@ fi
## main ##
# fork separate process for every commit, querying bugzilla takes time
-echo -n ${commits}|parallel -d' ' --gnu -j0 .git/hooks/check_commit_msg.sh ${release} {}
+echo -n ${commits}|parallel --no-notice -d' ' --gnu -j0 .git/hooks/check_commit_msg.sh ${release} {}
ret=$?
if [ ${ACK_FATAL} == "0" ]; then
test ${ret} -eq 0
diff --git a/tests/glade/run_glade_tests.sh b/tests/glade/run_glade_tests.sh
index 730d2d3..8ebcbfe 100755
--- a/tests/glade/run_glade_tests.sh
+++ b/tests/glade/run_glade_tests.sh
@@ -27,7 +27,7 @@ fi
status=0
for check in ${srcdir}/*/check_*.py ; do
- findtestfiles -name '*.glade' | parallel --gnu -j0 "${check}" "$@" {}
+ findtestfiles -name '*.glade' | parallel --no-notice --gnu -j0 "${check}" "$@" {}
if [ "$?" -ne 0 ]; then
status=1
fi
diff --git a/tests/pylint/runpylint.sh b/tests/pylint/runpylint.sh
index c2a9393..bd863bf 100755
--- a/tests/pylint/runpylint.sh
+++ b/tests/pylint/runpylint.sh
@@ -124,7 +124,7 @@ if [ -z "$FILES" ]; then
fi
# run pylint in paralel
-output=$(echo -n $FILES | parallel -d' ' --gnu "$srcdir"/pylint-one.sh $ARGS {})
+output=$(echo -n $FILES | parallel --no-notice -d' ' --gnu "$srcdir"/pylint-one.sh $ARGS {})
exit_status=$?
if [ "$output" != '\n' -a "$output" != "" ]; then
--
2.1.0
9 years, 7 months
[master/rhel7-branch][PATCH 2/2] Don't force a user to return to the storage spoke after dasdfmt (#1074010)
by Samantha N. Bueno
Not only is this unnecessary, it caused some odd behavior. I'm not sure why
I ever included this line, but it's time for it to go away, and for things
to work again.
Resolves: rhbz#1074010
---
pyanaconda/ui/gui/spokes/storage.py | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 2035d4b..e7c51d8 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -810,11 +810,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
ignoreEscape(dialog.window)
rc = self.run_lightbox_dialog(dialog)
if rc == 1:
- # User hit OK on the dialog, indicating they stayed on the
- # dialog until formatting completed; make sure we stay on
- # the storage spoke and don't return to the summary hub
- self.skipTo = "StorageSpoke"
- # we have to manaually call refresh so changes are picked up
+ # User hit OK on the dialog
self.refresh()
elif rc == 2:
# User clicked uri to return to hub.
--
1.9.3
9 years, 7 months
[PATCH] Really fix unexpected exits in execReadlines
by David Shea
Due to the asynchronous nature of signal delivery, it's possible to
check on the execReadlines child process at a point where output has
been closed but the process is still, technically, alive. This situation
appeared in particular when running the nosetests on a system with one
CPU. To make the behavior of reading a line from an exiting process
deterministic, wait for the process to finish when output is complete.
The consequence of this is that processes that runs forever will cause
execReadlines to block forever, and the answer is to not run such a
process with execReadlines.
Also revert to and make intentional the old, accidental behavior of
raising OSError any time the process exits with a non-0 status, since
that actually seems more useful than just looking for signal exits.
---
pyanaconda/iutil.py | 19 ++++++++++++++-----
tests/pyanaconda_tests/iutil_test.py | 4 ++--
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index bf4928d..f51c9ae 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -326,6 +326,10 @@ def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
""" Execute an external command and return the line output of the command
in real-time.
+ This method assumes that there is a reasonably low delay between the
+ end of output and the process exiting. If the child process closes
+ stdout and then keeps on truckin' there will be problems.
+
:param command: The command to run
:param argv: The argument list
:param stdin: The file object to read stdin from.
@@ -363,11 +367,16 @@ def execReadlines(command, argv, stdin=None, root='/', env_prune=None):
# Read the next line, blocking if a line is not yet available
line = self._proc.stdout.readline()
if line == '':
- # Output finished, check for the process dying unexpectedly
- # and stop the iteration
- if self._proc.poll() is not None:
- if self._proc.returncode < 0:
- raise OSError("process '%s' was killed" % self._argv)
+ # Output finished, wait for the process to end
+ self._proc.communicate()
+
+ # Check for successful exit
+ if self._proc.returncode < 0:
+ raise OSError("process '%s' was killed by signal %s" %
+ (self._argv, -self._proc.returncode))
+ elif self._proc.returncode > 0:
+ raise OSError("process '%s' exited with status %s" %
+ (self._argv, self._proc.returncode))
raise StopIteration
return line.strip()
diff --git a/tests/pyanaconda_tests/iutil_test.py b/tests/pyanaconda_tests/iutil_test.py
index da33d8e..82148d5 100644
--- a/tests/pyanaconda_tests/iutil_test.py
+++ b/tests/pyanaconda_tests/iutil_test.py
@@ -184,7 +184,7 @@ exit 1
self.assertEqual(rl_iterator.next(), "one")
self.assertEqual(rl_iterator.next(), "two")
self.assertEqual(rl_iterator.next(), "three")
- self.assertRaises(StopIteration, rl_iterator.next)
+ self.assertRaises(OSError, rl_iterator.next)
# Test exit on signal
with tempfile.NamedTemporaryFile() as testscript:
@@ -218,7 +218,7 @@ exit 1
self.assertEqual(rl_iterator.next(), "one")
self.assertEqual(rl_iterator.next(), "two")
self.assertEqual(rl_iterator.next(), "three")
- self.assertRaises(StopIteration, rl_iterator.next)
+ self.assertRaises(OSError, rl_iterator.next)
with tempfile.NamedTemporaryFile() as testscript:
testscript.write("""#!/bin/sh
--
2.1.0
9 years, 7 months
[PATCH] Add a context manager for executing code while UI signals are blocked.
by Chris Lumens
---
pyanaconda/ui/gui/spokes/lib/resize.py | 8 ++++----
pyanaconda/ui/gui/spokes/software.py | 12 +++++-------
pyanaconda/ui/gui/spokes/source.py | 24 ++++++++++++------------
pyanaconda/ui/gui/utils.py | 13 ++++++++++++-
4 files changed, 33 insertions(+), 24 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index ffcc63c..ee9c322 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -26,7 +26,7 @@ from gi.repository import Gdk, Gtk
from pyanaconda.i18n import _, C_, N_, P_
from pyanaconda.ui.gui import GUIObject
-from pyanaconda.ui.gui.utils import escape_markup, timed_action
+from pyanaconda.ui.gui.utils import blockedHandler, escape_markup, timed_action
from blivet.size import Size
__all__ = ["ResizeDialog"]
@@ -261,9 +261,9 @@ class ResizeDialog(GUIObject):
fivePercent = int(distance / 20)
twentyPercent = int(distance / 5)
- self._resizeSlider.handler_block_by_func(self.on_resize_value_changed)
- self._resizeSlider.set_range(minSize, size)
- self._resizeSlider.handler_unblock_by_func(self.on_resize_value_changed)
+ with blockedHandler(self._resizeSlider, self.on_resize_value_changed):
+ self._resizeSlider.set_range(minSize, size)
+
self._resizeSlider.set_value(default_value)
adjustment = self.builder.get_object("resizeAdjustment")
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index c60494c..7ab862c 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -30,7 +30,7 @@ from pyanaconda import constants, iutil
from pyanaconda.ui.communication import hubQ
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.spokes.lib.detailederror import DetailedErrorDialog
-from pyanaconda.ui.gui.utils import gtk_action_wait, escape_markup
+from pyanaconda.ui.gui.utils import blockedHandler, gtk_action_wait, escape_markup
from pyanaconda.ui.categories.software import SoftwareCategory
import logging
@@ -410,9 +410,8 @@ class SoftwareSelectionSpoke(NormalSpoke):
box = row.get_children()[0]
button = box.get_children()[0]
- button.handler_block_by_func(self.on_radio_button_toggled)
- button.set_active(True)
- button.handler_unblock_by_func(self.on_radio_button_toggled)
+ with blockedHandler(button, self.on_radio_button_toggled):
+ button.set_active(True)
# Remove all the groups that were selected by the previously
# selected environment.
@@ -436,9 +435,8 @@ class SoftwareSelectionSpoke(NormalSpoke):
wasActive = group in self.selectedGroups
- button.handler_block_by_func(self.on_checkbox_toggled)
- button.set_active(not wasActive)
- button.handler_unblock_by_func(self.on_checkbox_toggled)
+ with blockedHandler(button, self.on_checkbox_toggled):
+ button.set_active(not wasActive)
if wasActive:
self.selectedGroups.remove(group)
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index 78ccb27..0bfd8cf 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -38,7 +38,7 @@ from pyanaconda.ui.gui import GUIObject
from pyanaconda.ui.gui.helpers import GUIDialogInputCheckHandler, GUISpokeInputCheckHandler
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.categories.software import SoftwareCategory
-from pyanaconda.ui.gui.utils import fire_gtk_action
+from pyanaconda.ui.gui.utils import blockedHandler, fire_gtk_action
from pyanaconda.iutil import ProxyString, ProxyStringError, cmp_obj_attrs
from pyanaconda.ui.gui.utils import gtk_call_once, really_hide, really_show, fancy_set_sensitive
from pyanaconda.threads import threadMgr, AnacondaThread
@@ -1198,9 +1198,10 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler):
and reset the checkbox and combobox.
"""
self._repoNameEntry.set_text("")
- self._repoMirrorlistCheckbox.handler_block_by_func(self.on_repoMirrorlistCheckbox_toggled)
- self._repoMirrorlistCheckbox.set_active(False)
- self._repoMirrorlistCheckbox.handler_unblock_by_func(self.on_repoMirrorlistCheckbox_toggled)
+
+ with blockedHandler(self._repoMirrorlistCheckbox, self.on_repoMirrorlistCheckbox_toggled):
+ self._repoMirrorlistCheckbox.set_active(False)
+
self._repoUrlEntry.set_text("")
self._repoProtocolComboBox.set_active(0)
self._repoProxyUrlEntry.set_text("")
@@ -1215,14 +1216,13 @@ class SourceSpoke(NormalSpoke, GUISpokeInputCheckHandler):
"""
self._repoNameEntry.set_text(repo.name)
- self._repoMirrorlistCheckbox.handler_block_by_func(self.on_repoMirrorlistCheckbox_toggled)
- if repo.mirrorlist:
- url = repo.mirrorlist
- self._repoMirrorlistCheckbox.set_active(True)
- else:
- url = repo.baseurl
- self._repoMirrorlistCheckbox.set_active(False)
- self._repoMirrorlistCheckbox.handler_unblock_by_func(self.on_repoMirrorlistCheckbox_toggled)
+ with blockedHandler(self._repoMirrorlistCheckbox, self.on_repoMirrorlistCheckbox_toggled):
+ if repo.mirrorlist:
+ url = repo.mirrorlist
+ self._repoMirrorlistCheckbox.set_active(True)
+ else:
+ url = repo.baseurl
+ self._repoMirrorlistCheckbox.set_active(False)
if url:
for idx, proto in REPO_PROTO.iteritems():
diff --git a/pyanaconda/ui/gui/utils.py b/pyanaconda/ui/gui/utils.py
index f6687b7..0e3c50c 100644
--- a/pyanaconda/ui/gui/utils.py
+++ b/pyanaconda/ui/gui/utils.py
@@ -1,6 +1,6 @@
# Miscellaneous UI functions
#
-# Copyright (C) 2012, 2013 Red Hat, Inc.
+# Copyright (C) 2012-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
@@ -21,6 +21,8 @@
# Vratislav Podzimek <vpodzime(a)redhat.com>
#
+from contextlib import contextmanager
+
from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.constants import NOTICEABLE_FREEZE
@@ -288,6 +290,15 @@ def timed_action(delay=300, threshold=750, busy_cursor=True):
return decorator
+@contextmanager
+def blockedHandler(obj, func):
+ """Prevent a GLib signal handling function from being called during some
+ block of code.
+ """
+ obj.handler_block_by_func(func)
+ yield
+ obj.handler_unblock_by_func(func)
+
def busyCursor():
window = Gdk.get_default_root_window()
if not window:
--
1.9.3
9 years, 7 months
[PATCH rhel7-branch 1/2] network: add support for vlan tag in iBFT (#804511)
by Radek Vykydal
Resolves: rhbz#804511
Implementation the feature, NM now creates read-only temporary in-memory
connection for iBFT configurations. Don't show the connection in installer GUI.
---
pyanaconda/nm.py | 4 ++++
pyanaconda/ui/gui/spokes/network.py | 7 +++++++
2 files changed, 11 insertions(+)
diff --git a/pyanaconda/nm.py b/pyanaconda/nm.py
index 0fca6ac..c56f610 100644
--- a/pyanaconda/nm.py
+++ b/pyanaconda/nm.py
@@ -509,6 +509,10 @@ def _device_settings(name):
settings = _find_settings(name, 'bond', 'interface-name')
elif devtype == NetworkManager.DeviceType.VLAN:
settings = _find_settings(name, 'vlan', 'interface-name')
+ if not settings:
+ # connections generated by NM from iBFT
+ parent, _sep, vlanid = name.partition(".")
+ settings = _find_settings(int(vlanid), 'vlan', 'id')
else:
settings = _find_settings(name, 'connection', 'interface-name')
if not settings:
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index 355756f..dbc15d9 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -426,6 +426,9 @@ class NetworkControlBox(GObject.GObject):
log.debug("network: GUI, connection %s found", uuid)
if self.dev_cfg(uuid=uuid):
continue
+ if setting["connection"]["read-only"]:
+ log.debug("network: GUI, not adding read-only connection %s", uuid)
+ continue
dev_cfg = DeviceConfiguration(con_uuid=uuid)
if dev_cfg.device_type in self.supported_device_types:
# Configs for ethernet has been already added,
@@ -670,6 +673,10 @@ class NetworkControlBox(GObject.GObject):
return
try:
+ read_only = nm.nm_device_setting_value(device.get_iface(), "connection", "read-only")
+ if read_only:
+ log.debug("network: not adding read-only connection for device %s", device.get_iface())
+ return
con_uuid = nm.nm_device_setting_value(device.get_iface(), "connection", "uuid")
dev_cfg = self.dev_cfg(uuid=con_uuid)
except nm.UnknownDeviceError as e:
--
1.9.3
9 years, 7 months
[master/rhel7-branch][PATCH 1/2] Don't run storageInitialize after dasdfmt (#1074010)
by Samantha N. Bueno
This is overkill, unnecessary, and best of all, it prevents a traceback
from occurring.
Related: rhbz#1074010
---
pyanaconda/ui/gui/spokes/lib/dasdfmt.py | 4 ----
pyanaconda/ui/gui/spokes/storage.py | 4 ----
pyanaconda/ui/tui/spokes/storage.py | 4 ----
3 files changed, 12 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/dasdfmt.py b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
index c0018fe..64ead76 100644
--- a/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
+++ b/pyanaconda/ui/gui/spokes/lib/dasdfmt.py
@@ -97,10 +97,6 @@ class DasdFormatDialog(GUIObject):
log.error(str(err))
continue
- # And now to fire up the storage reinitialization.
- protectedNames = [d.name for d in self.storage.protectedDevices]
- storageInitialize(self.storage, self.data, protectedNames)
-
with self._epoch_lock:
self.update_dialog(epoch_started)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 4d0b9cb..2035d4b 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -710,10 +710,6 @@ class StorageSpoke(NormalSpoke, StorageChecker):
log.error(str(err))
continue
- # now re-initialize storage to pick up the newly formatted disks
- protectedNames = [d.name for d in self.storage.protectedDevices]
- storageInitialize(self.storage, self.data, protectedNames)
-
# I really hate doing this, but the way is the way; probably the most
# correct way to kajigger the storage spoke into becoming ready
self.execute()
diff --git a/pyanaconda/ui/tui/spokes/storage.py b/pyanaconda/ui/tui/spokes/storage.py
index 7d0f12c..d73b615 100644
--- a/pyanaconda/ui/tui/spokes/storage.py
+++ b/pyanaconda/ui/tui/spokes/storage.py
@@ -306,10 +306,6 @@ class StorageSpoke(NormalTUISpoke):
log.error(str(err))
continue
- # when finished formatting we need to reinitialize storage
- protectedNames = [d.name for d in self.storage.protectedDevices]
- storageInitialize(self.storage, self.data, protectedNames)
-
def apply(self):
self.autopart = self.data.autopart.autopart
self.data.ignoredisk.onlyuse = self.selected_disks[:]
--
1.9.3
9 years, 7 months
[blivet:rhel7/master 0/5] #1076055 patches (v3)
by Anne Mulhern
First three are trivial. Last two are pretty embarassing and a bit more
complicated.
mulhern (5):
Change "if <condition>:" to "else:" for clarity (#1076055)
Use Size, not int, for size (#1076055)
Get rid of unnecessary raid_level variable (#1076055)
size related changes to save_right_side() (#1076055)
on_device_type_changed() and populate_right_side() changes (#1076055)
pyanaconda/ui/gui/spokes/custom.py | 125 ++++++++++++++++++++++---------------
1 file changed, 76 insertions(+), 49 deletions(-)
--
1.9.3
9 years, 7 months
[blivet:rhel7/master 0/3] #1076055 patches (v3)
by Anne Mulhern
Accompanying anaconda version.
mulhern (3):
Add some comments to _resizable and resizable attributes.
Revert "Make space for LUKS metadata if creating encrypted device
(#1038847)"
Calculate some derived quantities from raw device (#1076055)
blivet/devicefactory.py | 12 +-----------
blivet/devices.py | 42 +++++++++++++++++++++++++++++++++++++++---
2 files changed, 40 insertions(+), 14 deletions(-)
--
1.9.3
9 years, 7 months