[rhel7-branch][PATCH] Improve how we set the default screen height in text mode (#1184378)
by Vratislav Podzimek
We can either use given value or try to use the $LINES environment variable or
use the default which should be 24 lines because that's what serial consoles use
(see the bug).
Also fix the line counting when printing long widgets so that there are no gaps
(missing lines).
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/constants_text.py | 3 +++
pyanaconda/ui/tui/simpleline/base.py | 17 +++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/pyanaconda/constants_text.py b/pyanaconda/constants_text.py
index 750a984..9fb5e03 100644
--- a/pyanaconda/constants_text.py
+++ b/pyanaconda/constants_text.py
@@ -56,3 +56,6 @@ TEXT_NO_BUTTON = Translator(TEXT_NO_STR, TEXT_NO_CHECK)
# Make the return calls from the UIScreen input() function more clear
INPUT_PROCESSED = None
INPUT_DISCARDED = False
+
+# default screen height in number of lines (24 lines is the default for serial consoles)
+DEFAULT_SCREEN_HEIGHT = 24
diff --git a/pyanaconda/ui/tui/simpleline/base.py b/pyanaconda/ui/tui/simpleline/base.py
index 6371b93..c4fe736 100644
--- a/pyanaconda/ui/tui/simpleline/base.py
+++ b/pyanaconda/ui/tui/simpleline/base.py
@@ -22,6 +22,7 @@
__all__ = ["App", "UIScreen", "Widget"]
import sys
+import os
import Queue
import getpass
import threading
@@ -30,6 +31,7 @@ from pyanaconda.threads import threadMgr, AnacondaThread
from pyanaconda.ui.communication import hubQ
from pyanaconda import constants, iutil
from pyanaconda.i18n import _, N_, C_
+from pyanaconda.constants_text import DEFAULT_SCREEN_HEIGHT
RAW_INPUT_LOCK = threading.Lock()
@@ -491,17 +493,24 @@ class UIScreen(object):
# title line of the screen
title = u"Screen.."
- def __init__(self, app, screen_height = 25):
+ def __init__(self, app, screen_height=0):
"""
:param app: reference to application main class
:type app: instance of class App
:param screen_height: height of the screen (useful for printing long widgets)
+ or 0 to use the default
:type screen_height: int
"""
self._app = app
- self._screen_height = screen_height
+
+ if screen_height > 0:
+ self._screen_height = screen_height
+ elif "LINES" in os.environ:
+ self._screen_height = os.environ["LINES"]
+ else:
+ self._screen_height = DEFAULT_SCREEN_HEIGHT
# list that holds the content to be printed out
self._window = []
@@ -563,10 +572,10 @@ class UIScreen(object):
# prompt (2 lines)
for line in lines[pos:]:
print(line)
- pos += self._screen_height - 1
+ pos += self._screen_height - 2
else:
# print part with a prompt to continue
- for line in lines[pos:(pos + self._screen_height - 2)]:
+ for line in lines[pos:(pos + self._screen_height - 1)]:
print(line)
self._app.raw_input(_("Press ENTER to continue"))
pos += self._screen_height - 1
--
2.1.0
8 years, 10 months
[PATCH] Add an optional conditional to progress_report.
by Chris Lumens
This is to get rid of a little of the indentation in install.py and make it look
a bit neater.
---
pyanaconda/install.py | 20 ++++++++------------
pyanaconda/progress.py | 11 +++++++----
2 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 4f83a15..087bfa8 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -89,9 +89,8 @@ def doConfiguration(storage, payload, ksdata, instClass):
ksdata.xconfig.execute(storage, ksdata, instClass)
ksdata.skipx.execute(storage, ksdata, instClass)
- if willWriteNetwork:
- with progress_report(_("Writing network configuration")):
- ksdata.network.execute(storage, ksdata, instClass)
+ with progress_report(_("Writing network configuration"), cond=lambda: willWriteNetwork):
+ ksdata.network.execute(storage, ksdata, instClass)
# Creating users and groups requires some pre-configuration.
with progress_report(_("Creating users")):
@@ -115,9 +114,8 @@ def doConfiguration(storage, payload, ksdata, instClass):
and (not ksdata.bootloader.disabled and ksdata.bootloader != "none"):
writeBootLoader(storage, payload, instClass, ksdata)
- if willRunRealmd:
- with progress_report(_("Joining realm: %s") % ksdata.realm.discovered):
- ksdata.realm.execute(storage, ksdata, instClass)
+ with progress_report(_("Joining realm: %s") % ksdata.realm.discovered, cond=lambda: willRunRealmd):
+ ksdata.realm.execute(storage, ksdata, instClass)
with progress_report(_("Running post-installation scripts")):
runPostScripts(ksdata.scripts)
@@ -209,9 +207,8 @@ def doInstall(storage, payload, ksdata, instClass):
# Discover information about realms to join,
# to determine additional packages
- if willRunRealmd:
- with progress_report(_("Discovering realm to join")):
- ksdata.realm.setup()
+ with progress_report(_("Discovering realm to join"), cond=lambda: willRunRealmd):
+ ksdata.realm.setup()
# Check for additional packages
ksdata.authconfig.setup()
@@ -243,9 +240,8 @@ def doInstall(storage, payload, ksdata, instClass):
payload.writeStorageLate()
# Do bootloader.
- if willInstallBootloader:
- with progress_report(_("Installing boot loader")):
- writeBootLoader(storage, payload, instClass, ksdata)
+ with progress_report(_("Installing boot loader"), cond=lambda: willInstallBootloader):
+ writeBootLoader(storage, payload, instClass, ksdata)
with progress_report(_("Performing post-installation setup tasks")):
payload.postInstall()
diff --git a/pyanaconda/progress.py b/pyanaconda/progress.py
index f1d20ad..4594361 100644
--- a/pyanaconda/progress.py
+++ b/pyanaconda/progress.py
@@ -43,11 +43,14 @@ progressQ.addMessage("quit", 1) # exit_code
# Surround a block of code with progress updating. Before the code runs, the
# message is updated so the user can tell what's about to take so long.
# Afterwards, the progress bar is updated to reflect that the task is done.
+# An optional conditional can be given, in which case it must pass for the
+# block to be executed.
@contextmanager
-def progress_report(message):
- progress_message(message)
- yield
- progress_step(message)
+def progress_report(message, cond=None):
+ if not cond or cond():
+ progress_message(message)
+ yield
+ progress_step(message)
def progress_message(message):
progressQ.send_message(message)
--
2.4.3
8 years, 10 months
[PATCH master] network: don't set onboot=False for default autoconnections (#1212009)
by Radek Vykydal
Default autoconnections are created by NM for devices without ifcfg config
(that would be created based on boot configuration or kickstart). Changing the
value to False is causing that the device is not autoactivated at the beginning
of the installation due to race when anaconda is starting faster then NM.
---
pyanaconda/network.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index 51f29d9..c7ba0cd 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -281,8 +281,6 @@ def dumpMissingDefaultIfcfgs():
try:
nm.nm_update_settings_of_device(devname, [['connection', 'id', devname, None]])
log.debug("network: dumping ifcfg file for default autoconnection on %s", devname)
- nm.nm_update_settings_of_device(devname, [['connection', 'autoconnect', False, None]])
- log.debug("network: setting autoconnect of %s to False", devname)
except nm.SettingsNotFoundError:
log.debug("network: no ifcfg file for %s", devname)
rv.append(devname)
--
1.9.3
8 years, 10 months
New: [rhinstaller/blivet/pulls/167 master] Master format copy b
by dashea
This is an alternative to #165. The approach is to deepcopy all format objects when copying, instead of to define an ```__copy__``` method that handles tasks specially.
The first two patches are the same as in #165.
It's tested, in that I tried an experiment whereby I made a deep copy of all formats objects in fstesting.py and ran all tests on the deepcopy, rather than the original format object, and they all passed. Using copy, instead of deepcopy, they all failed. Using copy, and overriding ```__copy__``` in FS, they all passed.
It should be noted that format objects are already deep copied, rather than shallow copied, in actionlist.
--
To view this pull request on github, visit https://github.com/rhinstaller/blivet/pull/167
8 years, 10 months
[PATCH lorax rhel7-branch] network: turn slaves autoconnection on
by Radek Vykydal
So we can activate master connection instead of searching for and activating
slave connections.
Related: rhbz#1172751
---
share/config_files/common/91-anaconda-autoconnect-slaves.conf | 2 ++
share/runtime-postinstall.tmpl | 1 +
2 files changed, 3 insertions(+)
create mode 100644 share/config_files/common/91-anaconda-autoconnect-slaves.conf
diff --git a/share/config_files/common/91-anaconda-autoconnect-slaves.conf b/share/config_files/common/91-anaconda-autoconnect-slaves.conf
new file mode 100644
index 0000000..f9c81e6
--- /dev/null
+++ b/share/config_files/common/91-anaconda-autoconnect-slaves.conf
@@ -0,0 +1,2 @@
+[connection]
+connection.autoconnect-slaves=1
diff --git a/share/runtime-postinstall.tmpl b/share/runtime-postinstall.tmpl
index ef39563..8ad6273 100644
--- a/share/runtime-postinstall.tmpl
+++ b/share/runtime-postinstall.tmpl
@@ -57,6 +57,7 @@ install ${configdir}/libuser.conf etc
install ${configdir}/sysctl.conf etc/sysctl.d/anaconda.conf
mkdir etc/NetworkManager/conf.d
install ${configdir}/90-anaconda-no-auto-default.conf etc/NetworkManager/conf.d
+install ${configdir}/91-anaconda-autoconnect-slaves.conf etc/NetworkManager/conf.d
%if exists(root+"/etc/selinux/targeted"):
install ${configdir}/selinux.config etc/selinux/config
%endif
--
1.9.3
8 years, 10 months
[PATCH 1/2 rhel7-branch] network: GUI, add connection even when virtual device activation failed (#1179276)
by Radek Vykydal
Resolves: rhbz#1179276
---
pyanaconda/ui/gui/spokes/network.py | 47 +++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a89001f..5a84996 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -351,6 +351,8 @@ class NetworkControlBox(GObject.GObject):
self._updating_device = False
self.client = NMClient.Client.new()
+ self.remote_settings = NMClient.RemoteSettings()
+ self.remote_settings.connect("new-connection", self.on_new_connection)
# devices list
# limited to wired and wireless
@@ -421,29 +423,37 @@ class NetworkControlBox(GObject.GObject):
col.set_expand(True)
treeview.append_column(col)
+ def add_connection_to_list(self, uuid):
+ if self.dev_cfg(uuid=uuid):
+ log.debug("network: GUI, not adding connection %s, already in list", uuid)
+ return False
+ dev_cfg = DeviceConfiguration(con_uuid=uuid)
+ if dev_cfg.setting_value("connection", "read-only"):
+ log.debug("network: GUI, not adding read-only connection %s", uuid)
+ return False
+ if dev_cfg.device_type not in self.supported_device_types:
+ log.debug("network: GUI, not adding connection %s of unsupported type", uuid)
+ return False
+ # Configs for ethernet has been already added,
+ # this must be some slave
+ if dev_cfg.device_type == NetworkManager.DeviceType.ETHERNET:
+ log.debug("network: GUI, not adding slave connection %s", uuid)
+ return False
+ # Wireless settings are handled in scope of its device's dev_cfg
+ if dev_cfg.device_type == NetworkManager.DeviceType.WIFI:
+ log.debug("network: GUI, not adding wireless connection %s", uuid)
+ return False
+ self.add_dev_cfg(dev_cfg)
+ log.debug("network: GUI, adding connection %s", uuid)
+ return True
+
def initialize(self):
for device in self.client.get_devices():
self.add_device_to_list(device)
for setting in nm.nm_get_all_settings():
uuid = setting["connection"]["uuid"]
- log.debug("network: GUI, connection %s found", uuid)
- if self.dev_cfg(uuid=uuid):
- continue
- if setting["connection"].get("read-only", False):
- 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,
- # this must be some slave.
- if dev_cfg.device_type == NetworkManager.DeviceType.ETHERNET:
- continue
- # Wireless settings are handled in scope of its device's dev_cfg
- if dev_cfg.device_type == NetworkManager.DeviceType.WIFI:
- continue
- # Virtual device settings (bond, team, vlan, ...)
- self.add_dev_cfg(dev_cfg)
+ self.add_connection_to_list(uuid)
# select the first device
treeview = self.builder.get_object("treeview_devices")
@@ -517,6 +527,9 @@ class NetworkControlBox(GObject.GObject):
self.client.add_and_activate_connection(None, dev_cfg.device, ap_obj_path,
None, None)
+ def on_new_connection(self, remote_settings, connection):
+ self.add_connection_to_list(connection.get_uuid())
+
def on_device_added(self, client, device, *args):
self.add_device_to_list(device)
--
1.9.3
8 years, 10 months