more little bugfixes
by David Lehman
pyanaconda/packaging/yumpayload.py | 10 +++++++---
pyanaconda/storage/__init__.py | 13 +++++++++----
pyanaconda/storage/devices.py | 11 +++++------
pyanaconda/storage/devicetree.py | 14 +++++++++-----
pyanaconda/storage/formats/fs.py | 13 +++++++++----
pyanaconda/ui/gui/spokes/custom.py | 6 +++++-
pyanaconda/ui/gui/spokes/lib/resize.py | 3 +++
pyanaconda/ui/gui/spokes/storage.py | 9 ++++++++-
8 files changed, 55 insertions(+), 24 deletions(-)
11 years, 7 months
[PATCH] Hook up the "Modify Software Selection" button on install opts dialogs.
by Chris Lumens
This uses the main loop to mark the button as insensitive until software
selection is ready, then the user can press the button and go to that spoke.
I'd also like to add a spinner to the button, but that appears to be beyond
glade for the moment.
---
pyanaconda/ui/gui/spokes/storage.glade | 2 ++
pyanaconda/ui/gui/spokes/storage.py | 45 +++++++++++++++++++++++++++++++---
2 files changed, 43 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 42ca926..7cca602 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -175,6 +175,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Please wait... software metadata still loading.</property>
<property name="halign">center</property>
<property name="border_width">6</property>
<property name="use_underline">True</property>
@@ -451,6 +452,7 @@
<property name="halign">center</property>
<property name="border_width">6</property>
<property name="use_underline">True</property>
+ <property name="tooltip_text" translatable="yes">Please wait... software metadata still loading.</property>
<signal name="clicked" handler="on_modify_sw_clicked" swapped="no"/>
</object>
<packing>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index db4887f..f8a7a54 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -38,7 +38,7 @@
"""
-from gi.repository import Gdk, Gtk
+from gi.repository import Gdk, GLib, Gtk
from gi.repository import AnacondaWidgets
from pyanaconda.ui.gui import GUIObject, communication
@@ -126,6 +126,10 @@ class InstallOptions1Dialog(GUIObject):
RESPONSE_RECLAIM = 3
RESPONSE_QUIT = 4
+ def __init__(self, *args, **kwargs):
+ self.payload = kwargs.pop("payload")
+ GUIObject.__init__(self, *args, **kwargs)
+
def run(self):
rc = self.window.run()
self.window.destroy()
@@ -162,6 +166,34 @@ class InstallOptions1Dialog(GUIObject):
% (productName, required_space_text))
return sw_text
+ # Methods to handle sensitivity of the modify button.
+ def _software_is_ready(self):
+ # FIXME: Would be nicer to just ask the spoke if it's ready.
+ return (not threadMgr.get("AnaPayloadThread") and
+ not threadMgr.get("AnaSoftwareWatcher") and
+ not threadMgr.get("AnaCheckSoftwareThread") and
+ self.payload.baseRepo is not None)
+
+ def _check_for_storage_thread(self, button):
+ if self._software_is_ready():
+ button.set_sensitive(True)
+ button.set_has_tooltip(False)
+ button.show_all()
+
+ # False means this function should never be called again.
+ return False
+ else:
+ return True
+
+ def _add_button_watcher(self, widgetName):
+ # If the payload fetching thread is still running, the user can't go to
+ # modify the software selection screen. Thus, we have to set the button
+ # insensitive and wait until software selection is ready to go.
+ modify_button = self.builder.get_object(widgetName)
+ if not self._software_is_ready():
+ modify_button.set_sensitive(False)
+ GLib.timeout_add_seconds(1, self._check_for_storage_thread, modify_button)
+
# signal handlers
def on_cancel_clicked(self, button):
# return to the spoke without making any changes
@@ -209,6 +241,8 @@ class InstallOptions2Dialog(InstallOptions1Dialog):
% productName)
self.builder.get_object("options2_label2").set_markup(label_text)
+ self._add_button_watcher("options2_modify_sw_button")
+
def on_custom_toggled(self, checkbutton):
super(InstallOptions2Dialog, self).on_custom_toggled(checkbutton)
self.builder.get_object("options2_cancel_button").set_sensitive(not self.custom)
@@ -240,6 +274,8 @@ class InstallOptions3Dialog(InstallOptions1Dialog):
"version of <b>%s</b>, or quit the installer.") % (productName, productName)
self.builder.get_object("options3_label2").set_markup(label_text)
+ self._add_button_watcher("options3_modify_sw_button")
+
class StorageChecker(object):
errors = []
warnings = []
@@ -565,9 +601,9 @@ class StorageSpoke(NormalSpoke, StorageChecker):
if disk_free + new_free >= required_space:
dialog = InstallOptions1Dialog(self.data)
elif disks_size >= required_space:
- dialog = InstallOptions2Dialog(self.data)
+ dialog = InstallOptions2Dialog(self.data, payload=self.payload)
else:
- dialog = InstallOptions3Dialog(self.data)
+ dialog = InstallOptions3Dialog(self.data, payload=self.payload)
dialog.refresh(required_space, disks_size, disk_free, fs_free, self.autopart)
rc = self.run_lightbox_dialog(dialog)
@@ -584,7 +620,8 @@ class StorageSpoke(NormalSpoke, StorageChecker):
print "user chose to continue disk selection"
elif rc == dialog.RESPONSE_MODIFY_SW:
# go to software spoke
- print "user chose to modify software selection"
+ self.skipTo = "SoftwareSelectionSpoke"
+ self.on_back_clicked(self.window)
elif rc == dialog.RESPONSE_RECLAIM:
if dialog.custom:
self.skipTo = "CustomPartitioningSpoke"
--
1.7.11.2
11 years, 7 months
[PATCH] Add a label to the resize dialog for how much space is required.
by Chris Lumens
I missed this in the initial mockup. Oops.
---
pyanaconda/ui/gui/spokes/lib/resize.glade | 18 ++++++++++++++----
pyanaconda/ui/gui/spokes/lib/resize.py | 6 +++++-
pyanaconda/ui/gui/spokes/storage.py | 2 +-
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 5c3b3e1..7ff1ea6 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -56,12 +56,10 @@
<child>
<object class="GtkButton" id="cancelButton">
<property name="label">gtk-cancel</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
- <property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
</object>
<packing>
@@ -73,12 +71,10 @@
<child>
<object class="GtkButton" id="resizeButton">
<property name="label" translatable="yes">_Reclaim space</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">end</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_resize_clicked" swapped="no"/>
</object>
@@ -244,6 +240,20 @@
<property name="position">4</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="requiredSpaceLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">end</property>
+ <property name="label" translatable="yes">Installation requires a single <b>%s</b> partition.</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index 35ac8d1..6fc649f 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -59,7 +59,7 @@ class ResizeDialog(GUIObject):
mainWidgetName = "resizeDialog"
uiFile = "spokes/lib/resize.glade"
- def __init__(self, data, storage):
+ def __init__(self, data, storage, payload):
GUIObject.__init__(self, data)
self.storage = storage
@@ -71,6 +71,10 @@ class ResizeDialog(GUIObject):
self._reclaimable_label = self.builder.get_object("reclaimableSpaceLabel")
self._selected_label = self.builder.get_object("selectedSpaceLabel")
+ self._required_label = self.builder.get_object("requiredSpaceLabel")
+ markup = self._required_label.get_label()
+ self._required_label.set_markup(markup % size_str(payload.spaceRequired))
+
def _description(self, part):
# First, try to find the partition in some known Root. If we find
# it, return the mountpoint as the description.
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index ac19c9b..db4887f 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -589,7 +589,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
if dialog.custom:
self.skipTo = "CustomPartitioningSpoke"
else:
- resizeDialog = ResizeDialog(self.data, self.storage)
+ resizeDialog = ResizeDialog(self.data, self.storage, self.payload)
resizeDialog.refresh(disks)
# resizeDialog handles okay/cancel on its own, so we can throw
--
1.7.11.2
11 years, 7 months
anaconda-arm-uboot-partition.patch
by d.marlin
I have rebased a patch Dennis Gilmore submitted in August,
https://lists.fedorahosted.org/pipermail/anaconda-patches/2012-August/000...
and made some minor modifications. This is just a 'draft' at this
point, but I would appreciate any feedback on the approach (if
acceptable) and suggestions for improvement. I understand that we will
need to subclass Bootloader to add U-Boot support, but wanted to see if
I was on the right track with the platform changes.
Also, I have been testing this using livemedia-creator in F17
(backported the changes). The storage definition in the kickstart file is:
bootloader --location=none
zerombr
clearpart --all
part /boot/uboot --size 200 --fstype vfat --asprimary --label=boot
part swap --size 500 --asprimary --label=swap
part / --size 2000 --fstype ext4 --label=rootfs
This appears to do what we want for the OMAP disk image. Should I be
doing anything else here to test the changes in platform (possibly using
autopart)?
Thank you,
d.marlin
11 years, 7 months
[PATCH 1/2] Rework the disk shopping cart link a little bit.
by Chris Lumens
This is to make way for the boot device picking option.
---
pyanaconda/ui/gui/spokes/storage.glade | 83 ++++++++++++++++------------------
pyanaconda/ui/gui/spokes/storage.py | 17 +++----
2 files changed, 49 insertions(+), 51 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 7e62593..42ca926 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -24,13 +24,11 @@
<child>
<object class="GtkButton" id="options1_cancel_button">
<property name="label" translatable="yes">Cancel & _add more disks</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_cancel_clicked" swapped="no"/>
</object>
@@ -43,14 +41,12 @@
<child>
<object class="GtkButton" id="options_continue_button1">
<property name="label" translatable="yes">_Continue</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_continue_clicked" swapped="no"/>
</object>
@@ -108,11 +104,9 @@
<child>
<object class="GtkCheckButton" id="options1_custom_check">
<property name="label" translatable="yes">Let me customize the _partitioning of the disks instead.</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -161,13 +155,11 @@
<child>
<object class="GtkButton" id="options2_cancel_button">
<property name="label" translatable="yes">Cancel & _add more disks</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_cancel_clicked" swapped="no"/>
</object>
@@ -180,13 +172,11 @@
<child>
<object class="GtkButton" id="options2_modify_sw_button">
<property name="label" translatable="yes">_Modify software selection</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_modify_sw_clicked" swapped="no"/>
</object>
@@ -200,14 +190,12 @@
<child>
<object class="GtkButton" id="options2_reclaim_button">
<property name="label" translatable="yes">Reclaim _space</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_reclaim_clicked" swapped="no"/>
</object>
@@ -251,11 +239,9 @@
<child>
<object class="GtkCheckButton" id="options2_custom_check">
<property name="label" translatable="yes">I don't need help; let me _review & customize disk partitioning to reclaim space.</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
@@ -442,13 +428,11 @@
<child>
<object class="GtkButton" id="options3_quit_button">
<property name="label" translatable="yes">_Quit installer</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_quit_clicked" swapped="no"/>
</object>
@@ -461,13 +445,11 @@
<child>
<object class="GtkButton" id="options3_modify_sw_button">
<property name="label" translatable="yes">_Modify software selection</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_modify_sw_clicked" swapped="no"/>
</object>
@@ -481,14 +463,12 @@
<child>
<object class="GtkButton" id="options3_cancel_button">
<property name="label" translatable="yes">_Cancel</property>
- <property name="use_action_appearance">False</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_focus">True</property>
<property name="receives_default">True</property>
<property name="halign">center</property>
<property name="border_width">6</property>
- <property name="use_action_appearance">False</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_cancel_clicked" swapped="no"/>
</object>
@@ -776,25 +756,45 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <object class="GtkBox" id="box2">
+ <object class="GtkGrid" id="grid3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">6</property>
<property name="margin_right">6</property>
<property name="margin_bottom">6</property>
- <property name="spacing">6</property>
+ <property name="row_spacing">6</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkButton" id="continue_button">
+ <property name="label" translatable="yes">_CONTINUE</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="halign">end</property>
+ <property name="valign">end</property>
+ <property name="hexpand">True</property>
+ <property name="use_underline">True</property>
+ <property name="xalign">1</property>
+ <signal name="clicked" handler="on_continue_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">2</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton" id="summary_button">
- <property name="label" translatable="yes">summary</property>
- <property name="use_action_appearance">False</property>
+ <property name="label" translatable="yes">Full disk summary and options...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
+ <property name="halign">start</property>
<property name="relief">none</property>
<property name="use_underline">True</property>
<property name="focus_on_click">False</property>
@@ -802,35 +802,32 @@
<signal name="clicked" handler="on_summary_clicked" swapped="no"/>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
<child>
- <object class="GtkButton" id="continue_button">
- <property name="label" translatable="yes">_CONTINUE</property>
- <property name="use_action_appearance">False</property>
+ <object class="GtkLabel" id="summary_label">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_action_appearance">False</property>
- <property name="use_underline">True</property>
- <property name="xalign">1</property>
- <signal name="clicked" handler="on_continue_clicked" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="margin_left">6</property>
+ <property name="label" translatable="yes">summary</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">1</property>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">4</property>
+ <property name="position">2</property>
</packing>
</child>
</object>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 535671e..3deeae2 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -413,8 +413,10 @@ class StorageSpoke(NormalSpoke, StorageChecker):
NormalSpoke.initialize(self)
- summary_label = self.builder.get_object("summary_button").get_children()[0]
- summary_label.set_use_markup(True)
+ label = self.builder.get_object("summary_button").get_children()[0]
+ markup = "<span foreground='blue'><u>%s</u></span>" % label.get_text()
+ label.set_use_markup(True)
+ label.set_markup(markup)
self.local_disks_box = self.builder.get_object("local_disks_box")
#specialized_disks_box = self.builder.get_object("specialized_disks_box")
@@ -482,12 +484,11 @@ class StorageSpoke(NormalSpoke, StorageChecker):
free += free_space[disk.name][0]
count += 1
- summary = (P_(("%d disk selected; %s capacity; %s free ..."),
- ("%d disks selected; %s capacity; %s free ..."),
+ summary = (P_(("%d disk selected; %s capacity; %s free"),
+ ("%d disks selected; %s capacity; %s free"),
count) % (count, str(Size(spec="%s MB" % capacity)), free))
- markup = "<span foreground='blue'><u>%s</u></span>" % summary
- summary_label = self.builder.get_object("summary_button").get_children()[0]
- summary_label.set_markup(markup)
+ summary_label = self.builder.get_object("summary_label")
+ summary_label.set_text(summary)
if count == 0:
self.window.set_info(Gtk.MessageType.WARNING, _("No disks selected; please select at least one disk to install to."))
@@ -495,7 +496,7 @@ class StorageSpoke(NormalSpoke, StorageChecker):
self.window.clear_info()
self.builder.get_object("continue_button").set_sensitive(count > 0)
- self.builder.get_object("summary_button").set_sensitive(count > 0)
+ self.builder.get_object("summary_label").set_sensitive(count > 0)
def _update_disk_list(self):
""" Update self.selected_disks based on the UI. """
--
1.7.11.2
11 years, 7 months
[PATCH] Fix parsing of NFS method strings (#860966)
by Jesse Keating
iutil wants the whole string, including the nfs: part.
---
anaconda | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/anaconda b/anaconda
index 411bb07..c2d246d 100755
--- a/anaconda
+++ b/anaconda
@@ -869,8 +869,7 @@ if __name__ == "__main__":
ksdata.method.method = "cdrom"
elif anaconda.methodstr.startswith("nfs"):
ksdata.method.method = "nfs"
- url = anaconda.methodstr.split(":", 1)[1]
- (options, server, path) = iutil.parseNfsUrl(url)
+ (options, server, path) = iutil.parseNfsUrl(anaconda.methodstr)
ksdata.method.server = server
ksdata.method.dir = path
ksdata.method.opts = options
--
1.7.11.4
11 years, 7 months
[PATCH] update to use firewalld (#815540)
by Brian C. Lane
From: "Brian C. Lane" <bcl(a)redhat.com>
NOTE: This depends on firewalld changes and will be held until they are pushed.
---
pyanaconda/__init__.py | 4 +-
pyanaconda/firewall.py | 80 ----------------------------------
pyanaconda/install.py | 3 +-
pyanaconda/kickstart.py | 32 ++++++++++++++
tests/pyanaconda_test/firewall_test.py | 41 -----------------
5 files changed, 35 insertions(+), 125 deletions(-)
delete mode 100644 pyanaconda/firewall.py
delete mode 100644 tests/pyanaconda_test/firewall_test.py
diff --git a/pyanaconda/__init__.py b/pyanaconda/__init__.py
index 8948fdb..4abca2e 100644
--- a/pyanaconda/__init__.py
+++ b/pyanaconda/__init__.py
@@ -43,7 +43,7 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
class Anaconda(object):
def __init__(self):
- import desktop, firewall
+ import desktop
from flags import flags
self._backend = None
@@ -53,7 +53,6 @@ class Anaconda(object):
self.dir = None
self.displayMode = None
self.extraModules = []
- self.firewall = firewall.Firewall()
self.id = None
self._instClass = None
self._intf = None
@@ -242,4 +241,3 @@ class Anaconda(object):
network.disableNMForStorageDevices(self.storage)
network.autostartFCoEDevices(self.storage)
self.desktop.write()
- self.firewall.write()
diff --git a/pyanaconda/firewall.py b/pyanaconda/firewall.py
deleted file mode 100644
index 5e82cba..0000000
--- a/pyanaconda/firewall.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#
-# firewall.py - firewall install data and installation
-#
-# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 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 General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-# Author(s): Bill Nottingham <notting(a)redhat.com>
-# Jeremy Katz <katzj(a)redhat.com>
-#
-
-import iutil
-import os.path
-from flags import flags
-from constants import *
-
-import gettext
-_ = lambda x: gettext.ldgettext("anaconda", x)
-
-import logging
-log = logging.getLogger("anaconda")
-
-class Firewall:
- def __init__ (self):
- self.enabled = 1
- self.trustdevs = []
- self.portlist = []
- self.servicelist = []
-
- def getArgList(self):
- args = []
-
- if not self.enabled:
- args.append("--disabled")
- return args
-
- if not "ssh" in self.servicelist and not "22:tcp" in self.portlist:
- args += ["--service=ssh"]
-
- for dev in self.trustdevs:
- args = args + [ "--trust=%s" %(dev,) ]
-
- for port in self.portlist:
- args = args + [ "--port=%s" %(port,) ]
-
- for service in self.servicelist:
- args = args + [ "--service=%s" % (service,) ]
-
- return args
-
- def write (self):
- args = [ "--quiet", "--nostart", "-f" ] + self.getArgList()
-
- try:
- if not os.path.exists("%s/etc/sysconfig/iptables" %(ROOT_PATH,)):
- iutil.execWithRedirect("/usr/sbin/lokkit", args,
- root=ROOT_PATH, stdout="/dev/null",
- stderr="/dev/null")
- else:
- log.error("would have run %s", args)
- except (RuntimeError, OSError) as msg:
- log.error ("lokkit run failed: %s", msg)
- else:
- f = open(ROOT_PATH +
- '/etc/sysconfig/system-config-firewall', 'w')
- f.write("# system-config-firewall config written out by anaconda\n\n")
- for arg in args[3:]:
- f.write("%s\n" %(arg,))
- f.close()
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index b716364..3192862 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -58,6 +58,7 @@ def doConfiguration(storage, payload, ksdata, instClass):
ksdata.keyboard.execute(storage, ksdata, instClass)
ksdata.timezone.execute(storage, ksdata, instClass)
ksdata.lang.execute(storage, ksdata, instClass)
+ ksdata.firewall.execute(storage, ksdata, instClass)
with progress_report(_("Writing network configuration")):
writeNetworkConf(storage, ksdata, instClass)
@@ -107,7 +108,7 @@ def doInstall(storage, payload, ksdata, instClass):
# anaconda requires storage packages in order to make sure the target
# system is bootable and configurable, and some other packages in order
# to finish setting up the system.
- packages = storage.packages + ["authconfig", "system-config-firewall-base"]
+ packages = storage.packages + ["authconfig", "firewalld"]
payload.preInstall(packages=packages, groups=payload.languageGroups(ksdata.lang.lang))
payload.install()
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 18b04c0..639527c 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -452,6 +452,37 @@ class Fcoe(commands.fcoe.F13_Fcoe):
return fc
+class Firewall(commands.firewall.F14_Firewall):
+ def execute(self, storage, ksdata, instClass):
+ args = []
+ # enabled is None is neither --enable or --disable is passed
+ # default to enabled if nothing has been set.
+ if self.enabled == False:
+ args += ["--disabled"]
+ else:
+ args += ["--enabled"]
+
+ if not "ssh" in self.services and not "22:tcp" in self.ports:
+ args += ["--service=ssh"]
+
+ for dev in self.trusts:
+ args += [ "--trust=%s" % (dev,) ]
+
+ for port in self.ports:
+ args += [ "--port=%s" % (port,) ]
+
+ for service in self.services:
+ args += [ "--service=%s" % (service,) ]
+
+ cmd = "/usr/bin/firewall-convert-scfw-config"
+ if not os.path.exists(ROOT_PATH+cmd):
+ msg = _("%s is missing. Cannot setup firewall.") % (cmd,)
+ raise KickstartError(msg)
+ else:
+ iutil.execWithRedirect(cmd, args,
+ stdout="/dev/tty5", stderr="/dev/tty5",
+ root=ROOT_PATH)
+
class Firstboot(commands.firstboot.FC3_Firstboot):
def execute(self, *args):
if not os.path.exists(ROOT_PATH + "/lib/systemd/system/firstboot-graphical.service"):
@@ -1385,6 +1416,7 @@ commandMap = {
"clearpart": ClearPart,
"dmraid": DmRaid,
"fcoe": Fcoe,
+ "firewall": Firewall,
"firstboot": Firstboot,
"group": Group,
"ignoredisk": IgnoreDisk,
diff --git a/tests/pyanaconda_test/firewall_test.py b/tests/pyanaconda_test/firewall_test.py
deleted file mode 100644
index 19c4554..0000000
--- a/tests/pyanaconda_test/firewall_test.py
+++ /dev/null
@@ -1,41 +0,0 @@
-import mock
-
-class FirewallTest(mock.TestCase):
- def setUp(self):
- self.setupModules(["_isys", "block", "ConfigParser"])
-
- self.fs = mock.DiskIO()
-
- import pyanaconda.firewall
-
- self.modifiedModule("pyanaconda.firewall")
- self.modifiedModule("os.path")
-
- pyanaconda.firewall.open = self.fs.open
- pyanaconda.firewall.log = mock.Mock()
- pyanaconda.firewall.iutil = mock.Mock()
- pyanaconda.firewall.os = mock.Mock()
- pyanaconda.firewall.os.path = mock.Mock()
- pyanaconda.firewall.os.path.exists = self.fs.os_path_exists
-
- def tearDown(self):
- self.tearDownModules()
-
- def default_write_test(self):
- import pyanaconda.firewall
- fw = pyanaconda.firewall.Firewall()
- fw.write()
-
- self.assertEqual(pyanaconda.firewall.iutil.method_calls, [
- ("execWithRedirect",
- (
- "/usr/sbin/lokkit",
- [ "--quiet", "--nostart", "-f", "--service=ssh" ]
- ),
- {
- "root": "/mnt/sysimage",
- "stdout": "/dev/null",
- "stderr": "/dev/null",
- }
- )
- ])
--
1.7.11.4
11 years, 7 months
various patches
by David Lehman
This set contains fixes for a few specifig bug reports and for several
bugs encountered while adding UI support for encrypted block devices.
pyanaconda/bootloader.py | 2 +-
pyanaconda/storage/__init__.py | 5 ++-
pyanaconda/ui/gui/spokes/custom.glade | 53 ++++++++++++++++++++++++++++-----
pyanaconda/ui/gui/spokes/custom.py | 8 ++++-
pyanaconda/ui/gui/spokes/storage.py | 11 +++++--
scripts/makeupdates | 12 ++++---
6 files changed, 72 insertions(+), 19 deletions(-)
11 years, 7 months
[PATCH] Add in a locale mapping to avoid incorrect system settings (#858591).
by Chris Lumens
This is pretty terrible, sorry.
Basically the problem is that we need to write out full locale settings to
/etc/sysconfig/i18n or lots and lots of things on the system are broken.
For instance, "de_DE.UTF-8" is good but "de.UTF-8" is not.
Unfortunately I can find no suitable way to extract this information via
python-babel. I think our intention is that using geoip will get us the
full locale, but there's no time to do that now. lang-table used to contain
this mapping for us, but I really don't want to add that file back. This
fix should be considered temporary.
---
pyanaconda/localization.py | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/localization.py b/pyanaconda/localization.py
index e4b9b40..3d2bdc8 100644
--- a/pyanaconda/localization.py
+++ b/pyanaconda/localization.py
@@ -100,6 +100,26 @@ class LocaleInfo(object):
def __eq__(self, other):
return repr(self) == repr(other)
+def mangleLocale(inLocale):
+ mangleMap = {"af": "af_ZA", "am": "am_ET", "ar": "ar_SA", "as": "as_IN",
+ "ast": "ast_ES", "bg": "bg_BG", "bn": "bn_BD", "ca": "ca_ES",
+ "cs": "cs_CZ", "cy": "cy_GB", "da": "da_DK", "de": "de_DE",
+ "el": "el_GR", "en": "en_US", "es": "es_ES", "et": "et_EE",
+ "fa": "fa_IR", "fi": "fi_FI", "fr": "fr_FR", "gl": "gl_ES",
+ "gu": "gu_IN", "he": "he_IL", "hi": "hi_IN", "hr": "hr_HR",
+ "hu": "hu_HU", "id": "id_ID", "ilo": "ilo_PH", "is": "is_IS",
+ "it": "it_IT", "ja": "ja_JP", "kk": "kk_KK", "kn": "kn_IN",
+ "ko": "ko_KR", "lt": "lt_LT", "lv": "lv_LV", "mai": "mai_IN",
+ "mk": "mk_MK", "ml": "ml_IN", "mr": "mr_IN", "ms": "ms_MY",
+ "nb": "nb_NO", "nds": "nds_DE", "ne": "ne_NP", "nl": "nl_NL",
+ "nn": "nn_NO", "nso": "nso_ZA", "or": "or_IN", "pa": "pa_IN",
+ "pl": "pl_PL", "pt": "pt_PT", "ro": "ro_RO", "ru": "ru_RU",
+ "si": "si_LK", "sk": "sk_SK", "sl": "sl_SI", "sq": "sq_AL",
+ "sr": "sr_RS", "sv": "sv_SE", "ta": "ta_IN", "te": "te_IN",
+ "tg": "tg_TG", "th": "th_TH", "tr": "tr_TR", "uk": "uk_UA",
+ "ur": "ur_PK", "vi": "vi_VN", "zu": "zu_ZA"}
+
+ return mangleMap.get(inLocale, inLocale)
# XXX this should probably be somewhere else
def partition(seq, func=bool, func_range=(True, False)):
@@ -144,7 +164,7 @@ def get_available_translations(domain=None, localedir=None):
for langcode in languages:
try:
- localedata = babel.Locale.parse(langcode)
+ localedata = babel.Locale.parse(mangleLocale(langcode))
except babel.core.UnknownLocaleError:
continue
@@ -268,8 +288,8 @@ class Language(object):
def __init__(self, preferences={}, territory=None):
self.translations = {repr(locale):locale for locale in get_available_translations()}
self.locales = {repr(locale):locale for locale in get_all_locales()}
- self.preferred_translation = self.translations['en.UTF-8']
- self.preferred_locales = [self.locales['en.UTF-8']]
+ self.preferred_translation = self.translations['en_US.UTF-8']
+ self.preferred_locales = [self.locales['en_US.UTF-8']]
self.preferred_locale = self.preferred_locales[0]
self.all_preferences = preferences
--
1.7.11.2
11 years, 7 months
RE: cannot find the hard drive for bios disk 80
by B_B_Singh@DELL.com
I didn't receive any comment or update on this patch, please let me know if anything is wrong from my side.
Regards
Balaji Singh
From: Singh, B B
Sent: Friday, September 28, 2012 10:52 AM
To: 'anaconda-patches(a)lists.fedorahosted.org'
Subject: cannot find the hard drive for bios disk 80
Hi,
Implementing a delay algorithm for slow bios storage devices,
When I boot anaconda with ks=hd:<dev>:<path> there is an algorithm to retry up to 5 times or 31 seconds for some USB thumb drives and hard drives which are initialized slow.
such algorithm is not available in the code path when booted with the option "ks=bd:device:/path/to/ks.cfg".
Find a patch in the attachment in which I have added similar algorithm for the slow bios storage devices.
Regards
Balaji Singh
11 years, 7 months