[node-patches] Change in ovirt-node[ovirt-3.6]: edit-node: Add --comment option

dougsland at redhat.com dougsland at redhat.com
Thu Aug 18 18:01:59 UTC 2016


Douglas Schilling Landgraf has uploaded a new change for review.

Change subject: edit-node: Add --comment option
......................................................................

edit-node: Add --comment option

Users now can use --comment to add a string in the title of ovirt-node.
The file /etc/ovirt-node/node-comment will hold the string to show
in the title.

Change-Id: I95c9407e74b5f28a0bc17bc170ebdc4749de34ff
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1304084
Signed-off-by: Douglas Schilling Landgraf <dougsland at redhat.com>
(cherry picked from commit 33353ccffa5bb0567405e2d1a8abab1c8d478fc9)
---
M src/ovirt/node/app.py
M tools/edit-node
2 files changed, 18 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/74/62574/1

diff --git a/src/ovirt/node/app.py b/src/ovirt/node/app.py
index 56b1db5..8df9634 100644
--- a/src/ovirt/node/app.py
+++ b/src/ovirt/node/app.py
@@ -285,7 +285,12 @@
         self.ui.register_hotkey("f12", self.__reload_page)
         self.ui.register_hotkey("window resize", self.__check_terminal_size)
 
-        self.ui.header = "\n %s\n" % str(self.product)
+        if os.path.exists("/etc/ovirt-node/node-comment"):
+            with open("/etc/ovirt-node/node-comment") as f:
+                self.ui.header = "\n%s %s\n" % (f.read(), str(self.product))
+        else:
+            self.ui.header = "\n %s\n" % str(self.product)
+
         self.ui.footer = "Press esc to quit."
 
         # Catch ctrl+c
diff --git a/tools/edit-node b/tools/edit-node
index 5e20b4a..0d9de01 100755
--- a/tools/edit-node
+++ b/tools/edit-node
@@ -596,6 +596,11 @@
         f.close()
         return output
 
+    def _add_comment_title_tui(self, options):
+        comment_path = "%s/etc/ovirt-node/node-comment" % self._instroot
+        with open(comment_path, 'w') as f:
+            f.write(options.comment)
+
     def _update_version(self, options):
         ver = options.name or self._print_version()
         f = open("%s/etc/system-release" % self._instroot, "w")
@@ -1557,6 +1562,11 @@
                       dest="update", help="comma delimited list of packages" +
                       " to update (needs --repo)")
 
+    parser.add_option("--comment", type="string",
+                      dest="comment",
+                      help="Add a specify comment to be added into the "
+                      "title of TUI")
+
     parser.add_option("--repo", type="string",
                       dest="repo",
                       help="Specify yum repo file or yum repository on the"
@@ -1791,6 +1801,8 @@
                     editor._change_uid(options)
                 if options.gidmod is not None:
                     editor._change_gid(options)
+                if options.comment is not None:
+                    editor._add_comment_title_tui(options)
                 if options.shell:
                     print "Launching shell. Exit to continue."
                     print "----------------------------------"


-- 
To view, visit https://gerrit.ovirt.org/62574
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I95c9407e74b5f28a0bc17bc170ebdc4749de34ff
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: ovirt-3.6
Gerrit-Owner: Douglas Schilling Landgraf <dougsland at redhat.com>



More information about the node-patches mailing list