[node-patches] Change in ovirt-node[master]: Add auto install for the cim plugin
hadong0720 at gmail.com
hadong0720 at gmail.com
Tue Oct 29 08:56:11 UTC 2013
hadong has uploaded a new change for review.
Change subject: Add auto install for the cim plugin
......................................................................
Add auto install for the cim plugin
Change-Id: I35e6971a7cd7ba4f742c734dadbd20a8c4b594bb
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M ovirt-node.spec.in
M plugins/Makefile.am
A plugins/cim_autoinstall.py
3 files changed, 53 insertions(+), 1 deletion(-)
git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/41/20641/1
diff --git a/ovirt-node.spec.in b/ovirt-node.spec.in
index e4c527d..11004d6 100644
--- a/ovirt-node.spec.in
+++ b/ovirt-node.spec.in
@@ -547,6 +547,7 @@
%{python_sitelib}/ovirt/node/setup/cim/cim_model.py*
%{python_sitelib}/ovirt/node/setup/cim/cim_page.py*
%{_sysconfdir}/ovirt-plugins.d/cim.minimize
+%{_sysconfdir}/ovirt-config-boot.d/cim_autoinstall.py*
%if %{is_systemd}
%{_unitdir}/ovirt-cim.service
%else
@@ -580,6 +581,7 @@
%{_sysconfdir}/ovirt-config-boot.d
%exclude %{_sysconfdir}/ovirt-config-boot.d/snmp_autoinstall.py*
%exclude %{_sysconfdir}/ovirt-config-boot.d/puppet_autoinstall.py*
+%exclude %{_sysconfdir}/ovirt-config-boot.d/cim_autoinstall.py*
%if %{is_f16}
%{_unitdir}/libvirtd.service
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 71134e3..254b3f9 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -37,7 +37,8 @@
dist_pyovirtconfigboot_PYTHON = \
snmp_autoinstall.py \
- puppet_autoinstall.py
+ puppet_autoinstall.py \
+ cim_autoinstall.py
rbovirtsetup_SCRIPTS = \
ovirt.rb
diff --git a/plugins/cim_autoinstall.py b/plugins/cim_autoinstall.py
new file mode 100644
index 0000000..ef8226f
--- /dev/null
+++ b/plugins/cim_autoinstall.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# cim_autoinstall.py - Copyright (C) 2013 Red Hat, Inc.
+# Written by hadong <hadong 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.node.utils.console import TransactionProgress
+from ovirt.node.setup.cim import cim_model
+import ovirtnode.ovirtfunctions as _functions
+from ovirt.node.plugins import Changeset
+
+args = _functions.get_cmdline_args()
+keys = ["cim_enabled", "cim_passwd"]
+
+keys_to_model = {"cim_enabled": "cim.enabled",
+ "cim_passwd": "cim.password",
+ }
+
+changes = dict((keys_to_model[key], args[key]) for key in keys if key in args)
+
+if __name__ == "__main__":
+ cim = cim_model.CIM()
+ cfg = cim.retrieve()
+ effective_model = Changeset({
+ "cim.enabled": True if cfg["enabled"] else False,
+ "cim.password": "",
+ })
+ effective_model.update(changes)
+ is_enabled = effective_model["cim.enabled"]
+ pw = effective_model["cim.password"]
+ print pw
+ cim.update(is_enabled)
+ tx = cim.transaction(cim_password=pw)
+ TransactionProgress(tx, is_dry=False).run()
--
To view, visit http://gerrit.ovirt.org/20641
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I35e6971a7cd7ba4f742c734dadbd20a8c4b594bb
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