[node-patches] Change in ovirt-node[master]: enable snmp plugin autoinstall

jboggs at redhat.com jboggs at redhat.com
Fri Oct 19 14:21:53 UTC 2012


Joey Boggs has uploaded a new change for review.

Change subject: enable snmp plugin autoinstall
......................................................................

enable snmp plugin autoinstall

Change-Id: I5af7df4573e389a5faac57d65867504b6dad9de9
Signed-off-by: Joey Boggs <jboggs at redhat.com>
---
M ovirt-node.spec.in
M plugins/Makefile.am
A plugins/snmp_autoinstall.py
M scripts/ovirtnode/ovirtfunctions.py
4 files changed, 45 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/78/8678/1

diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index 5b643e5..90ce90e 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -252,7 +252,7 @@
 %files plugin-snmp
 %{python_sitelib}/ovirt_config_setup/snmp.py
 %{_sysconfdir}/ovirt-plugins.d/snmp.minimize
-
+%{_sysconfdir}/ovirt-config-boot.d/snmp_autoinstall.py
 %files
 %defattr(-,root,root)
 %config(noreplace) %attr(0644,root,root) %{_sysconfdir}/default/ovirt
@@ -262,6 +262,7 @@
 
 %{mgmt_scripts_dir}
 %{_sysconfdir}/ovirt-config-boot.d
+%exclude %{_sysconfdir}/ovirt-config-boot.d/snmp_autoinstall.py*
 %config(noreplace) %{_sysconfdir}/sysconfig/node-config
 
 %if %{is_f16}
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 301f45a..845b2b4 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -17,6 +17,7 @@
 
 pluginsdir = $(sysconfdir)/ovirt-plugins.d
 pyovirtconfigsetupdir =$(pythondir)/ovirt_config_setup
+pyovirtconfigbootdir = $(sysconfdir)/ovirt-config-boot.d
 
 dist_pyovirtconfigsetup_SCRIPTS = \
   snmp.py
@@ -24,3 +25,5 @@
 dist_plugins_DATA = \
   snmp.minimize
 
+dist_pyovirtconfigboot_SCRIPTS = \
+  snmp_autoinstall.py
diff --git a/plugins/snmp_autoinstall.py b/plugins/snmp_autoinstall.py
new file mode 100644
index 0000000..8472bc2
--- /dev/null
+++ b/plugins/snmp_autoinstall.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+# snmp_autoinstall.py - Copyright (C) 2012 Red Hat, Inc.
+# Written by Joey Boggs <jboggs at redhat.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+# MA  02110-1301, USA.  A copy of the GNU General Public License is
+# also available at http://www.gnu.org/copyleft/gpl.html.
+
+from ovirt_config_setup.snmp import enable_snmpd
+import ovirtnode.ovirtfunctions as _functions
+
+args = _functions.get_cmdline_args()
+if "snmp_password" in args:
+        enable_snmpd(args["snmp_password"])
diff --git a/scripts/ovirtnode/ovirtfunctions.py b/scripts/ovirtnode/ovirtfunctions.py
index 0fd7167..774dc62 100644
--- a/scripts/ovirtnode/ovirtfunctions.py
+++ b/scripts/ovirtnode/ovirtfunctions.py
@@ -1545,6 +1545,21 @@
         pass
     return (bit_value, disable_aes_ni)
 
+def get_cmdline_args():
+    with open("/proc/cmdline") as cmdline:
+        args = cmdline.read().split()
+        args_dict = {}
+        for opt in args:
+            if "=" in opt:
+                if opt.count("=") == 1:
+                    key, value = opt.split("=")
+                    args_dict[key] = value
+                elif "root=" in opt:
+                    args_dict["root"] = opt.replace("root=","")
+            else:
+                args_dict[opt] = opt
+    return args_dict
+
 class PluginBase(object):
     """Base class for pluggable Hypervisor configuration options.
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5af7df4573e389a5faac57d65867504b6dad9de9
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Joey Boggs <jboggs at redhat.com>



More information about the node-patches mailing list