[node-patches] Change in ovirt-node[master]: [DRAFT] Migrate to localectl (if possible)
fabiand at fedoraproject.org
fabiand at fedoraproject.org
Fri Apr 12 12:53:40 UTC 2013
Fabian Deutsch has uploaded a new change for review.
Change subject: [DRAFT] Migrate to localectl (if possible)
......................................................................
[DRAFT] Migrate to localectl (if possible)
localectl is a tool which allows to configure the locale.
This patch migrates away from sysconfig towards localectl.
Legacy scripts (like the old UI) are not migrated.
rhbz#882206
Change-Id: Ieffc7915da82da7b5558d96e9c70e83d50108985
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/ovirtnode/ovirtfunctions.py
M scripts/tui/src/ovirt/node/config/defaults.py
M scripts/tui/src/ovirt/node/utils/system.py
3 files changed, 15 insertions(+), 9 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/37/13837/1
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index bc41cd9..88d8687 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -37,6 +37,8 @@
import logging
import grp
import pwd
+from ovirt.node.config import defaults
+from ovirt.node.utils import system
OVIRT_CONFIG="/config"
OVIRT_LOGFILE="/var/log/ovirt.log"
@@ -1075,8 +1077,10 @@
ovirt_store_config(f)
ovirt_store_config("%s.pub" % f)
# store keyboard config
- ovirt_store_config("/etc/sysconfig/keyboard")
- ovirt_store_config("/etc/vconsole.conf")
+ kbdcfg = defaults.Keyboard()
+ kbdtx = kbdcfg.transaction()
+ kbdtx()
+
ovirt_store_config("/var/lib/random-seed")
return True
@@ -1660,10 +1664,8 @@
return True
def load_keyboard_config():
- import system_config_keyboard.keyboard as keyboard
- kbd = keyboard.Keyboard()
- kbd.read()
- kbd.activate()
+ kbd = system.Keyboard()
+ kbd.reactivate()
def is_engine_configured():
'''
diff --git a/scripts/tui/src/ovirt/node/config/defaults.py b/scripts/tui/src/ovirt/node/config/defaults.py
index 0f905c3..06f066a 100644
--- a/scripts/tui/src/ovirt/node/config/defaults.py
+++ b/scripts/tui/src/ovirt/node/config/defaults.py
@@ -1085,8 +1085,8 @@
from ovirtnode.ovirtfunctions import ovirt_store_config
kbd = utils.system.Keyboard()
kbd.set_layout(layout)
- ovirt_store_config(["/etc/sysconfig/keyboard",
- "/etc/vconsole.conf"])
+ ovirt_store_config("/etc/vconsole.conf")
+ ovirt_store_config("/etc/sysconfig/keyboard")
tx = utils.Transaction("Configuring keyboard layout")
tx.append(CreateKeyboardConfig())
diff --git a/scripts/tui/src/ovirt/node/utils/system.py b/scripts/tui/src/ovirt/node/utils/system.py
index 7a119ff..7c5a770 100644
--- a/scripts/tui/src/ovirt/node/utils/system.py
+++ b/scripts/tui/src/ovirt/node/utils/system.py
@@ -198,13 +198,14 @@
"""Configure the system wide keyboard layout
FIXME what is the recommended way to do this on F18+ with localectl
localectl also stores the changes, so is kbd still needed?
+ localectl doesn't offer the descriptive name of the layouts
"""
def __init__(self):
super(Keyboard, self).__init__()
self.kbd = system_config_keyboard.keyboard.Keyboard()
+ self.kbd.read()
def available_layouts(self):
- self.kbd.read()
layoutgen = ((details[0], kbid)
for kbid, details in self.kbd.modelDict.items())
layouts = [(kid, name) for name, kid in sorted(layoutgen)]
@@ -216,6 +217,9 @@
self.kbd.activate()
utils.process.check_call("localectl set-keymap %s" % layout)
+ def reactivate(self):
+ self.kbd.activate()
+
def get_current(self):
return self.kbd.get()
--
To view, visit http://gerrit.ovirt.org/13837
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ieffc7915da82da7b5558d96e9c70e83d50108985
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>
More information about the node-patches
mailing list