[node-patches] Change in ovirt-node[master]: Make ovirt-node-config run [<CLASS>[.<FUNC> [<ARG> [<ARG>] ....

hadong0720 at gmail.com hadong0720 at gmail.com
Tue Mar 4 08:23:14 UTC 2014


hadong has uploaded a new change for review.

Change subject: Make ovirt-node-config run [<CLASS>[.<FUNC> [<ARG> [<ARG>] ...]]]] work
......................................................................

Make ovirt-node-config run [<CLASS>[.<FUNC> [<ARG> [<ARG>] ...]]]] work

Previously ovirt-node-config run [<CLASS>[.<FUNC> [<ARG> [<ARG>] ...]]]] didn't
real work.
eg:
./ovirt-node-config r KDump.configure_local
<bound method KDump.configure_local of <ovirt.node.config.defaults.KDump object at 0x36ccf10>>
Configuring kdump
-----------------
Checking pre-conditions ...
(1/2) Backing up config files
(2/2) Removing kdump backup

All changes were applied successfully.
it will configure kdump with disable type, not configure with local type

Change-Id: I04e20097b5f03412d4396fddca98a54f13bab156
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M scripts/ovirt-node-config
1 file changed, 12 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/00/25300/1

diff --git a/scripts/ovirt-node-config b/scripts/ovirt-node-config
index c9d0c14..918a8ee 100755
--- a/scripts/ovirt-node-config
+++ b/scripts/ovirt-node-config
@@ -16,9 +16,16 @@
 def print_func_usage(func, with_doc=True):
     args = inspect.getargspec(func).args[1:]
     txtargs = " ".join("<%s>" % s.upper() for s in args)
-    if with_doc:
+    if with_doc and inspect.getdoc(func):
         txtargs += "\n" + inspect.getdoc(func)
     return txtargs
+
+def list_func_usage(func, customer_args):
+    args = inspect.getargspec(func).args[1:]
+    args_dict = {}
+    for index, item in enumerate(customer_args):
+        args_dict[args[index]] = item
+    return args_dict
 
 def list_classes(module):
     def valid_member(x):
@@ -38,8 +45,10 @@
     funcs = list_funcs(cfg)
     func = funcs[func]
     print func
+    usage = list_func_usage(func, args)
+    func(**usage)
     tx = cfg.transaction()
-    TransactionProgress(tx, is_dry=True).run()
+    TransactionProgress(tx, is_dry=False).run()
 
 def split_clsfunc(clsfunc):
     cls, func = clsfunc, None
@@ -56,7 +65,7 @@
 
     (options, args) = parser.parse_args()
 
-    if len(args) >= 1:
+    if len(args) > 1:
         cmd = args[0]
         if cmd[0] == "h":
             cls, func = split_clsfunc(args[1])


-- 
To view, visit http://gerrit.ovirt.org/25300
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04e20097b5f03412d4396fddca98a54f13bab156
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list