[PATCH 1/2] Use a method to reset current_selector (#959707)
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
---
pyanaconda/ui/gui/spokes/custom.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index a8ac173..88e89b7 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -847,13 +847,18 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
return None
- def _do_refresh(self, mountpointToShow=None):
- # block mountpoint selector signal handler for now
- self._initialized = False
+ def _clear_current_selector(self):
+ """ If something is selected, deselect it
+ """
if self._current_selector:
self._current_selector.set_chosen(False)
self._current_selector = None
+ def _do_refresh(self, mountpointToShow=None):
+ # block mountpoint selector signal handler for now
+ self._initialized = False
+ self._clear_current_selector()
+
# Make sure we start with a clean slate.
self._accordion.removeAllPages()
@@ -2052,7 +2057,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
log.debug("show first mountpoint: %s" % page.pageTitle)
if not page.members:
- self._current_selector = None
+ self._clear_current_selector()
return
if not mountpoint:
@@ -2321,7 +2326,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
if nb_page == NOTEBOOK_DETAILS_PAGE:
self._save_right_side(self._current_selector)
- self._current_selector.set_chosen(False)
+ self._clear_current_selector()
def on_selector_clicked(self, selector):
if not self._initialized:
@@ -2397,7 +2402,6 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
log.debug("page clicked: %s" % page.pageTitle)
if self._current_selector:
self._save_current_selector()
- self._current_selector = None
self._show_mountpoint(page=page, mountpoint=mountpointToShow)
@@ -2748,7 +2752,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
self._devices = self.__storage.devices
self._unused_devices = None # why do we cache this?
- self._current_selector = None
+ self._clear_current_selector()
self._do_refresh()
def on_value_changed(self, *args):
--
1.8.1.4
11 years
[pykickstart] Fix F18/F19 cdrom methods
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
---
pykickstart/handlers/control.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/pykickstart/handlers/control.py b/pykickstart/handlers/control.py
index 7521164..de71643 100644
--- a/pykickstart/handlers/control.py
+++ b/pykickstart/handlers/control.py
@@ -892,7 +892,7 @@ commandMap = {
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.F18_Bootloader,
"btrfs": btrfs.F17_BTRFS,
- "cdrom": method.F19_Method,
+ "cdrom": method.F18_Method,
"clearpart": clearpart.F17_ClearPart,
"cmdline": displaymode.FC3_DisplayMode,
"device": device.F8_Device,
@@ -952,7 +952,7 @@ commandMap = {
"autostep": autostep.FC3_AutoStep,
"bootloader": bootloader.F19_Bootloader,
"btrfs": btrfs.F17_BTRFS,
- "cdrom": method.F18_Method,
+ "cdrom": method.F19_Method,
"clearpart": clearpart.F17_ClearPart,
"cmdline": displaymode.FC3_DisplayMode,
"device": device.F8_Device,
--
1.8.1.4
11 years
[PATCH] Add support for the realm command V2
by Martin Kolman
This patch adds support for the realm command to Anaconda.
Only the join subcommand is supported.
There is a corresponding patch adding parsing functionality for the
realm command to pykickstart.
Martin Kolman (1):
Add support for the realm command
anaconda.spec.in | 3 +-
pyanaconda/install.py | 26 ++++++++++++++---
pyanaconda/kickstart.py | 77 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 101 insertions(+), 5 deletions(-)
--
1.8.1.4
11 years
[master][PATCH] Add FONT=latarcyrheb-sun16 to /etc/vconsole.conf
by Vratislav Podzimek
systemd now defaults to a font that cannot display non-ascii characters
correctly. We have to tell it to use a better one.
Related: rhbz#869233
Related: rhbz#927564
Related: rhbz#889710
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/keyboard.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index a012492..74b93d3 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -50,6 +50,8 @@ LOCALED_SERVICE = "org.freedesktop.locale1"
LOCALED_OBJECT_PATH = "/org/freedesktop/locale1"
LOCALED_IFACE = "org.freedesktop.locale1"
+DEFAULT_VC_FONT = "latarcyrheb-sun16"
+
class KeyboardConfigError(Exception):
"""Exception class for keyboard configuration related problems"""
@@ -189,6 +191,10 @@ def write_keyboard_config(keyboard, root, convert=True):
try:
with open(os.path.join(vcconf_dir, vcconf_file), "w") as fobj:
fobj.write('KEYMAP="%s"\n' % keyboard.vc_keymap)
+
+ # systemd now defaults to a font that cannot display non-ascii
+ # characters, so we have to tell it to use a better one
+ fobj.write('FONT="%s"\n' % DEFAULT_VC_FONT)
except IOError as ioerr:
errors.append("Cannot write vconsole configuration file")
@@ -208,6 +214,7 @@ def dracut_setup_args(keyboard):
args = set()
args.add("vconsole.keymap=%s" % keyboard.vc_keymap)
+ args.add("vconsole.font=%s" % DEFAULT_VC_FONT)
return args
--
1.7.11.7
11 years
[PATCH] Change the buttons on the quit dialog.
by Chris Lumens
This brings the text on the buttons in line with what the question is asking.
I also changed some padding to make the dialog look less compressed.
---
pyanaconda/ui/gui/main.glade | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/ui/gui/main.glade b/pyanaconda/ui/gui/main.glade
index b2bad86..ab79345 100644
--- a/pyanaconda/ui/gui/main.glade
+++ b/pyanaconda/ui/gui/main.glade
@@ -3,25 +3,25 @@
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkDialog" id="quitDialog">
<property name="can_focus">False</property>
- <property name="border_width">5</property>
<property name="type_hint">dialog</property>
<property name="decorated">False</property>
<child internal-child="vbox">
<object class="GtkBox" id="quitDialog-vbox1">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="quitDialog-actionArea">
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancelButton">
- <property name="label" translatable="yes">_Cancel</property>
+ <property name="label">gtk-no</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -31,11 +31,12 @@
</child>
<child>
<object class="GtkButton" id="quitButton">
- <property name="label" translatable="yes">_Quit</property>
+ <property name="label">gtk-yes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -55,7 +56,8 @@
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">5</property>
+ <property name="margin_right">6</property>
+ <property name="spacing">6</property>
<child>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
--
1.8.1.2
11 years
[blivet] Make sure createBitmap is updated when level changes (#960271)
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
---
blivet/devices.py | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/blivet/devices.py b/blivet/devices.py
index 450dac0..ef5db99 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -2699,9 +2699,6 @@ class MDRaidArrayDevice(StorageDevice):
else:
self.metadataVersion = metadataVersion
- # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
- self.createBitmap = self.level != 0
-
# For container members probe size now, as we cannot determine it
# when teared down.
if self.parents and self.parents[0].type == "mdcontainer":
@@ -2721,6 +2718,30 @@ class MDRaidArrayDevice(StorageDevice):
% (self.path, self.uuid))
@property
+ def level(self):
+ """ Return the raid level
+
+ :returns: raid level value
+ :rtype: int
+ """
+ return self._level
+
+ @level.setter
+ def level(self, value):
+ """ Set the RAID level and enforce restrictions based on it.
+
+ :param value: new raid level
+ :param type: int
+ :returns: None
+
+ Sets createBitmap True unless level is 0
+ """
+ self._level = value
+
+ # bitmaps are not meaningful on raid0 according to mdadm-3.0.3
+ self.createBitmap = self._level != 0
+
+ @property
def rawArraySize(self):
""" Calculate the raw array size without taking into account space
reserved for metadata or chunkSize alignment.
--
1.8.1.4
11 years
[master][PATCH] Add layouts with a country if not added with a language (#960569)
by Vratislav Podzimek
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/keyboard.py | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index bc6a694..aa0c5d5 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -379,7 +379,7 @@ class XklWrapper(object):
#'grp' means that we want layout (group) switching options
self.configreg.foreach_option('grp', self._get_switch_option, None)
- def _get_variant(self, c_reg, item, subitem, lang):
+ def _get_lang_variant(self, c_reg, item, subitem, lang):
if subitem:
name = item_str(item.name) + " (" + item_str(subitem.name) + ")"
description = item_str(subitem.description)
@@ -389,21 +389,39 @@ class XklWrapper(object):
#if this layout has already been added for some other language,
#do not add it again (would result in duplicates in our lists)
- if lang and name not in self.name_to_show_str:
- self.name_to_show_str[name] = "%s (%s)" % (lang.encode("utf-8"),
+ if name not in self.name_to_show_str:
+ if lang:
+ self.name_to_show_str[name] = "%s (%s)" % (lang.encode("utf-8"),
description.encode("utf-8"))
+ else:
+ self.name_to_show_str[name] = "%s" % description.encode("utf-8")
+
self._variants_list.append(_Layout(name, description))
- elif lang is None:
- #if lang is None, we are iterating over countries not languages
- #and should just append the layout to the list
- self._variants_list.append(_Layout(name, description))
+
+ def _get_country_variant(self, c_reg, item, subitem, country):
+ if subitem:
+ name = item_str(item.name) + " (" + item_str(subitem.name) + ")"
+ description = item_str(subitem.description)
+ else:
+ name = item_str(item.name)
+ description = item_str(item.description)
+
+ # if the layout was not added with any language, add it with a country
+ if name not in self.name_to_show_str:
+ if country:
+ self.name_to_show_str[name] = "%s (%s)" % (country.encode("utf-8"),
+ description.encode("utf-8"))
+ else:
+ self.name_to_show_str[name] = "%s" % description.encode("utf-8")
+
+ self._variants_list.append(_Layout(name, description))
def _get_language_variants(self, c_reg, item, user_data=None):
#helper "global" variable
self._variants_list = list()
lang_name, lang_desc = item_str(item.name), item_str(item.description)
- c_reg.foreach_language_variant(lang_name, self._get_variant, lang_desc)
+ c_reg.foreach_language_variant(lang_name, self._get_lang_variant, lang_desc)
self._language_keyboard_variants[lang_desc] = self._variants_list
@@ -412,7 +430,8 @@ class XklWrapper(object):
self._variants_list = list()
country_name, country_desc = item_str(item.name), item_str(item.description)
- c_reg.foreach_country_variant(country_name, self._get_variant, None)
+ c_reg.foreach_country_variant(country_name, self._get_country_variant,
+ country_desc)
self._country_keyboard_variants[country_name] = self._variants_list
--
1.7.11.7
11 years
[PATCH] Fixup xconf keymap code for text/dirinstall
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
---
anaconda | 2 +-
pyanaconda/keyboard.py | 29 ++++++++++-------------------
2 files changed, 11 insertions(+), 20 deletions(-)
diff --git a/anaconda b/anaconda
index da12a04..f2a556e 100755
--- a/anaconda
+++ b/anaconda
@@ -899,7 +899,7 @@ if __name__ == "__main__":
if not ksdata.keyboard.keyboard:
ksdata.keyboard.keyboard = opts.keymap
- if ksdata.keyboard.keyboard:
+ if ksdata.keyboard.keyboard and can_touch_runtime_system("activate keyboard"):
keyboard.activate_keyboard(ksdata.keyboard)
# Some post-install parts of anaconda are implemented as kickstart
diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 84a9bac..87ec3d8 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -170,8 +170,12 @@ def write_keyboard_config(keyboard, root, convert=True):
errors.append("Cannot create directory xorg.conf.d")
# copy the file to the chroot
- shutil.copy2(xconf_file_path,
- os.path.normpath(root + "/" + xconf_file_path))
+ try:
+ shutil.copy2(xconf_file_path,
+ os.path.normpath(root + "/" + xconf_file_path))
+ except IOError as ioerr:
+ # The file may not exist (eg. text install) so don't raise
+ pass
# restore the original values
localed_wrapper.set_layouts(layouts_variants,
@@ -699,9 +703,9 @@ class LocaledWrapper(object):
if variants:
variants = variants[0].split(",")
- # if there are more layouts than variants, empty strings should be appended
- diff = len(layouts) - len(variants)
- variants.extend(diff * [""])
+ # if there are more layouts than variants, empty strings should be appended
+ diff = len(layouts) - len(variants)
+ variants.extend(diff * [""])
# map can be used with multiple lists and works like zipWith (Haskell)
return map(_join_layout_variant, layouts, variants)
@@ -757,20 +761,7 @@ class LocaledWrapper(object):
self.set_keymap(keymap, convert=True)
- layouts_str, variants_str = self.layouts_variants
-
- layouts = layouts_str.split(",")
- variants = variants_str.split(",")
-
- # if there are less variants than layouts, empty strings need to be
- # appended
- diff = len(layouts) - len(variants)
- variants = variants + diff * [""]
-
- layouts_variants = []
- layouts_variants.extend(map(_join_layout_variant, layouts, variants))
-
- return ",".join(layouts_variants)
+ return ",".join(self.layouts_variants)
def set_layouts(self, layouts_variants, options=None, convert=False):
"""
--
1.8.1.4
11 years
[PATCH][pykickstart] Add support for the realm command V2
by Martin Kolman
This patch adds support for the realm command. Only the join subcommand
is supported and only one realm line can be present in a kickstart file.
Support for the permit & deny subcomand has been removed both from
the command definition and tests.
Martin Kolman (1):
Add support for the realm command
pykickstart/commands/__init__.py | 2 +-
pykickstart/commands/realm.py | 105 +++++++++++++++++++++++++++++++++++++++
pykickstart/handlers/control.py | 1 +
tests/commands/realm.py | 43 ++++++++++++++++
4 files changed, 150 insertions(+), 1 deletion(-)
create mode 100644 pykickstart/commands/realm.py
create mode 100644 tests/commands/realm.py
--
1.8.1.4
11 years
[PATCH 1/2] Make sure all threads are done before install
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
With a kickstart it may be possible to run through the status hub
without waiting for all the threads to finish. This adds some helper
methods to threadMgr and waits for any pending threads before starting
the install.
---
pyanaconda/install.py | 11 ++++++++++-
pyanaconda/threads.py | 27 +++++++++++++++++++++++++++
2 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 0041778..d98ac72 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -20,13 +20,16 @@
# Red Hat Author(s): Chris Lumens <clumens(a)redhat.com>
#
-from pyanaconda.constants import ROOT_PATH
+from pyanaconda.constants import ROOT_PATH, THREAD_PAYLOAD
from blivet import turnOnFilesystems
from pyanaconda.bootloader import writeBootLoader
from pyanaconda.progress import progress_report, progressQ
from pyanaconda.users import createLuserConf, getPassAlgo, Users
from pyanaconda import flags
from pyanaconda import timezone
+from pyanaconda.threads import threadMgr
+import logging
+log = logging.getLogger("anaconda")
import gettext
_ = lambda x: gettext.ldgettext("anaconda", x)
@@ -110,6 +113,12 @@ def doInstall(storage, payload, ksdata, instClass):
steps += 5 # pre setup phase, packages setup, packages, bootloader, post install
progressQ.send_init(steps)
+ # This should be the only thread running, wait for the others to finish if not.
+ if threadMgr.running > 1:
+ with progress_report(_("Waiting for %s threads to finish") % (threadMgr.running-1)):
+ map(log.debug, ("Thread %s is running" % n for n in threadMgr.names))
+ threadMgr.wait_all()
+
with progress_report(_("Setting up the installation environment")):
ksdata.addons.setup(storage, ksdata, instClass)
diff --git a/pyanaconda/threads.py b/pyanaconda/threads.py
index 0c67279..69da475 100644
--- a/pyanaconda/threads.py
+++ b/pyanaconda/threads.py
@@ -86,6 +86,15 @@ class ThreadManager(object):
self.raise_error(name)
+ def wait_all(self):
+ """Wait for all threads to exit and if there was an error re-raise it.
+ """
+ for name in self._objs.keys():
+ if self.get(name) == threading.current_thread():
+ continue
+ log.debug("Waiting for thread %s to exit" % name)
+ self.wait(name)
+
def set_error(self, name, *exc_info):
"""Set the error data for a thread
@@ -116,6 +125,24 @@ class ThreadManager(object):
cur_thread = threading.current_thread()
return cur_thread is self._main_thread
+ @property
+ def running(self):
+ """ Return the number of running threads.
+
+ :returns: number of running threads
+ :rtype: int
+ """
+ return len(self._objs)
+
+ @property
+ def names(self):
+ """ Return the names of the running threads.
+
+ :returns: list of thread names
+ :rtype: list of strings
+ """
+ return self._objs.keys()
+
class AnacondaThread(threading.Thread):
"""A threading.Thread subclass that exists only for a couple purposes:
--
1.8.1.4
11 years