[node-patches] Change in ovirt-node[master]: Extend system.utils.Bootloader to take a path and args
rbarry at redhat.com
rbarry at redhat.com
Mon Sep 29 19:58:17 UTC 2014
Ryan Barry has uploaded a new change for review.
Change subject: Extend system.utils.Bootloader to take a path and args
......................................................................
Extend system.utils.Bootloader to take a path and args
For comparison purposes in the installer, maek it a little more
configurable
Change-Id: Id65392d5d314c046c5dfd3927d4f79e416b97ac0
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/utils/system.py
1 file changed, 16 insertions(+), 7 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/08/33508/1
diff --git a/src/ovirt/node/utils/system.py b/src/ovirt/node/utils/system.py
index 5955a8b..576a84b 100644
--- a/src/ovirt/node/utils/system.py
+++ b/src/ovirt/node/utils/system.py
@@ -955,9 +955,12 @@
class Arguments(base.Base):
- def __init__(self, dry=False):
+ def __init__(self, dry=False, path=None):
if not dry:
- self.__handle = Bootloader.find_grub_cfg()
+ if not path:
+ self.__handle = Bootloader.find_grub_cfg()
+ else:
+ self.__handle = File(path)
self.__mount = Mount.find_by_path(self.__handle.filename)
self.items = self.__get_arguments()
@@ -968,11 +971,12 @@
lines = [line for line in self.__handle]
return lines
- def __get_arguments(self):
- kernel = [line for line in self.__get_lines() if
- re.match(r'[^#].*?vmlinuz', line)][0]
- kernel = re.sub(r'^\s*?(kernel|linux)\s+?\/vmlinuz.*?\s+', '',
- kernel)
+ def __get_arguments(self, kernel=None):
+ if not kernel:
+ kernel = [line for line in self.__get_lines() if
+ re.match(r'[^#].*?vmlinuz', line)][0]
+ kernel = re.sub(r'^\s*?(kernel|linux)\s+?\/vmlinuz.*?\s+', '',
+ kernel)
params = {}
for param in kernel.split():
match = re.match(r'(.*?)=(.*)', param)
@@ -983,6 +987,11 @@
self.items = params
return params
+ def dry_arguments(self, line):
+ if not "vmlinuz" in line:
+ line = "vmlinuz " + line
+ return self.__get_arguments(kernel=line)
+
def __getitem__(self, key):
if re.match(r'^(.*?)=', key):
argument = re.match(r'^(.*?)=', key).groups()[0]
--
To view, visit http://gerrit.ovirt.org/33508
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id65392d5d314c046c5dfd3927d4f79e416b97ac0
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>
More information about the node-patches
mailing list