[node-patches] Change in ovirt-node[master]: Initial push of puppet plugin code to ovirt repo

rbarry at redhat.com rbarry at redhat.com
Wed May 22 23:46:30 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Initial push of puppet plugin code to ovirt repo
......................................................................

Initial push of puppet plugin code to ovirt repo

Cleanup to follow on Monday
More cleanup...

Change-Id: Icb639acf019a48e809fb983ab2124c6215c00157
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M .gitignore
A plugins/puppet/COPYING
A plugins/puppet/Makefile.am
A plugins/puppet/README.md
A plugins/puppet/autogen.sh
A plugins/puppet/build/COPYING
A plugins/puppet/build/Makefile.am
A plugins/puppet/build/README.md
A plugins/puppet/build/autogen.sh
A plugins/puppet/build/build/autogen.sh
A plugins/puppet/build/configure.ac
A plugins/puppet/build/provider/Makefile.am
A plugins/puppet/build/provider/ovirt_provider.rb
A plugins/puppet/build/puppet-ovirt-node-plugin-0.0.1.tar.gz
A plugins/puppet/build/puppet-ovirt-node-plugin.spec
A plugins/puppet/build/puppet-ovirt-node-plugin.spec.in
A plugins/puppet/build/recipe/Makefile.am
A plugins/puppet/build/recipe/puppet-plugin-iso.ks
A plugins/puppet/build/recipe/puppet-plugin-minimizer.ks
A plugins/puppet/build/src/Makefile.am
A plugins/puppet/build/src/ovirt.rb
A plugins/puppet/build/src/puppet_page.py
A plugins/puppet/configure.ac
A plugins/puppet/provider/Makefile.am
A plugins/puppet/provider/lib/ovirt_node.rb
A plugins/puppet/provider/type/.ovirt_node.rb.swp
A plugins/puppet/provider/type/ovirt_node.rb
A plugins/puppet/puppet-ovirt-node-plugin.spec.in
A plugins/puppet/recipe/Makefile.am
A plugins/puppet/recipe/puppet-plugin-iso.ks
A plugins/puppet/recipe/puppet-plugin-minimizer.ks
A plugins/puppet/src/Makefile.am
A plugins/puppet/src/ovirt.rb
A plugins/puppet/src/puppet_page.py
A src/ovirt/node/setup/.logging_page.py.swp
35 files changed, 2,420 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/01/15001/1

diff --git a/.gitignore b/.gitignore
index 9e46431..c7096c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -29,3 +29,4 @@
 .settings
 tmp
 .checkstyle
+plugins/puppet/build
diff --git a/plugins/puppet/COPYING b/plugins/puppet/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/plugins/puppet/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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; either version 2 of the License, or
+    (at your option) any later version.
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/plugins/puppet/Makefile.am b/plugins/puppet/Makefile.am
new file mode 100644
index 0000000..261278d
--- /dev/null
+++ b/plugins/puppet/Makefile.am
@@ -0,0 +1,104 @@
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# 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.
+
+OVIRT_CACHE_DIR	?= $(HOME)/ovirt-cache
+
+PYTHONSOURCES = \
+  $(shell find scripts -name \*.py)
+
+SHELL := /bin/bash
+
+
+SUBDIRS = \
+	src \
+	recipe
+
+EXTRA_DIST = \
+  puppet-ovirt-node-plugin.spec \
+  puppet-ovirt-node-plugin.spec.in
+
+DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
+	aclocal.m4 \
+	configure \
+	install-sh \
+	missing \
+	py-compile
+
+DISTCLEANDIRS = autom4te.cache
+
+rpms: dist
+	rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
+
+srpms: dist
+	rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
+
+publish: rpms
+	mkdir -p $(OVIRT_CACHE_DIR)
+	rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
+	rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
+	createrepo $(OVIRT_CACHE_DIR)/ovirt
+
+iso: publish
+	cd recipe
+	make node
+
+.PHONY: rpms publish srpms
+
+
+check-local: doctests pep8 pyflakes pylint
+	@echo -e "---\n Passed.\n---"
+
+check-local-fast:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		export PARENT=$$$$ ; \
+		echo "Fast checks on '$$M'"; \
+		PYTHONPATH=. python -m doctest $$M || kill $$PARENT & \
+		PYTHONPATH=. pep8 -r $$M || kill $$PARENT & \
+		PYTHONPATH=. pyflakes $$M || kill $$PARENT & \
+	done ; wait
+
+doctests:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo Doctest on "$$M"; \
+		PYTHONPATH=. python -m doctest $$M || exit 1; \
+	done
+
+pep8:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pep8 on "$$M"; \
+		PYTHONPATH=. pep8 -r $$M || exit 1; \
+	done
+
+PYLINT=pylint -f parseable --include-ids=yes --rcfile=.pylintrc
+pylint:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pylint on "$$M"; \
+		PYTHONPATH=. $(PYLINT) $$M || exit 1; \
+	done
+
+pyflakes:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pyflakes on "$$M"; \
+		PYTHONPATH=. pyflakes $$M || exit 1; \
+	done
+
+# vim: ts=2
diff --git a/plugins/puppet/README.md b/plugins/puppet/README.md
new file mode 100644
index 0000000..d58edb3
--- /dev/null
+++ b/plugins/puppet/README.md
@@ -0,0 +1,4 @@
+puppet-ovirt-node-plugin
+========================
+
+./autogen.sh && make rpms
diff --git a/plugins/puppet/autogen.sh b/plugins/puppet/autogen.sh
new file mode 100755
index 0000000..03ca10b
--- /dev/null
+++ b/plugins/puppet/autogen.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Run this to generate configure and Makefile
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+THEDIR=`pwd`
+(
+  cd $srcdir
+  die=0
+
+  (autoconf --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have autoconf installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/autoconf"
+	  die=1
+  }
+
+  # Require libtool only if one of of LT_INIT,
+  # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
+  grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
+      && {
+    (libtool --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have libtool installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/libtool"
+	  die=1
+    }
+  }
+
+  (automake --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  die=1
+	  echo "You must have automake installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/automake"
+  }
+
+  test $die = 1 && exit 1
+
+  test -f puppet-ovirt-node-plugin.spec.in || {
+	  echo "You must run this script in the top-level directory"
+	  exit 1
+  }
+
+  if test -z "$*"; then
+	  echo "I am going to run ./configure with no arguments - if you wish "
+	  echo "to pass any to it, please specify them on the $0 command line."
+  fi
+
+  aclocal
+
+  # Run autoheader only if needed
+  grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
+
+  automake --add-missing
+  autoconf
+  ./configure "$@"
+)
+
+if test "x$OBJ_DIR" != x; then
+    mkdir -p "$OBJ_DIR"
+    cd "$OBJ_DIR"
+fi
diff --git a/plugins/puppet/build/COPYING b/plugins/puppet/build/COPYING
new file mode 100644
index 0000000..623b625
--- /dev/null
+++ b/plugins/puppet/build/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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; either version 2 of the License, or
+    (at your option) any later version.
+
+    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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/plugins/puppet/build/Makefile.am b/plugins/puppet/build/Makefile.am
new file mode 100644
index 0000000..3ea5158
--- /dev/null
+++ b/plugins/puppet/build/Makefile.am
@@ -0,0 +1,104 @@
+# Copyright (C) 2008 Red Hat, Inc.
+#
+# 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.
+
+OVIRT_CACHE_DIR	?= $(HOME)/ovirt-cache
+
+PYTHONSOURCES = \
+  $(shell find scripts -name \*.py)
+
+SHELL := /bin/bash
+
+
+SUBDIRS = \
+	src \
+	recipe
+
+EXTRA_DIST = \
+  puppet-ovirt-node-plugin.spec \
+  puppet-ovirt-node-plugin.spec.in 
+
+DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
+	aclocal.m4 \
+	configure \
+	install-sh \
+	missing \
+	py-compile
+
+DISTCLEANDIRS = autom4te.cache
+
+rpms: dist
+	rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
+
+srpms: dist
+	rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
+
+publish: rpms
+	mkdir -p $(OVIRT_CACHE_DIR)
+	rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
+	rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
+	createrepo $(OVIRT_CACHE_DIR)/ovirt
+
+iso: publish
+	cd recipe
+	make node
+
+.PHONY: rpms publish srpms
+
+
+check-local: doctests pep8 pyflakes pylint
+	@echo -e "---\n Passed.\n---"
+
+check-local-fast:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		export PARENT=$$$$ ; \
+		echo "Fast checks on '$$M'"; \
+		PYTHONPATH=. python -m doctest $$M || kill $$PARENT & \
+		PYTHONPATH=. pep8 -r $$M || kill $$PARENT & \
+		PYTHONPATH=. pyflakes $$M || kill $$PARENT & \
+	done ; wait
+
+doctests:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo Doctest on "$$M"; \
+		PYTHONPATH=. python -m doctest $$M || exit 1; \
+	done
+
+pep8:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pep8 on "$$M"; \
+		PYTHONPATH=. pep8 -r $$M || exit 1; \
+	done
+
+PYLINT=pylint -f parseable --include-ids=yes --rcfile=.pylintrc
+pylint:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pylint on "$$M"; \
+		PYTHONPATH=. $(PYLINT) $$M || exit 1; \
+	done
+
+pyflakes:
+	@for M in $(PYTHONSOURCES); \
+	do \
+		echo pyflakes on "$$M"; \
+		PYTHONPATH=. pyflakes $$M || exit 1; \
+	done
+
+# vim: ts=2
diff --git a/plugins/puppet/build/README.md b/plugins/puppet/build/README.md
new file mode 100644
index 0000000..d58edb3
--- /dev/null
+++ b/plugins/puppet/build/README.md
@@ -0,0 +1,4 @@
+puppet-ovirt-node-plugin
+========================
+
+./autogen.sh && make rpms
diff --git a/plugins/puppet/build/autogen.sh b/plugins/puppet/build/autogen.sh
new file mode 100755
index 0000000..03ca10b
--- /dev/null
+++ b/plugins/puppet/build/autogen.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Run this to generate configure and Makefile
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+THEDIR=`pwd`
+(
+  cd $srcdir
+  die=0
+
+  (autoconf --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have autoconf installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/autoconf"
+	  die=1
+  }
+
+  # Require libtool only if one of of LT_INIT,
+  # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
+  grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
+      && {
+    (libtool --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have libtool installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/libtool"
+	  die=1
+    }
+  }
+
+  (automake --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  die=1
+	  echo "You must have automake installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/automake"
+  }
+
+  test $die = 1 && exit 1
+
+  test -f puppet-ovirt-node-plugin.spec.in || {
+	  echo "You must run this script in the top-level directory"
+	  exit 1
+  }
+
+  if test -z "$*"; then
+	  echo "I am going to run ./configure with no arguments - if you wish "
+	  echo "to pass any to it, please specify them on the $0 command line."
+  fi
+
+  aclocal
+
+  # Run autoheader only if needed
+  grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
+
+  automake --add-missing
+  autoconf
+  ./configure "$@"
+)
+
+if test "x$OBJ_DIR" != x; then
+    mkdir -p "$OBJ_DIR"
+    cd "$OBJ_DIR"
+fi
diff --git a/plugins/puppet/build/build/autogen.sh b/plugins/puppet/build/build/autogen.sh
new file mode 100755
index 0000000..03ca10b
--- /dev/null
+++ b/plugins/puppet/build/build/autogen.sh
@@ -0,0 +1,66 @@
+#!/bin/sh
+# Run this to generate configure and Makefile
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+THEDIR=`pwd`
+(
+  cd $srcdir
+  die=0
+
+  (autoconf --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have autoconf installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/autoconf"
+	  die=1
+  }
+
+  # Require libtool only if one of of LT_INIT,
+  # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
+  grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
+      && {
+    (libtool --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  echo "You must have libtool installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/libtool"
+	  die=1
+    }
+  }
+
+  (automake --version) < /dev/null > /dev/null 2>&1 || {
+	  echo
+	  die=1
+	  echo "You must have automake installed."
+	  echo "Download the appropriate package for your distribution,"
+	  echo "or see http://www.gnu.org/software/automake"
+  }
+
+  test $die = 1 && exit 1
+
+  test -f puppet-ovirt-node-plugin.spec.in || {
+	  echo "You must run this script in the top-level directory"
+	  exit 1
+  }
+
+  if test -z "$*"; then
+	  echo "I am going to run ./configure with no arguments - if you wish "
+	  echo "to pass any to it, please specify them on the $0 command line."
+  fi
+
+  aclocal
+
+  # Run autoheader only if needed
+  grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
+
+  automake --add-missing
+  autoconf
+  ./configure "$@"
+)
+
+if test "x$OBJ_DIR" != x; then
+    mkdir -p "$OBJ_DIR"
+    cd "$OBJ_DIR"
+fi
diff --git a/plugins/puppet/build/configure.ac b/plugins/puppet/build/configure.ac
new file mode 100644
index 0000000..f408efb
--- /dev/null
+++ b/plugins/puppet/build/configure.ac
@@ -0,0 +1,10 @@
+AC_INIT([puppet-ovirt-node-plugin], [0.0.1], [node-devel at ovirt.org])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax])
+
+AM_PATH_PYTHON
+
+AC_CONFIG_FILES([Makefile
+                src/Makefile
+                recipe/Makefile
+                puppet-ovirt-node-plugin.spec])
+AC_OUTPUT
diff --git a/plugins/puppet/build/provider/Makefile.am b/plugins/puppet/build/provider/Makefile.am
new file mode 100644
index 0000000..0d2886c
--- /dev/null
+++ b/plugins/puppet/build/provider/Makefile.am
@@ -0,0 +1,25 @@
+# Copyright (C) 2010, Red Hat, Inc.
+#
+# 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.
+
+EXTRA_DIST = \
+	*.rb
+
+OVIRT_NODE_RECIPEdir = $(datadir)/ovirt-node-recipe
+OVIRT_NODE_RECIPE_DATA =         \
+		puppet-plugin-minimizer.ks \
+		puppet-plugin-iso.ks
+
diff --git a/plugins/puppet/build/provider/ovirt_provider.rb b/plugins/puppet/build/provider/ovirt_provider.rb
new file mode 100644
index 0000000..bde172e
--- /dev/null
+++ b/plugins/puppet/build/provider/ovirt_provider.rb
@@ -0,0 +1,5 @@
+Puppet::Type.newtype(:ovirt_engine) do
+    newparam(:address, :namevar => true) do
+
+    end
+end
diff --git a/plugins/puppet/build/puppet-ovirt-node-plugin-0.0.1.tar.gz b/plugins/puppet/build/puppet-ovirt-node-plugin-0.0.1.tar.gz
new file mode 100644
index 0000000..6bf9724
--- /dev/null
+++ b/plugins/puppet/build/puppet-ovirt-node-plugin-0.0.1.tar.gz
Binary files differ
diff --git a/plugins/puppet/build/puppet-ovirt-node-plugin.spec b/plugins/puppet/build/puppet-ovirt-node-plugin.spec
new file mode 100644
index 0000000..103b68b
--- /dev/null
+++ b/plugins/puppet/build/puppet-ovirt-node-plugin.spec
@@ -0,0 +1,191 @@
+Summary:        A plugin to make oVirt Node installs compatible with Puppet
+Name:           puppet-ovirt-node-plugin
+Version:        0.0.1
+Release:        0%{?BUILD_NUMBER}%{?extra_release}%{?dist}
+Source0:        %{name}-%{version}.tar.gz
+License:        GPLv2+
+Group:          Applications/System
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+URL:            http://www.ovirt.org/
+BuildRequires:  automake autoconf
+Requires:       ovirt-node >= 2.6.0
+Requires:       puppet
+
+BuildArch:      noarch
+
+%define app_root %{_datadir}/%{name}
+%define recipe_root %{_datadir}/ovirt-node-recipe
+
+%description
+Provides UI and associated scripts for integrating oVirt Node and Puppet
+
+%package recipe
+Summary:        Kickstarts for building oVirt Node isos including %{name}
+Group:          Applications/System
+Requires:       ovirt-node-recipe >= 2.6.0
+
+%description recipe
+Provides kickstart files for generating an oVirt Node ISO image containing
+%{name}.
+
+%prep
+%setup -q
+
+
+%build
+aclocal && autoheader && automake --add-missing && autoconf
+
+
+%configure
+make
+
+
+%install
+%{__rm} -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+
+
+%clean
+%{__rm} -rf %{buildroot}
+
+
+%post -p /bin/bash
+cd /usr/share/ruby/vendor_ruby/facter
+patch -p0 << EOF
+--- operatingsystem.rb  2013-03-19 16:12:46.610079038 -0700
++++ operatingsystemnew.rb   2013-03-21 11:51:59.199657472 -0700
+@@ -10,6 +10,9 @@
+ #
+ # Caveats:
+ #
++#
++\$LOAD_PATH.unshift('/var/lib/puppet/facts')
++require 'ovirt.rb'
+ 
+ Facter.add(:operatingsystem) do
+   confine :kernel => :sunos
+@@ -25,7 +28,12 @@
+ Facter.add(:operatingsystem) do
+   confine :kernel => :linux
+   setcode do
+-    if Facter.value(:lsbdistid) == "Ubuntu"
++    if FileTest.exists?("/etc/default/version")
++        txt = File.read("/etc/default/version")
++        if txt =~ /^PRODUCT='(.*?)\s/
++            $1
++        end
++    elsif Facter.value(:lsbdistid) == "Ubuntu"
+        "Ubuntu"
+     elsif FileTest.exists?("/etc/debian_version")
+       "Debian"
+EOF
+
+cd /etc/puppet
+patch -p0 << EOF
+--- puppet.conf 2013-03-21 14:55:43.969130799 -0700
++++ puppet.conf.new 2013-03-21 14:56:02.690178578 -0700
+@@ -1,4 +1,6 @@
+ [main]
++    server = ""
++    certname = ""
+     # The Puppet log directory.
+     # The default value is '$vardir/log'.
+     logdir = /var/log/puppet
+EOF
+
+cd /usr/libexec
+patch -p0 << EOF
+--- ovirt-init-functions.sh 2013-03-21 15:30:13.078014954 -0700
++++ ovirt-init-functions-new.sh 2013-03-21 16:33:52.893135359 -0700
+@@ -223,6 +223,9 @@
+     #   rhn_proxyuser=PROXY-USERNAME
+     #   rhn_proxypassword=PROXY-PASSWORD
+     #   snmp_password=<authpassphrase>
++    #   puppet_enabled=<y|n>
++    #   puppet_server=server
++    #   puppet_cetname=<certname>
+ 
+     #   BOOTIF=link|eth*|<MAC> (appended by pxelinux)
+     # network boot interface is assumed to be on management network where
+@@ -329,6 +332,14 @@
+     cim_passwd=
+     cim_enabled=
+ 
++    # Puppet related options
++    # puppet_enabled=y|n
++    # puppet_server=server
++    # puppet_certname=<certname>
++    puppet_enabled=
++    puppet_server=
++    puppet_certame=
++
+     #   pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>
+     #   anaconda format: ip=<client-ip> netmask=<netmask> gateway=<gw-ip>
+     #   or               ip=dhcp|off
+@@ -613,6 +624,19 @@
+             snmp_password=${i#snmp_password=}
+             ;;
+ 
++            puppet_enabled=n | puppet_enabled=0)
++            puppet_enabled=0
++            ;;
++            puppet_enabled* | puppet_enabled=y | puppet_enabled=1)
++            puppet_enabled=1
++            ;;
++            puppet_server=*)
++            puppet_server=${i#puppet_server=}
++            ;;
++            puppet_certname=*)
++            puppet_certname=${i#puppet_certname=}
++            ;;
++
+             mem_overcommit* | ovirt_overcommit*)
+             i=${i#mem_overcommit=}
+             i=${i#ovirt_overcommit=}
+@@ -797,7 +821,7 @@
+ 
+ 
+     # save boot parameters as defaults for ovirt-config-*
+-    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install"
++    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install puppet_enabled puppet_server puppet_certname"
+     # mount /config unless firstboot is forced
+     if [ "$firstboot" != "1" ]; then
+         mount_config
+@@ -855,6 +879,13 @@
+         /usr/sbin/usermod -p "$rootpw" root
+         chage -d 0 root
+     fi
++    if [ "$puppet_enabled" = 1]; then
++        if [ `hostname` != "localhost" ] | [ -n $puppet_certname ]; then
++            python -c "from ovirt.node.setup.puppet_page import *; ActivatePuppet()"  
++        else
++            log "Puppet disabled. Hostname not set and puppet_certname not specified"
++        fi
++    fi
+     # check if root or admin password is expired, this might be upon reboot
+     # in case of automated installed with rootpw or adminpw parameter!
+     if LC_ALL=C chage -l root | grep  -q "password must be changed" \
+@@ -1373,8 +1404,6 @@
+     return $?
+ }
+ 
+-
+-
+ #
+ # If called with a param from .service file:
+ #
+EOF
+
+%preun
+
+%files recipe
+%{recipe_root}
+
+%files
+%{python_sitelib}/ovirt/node/setup/puppet_page.py*
+%{_localstatedir}/lib/puppet/facts/ovirt.rb
+
+%changelog
+* Fri Mar 22 2013 Ryan Barry <rbarry at redhat.com> 0.0.1
+- initial commit
diff --git a/plugins/puppet/build/puppet-ovirt-node-plugin.spec.in b/plugins/puppet/build/puppet-ovirt-node-plugin.spec.in
new file mode 100644
index 0000000..7b4999a
--- /dev/null
+++ b/plugins/puppet/build/puppet-ovirt-node-plugin.spec.in
@@ -0,0 +1,191 @@
+Summary:        A plugin to make oVirt Node installs compatible with Puppet
+Name:           puppet-ovirt-node-plugin
+Version:        @VERSION@
+Release:        0%{?BUILD_NUMBER}%{?extra_release}%{?dist}
+Source0:        %{name}-%{version}.tar.gz
+License:        GPLv2+
+Group:          Applications/System
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+URL:            http://www.ovirt.org/
+BuildRequires:  automake autoconf
+Requires:       ovirt-node >= 2.6.0
+Requires:       puppet
+
+BuildArch:      noarch
+
+%define app_root %{_datadir}/%{name}
+%define recipe_root %{_datadir}/ovirt-node-recipe
+
+%description
+Provides UI and associated scripts for integrating oVirt Node and Puppet
+
+%package recipe
+Summary:        Kickstarts for building oVirt Node isos including %{name}
+Group:          Applications/System
+Requires:       ovirt-node-recipe >= 2.6.0
+
+%description recipe
+Provides kickstart files for generating an oVirt Node ISO image containing
+%{name}.
+
+%prep
+%setup -q
+
+
+%build
+aclocal && autoheader && automake --add-missing && autoconf
+
+
+%configure
+make
+
+
+%install
+%{__rm} -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+
+
+%clean
+%{__rm} -rf %{buildroot}
+
+
+%post -p /bin/bash
+cd /usr/share/ruby/vendor_ruby/facter
+patch -p0 << EOF
+--- operatingsystem.rb  2013-03-19 16:12:46.610079038 -0700
++++ operatingsystemnew.rb   2013-03-21 11:51:59.199657472 -0700
+@@ -10,6 +10,9 @@
+ #
+ # Caveats:
+ #
++#
++\$LOAD_PATH.unshift('/var/lib/puppet/facts')
++require 'ovirt.rb'
+ 
+ Facter.add(:operatingsystem) do
+   confine :kernel => :sunos
+@@ -25,7 +28,12 @@
+ Facter.add(:operatingsystem) do
+   confine :kernel => :linux
+   setcode do
+-    if Facter.value(:lsbdistid) == "Ubuntu"
++    if FileTest.exists?("/etc/default/version")
++        txt = File.read("/etc/default/version")
++        if txt =~ /^PRODUCT='(.*?)\s/
++            $1
++        end
++    elsif Facter.value(:lsbdistid) == "Ubuntu"
+        "Ubuntu"
+     elsif FileTest.exists?("/etc/debian_version")
+       "Debian"
+EOF
+
+cd /etc/puppet
+patch -p0 << EOF
+--- puppet.conf 2013-03-21 14:55:43.969130799 -0700
++++ puppet.conf.new 2013-03-21 14:56:02.690178578 -0700
+@@ -1,4 +1,6 @@
+ [main]
++    server = ""
++    certname = ""
+     # The Puppet log directory.
+     # The default value is '$vardir/log'.
+     logdir = /var/log/puppet
+EOF
+
+cd /usr/libexec
+patch -p0 << EOF
+--- ovirt-init-functions.sh 2013-03-21 15:30:13.078014954 -0700
++++ ovirt-init-functions-new.sh 2013-03-21 16:33:52.893135359 -0700
+@@ -223,6 +223,9 @@
+     #   rhn_proxyuser=PROXY-USERNAME
+     #   rhn_proxypassword=PROXY-PASSWORD
+     #   snmp_password=<authpassphrase>
++    #   puppet_enabled=<y|n>
++    #   puppet_server=server
++    #   puppet_cetname=<certname>
+ 
+     #   BOOTIF=link|eth*|<MAC> (appended by pxelinux)
+     # network boot interface is assumed to be on management network where
+@@ -329,6 +332,14 @@
+     cim_passwd=
+     cim_enabled=
+ 
++    # Puppet related options
++    # puppet_enabled=y|n
++    # puppet_server=server
++    # puppet_certname=<certname>
++    puppet_enabled=
++    puppet_server=
++    puppet_certame=
++
+     #   pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>
+     #   anaconda format: ip=<client-ip> netmask=<netmask> gateway=<gw-ip>
+     #   or               ip=dhcp|off
+@@ -613,6 +624,19 @@
+             snmp_password=${i#snmp_password=}
+             ;;
+ 
++            puppet_enabled=n | puppet_enabled=0)
++            puppet_enabled=0
++            ;;
++            puppet_enabled* | puppet_enabled=y | puppet_enabled=1)
++            puppet_enabled=1
++            ;;
++            puppet_server=*)
++            puppet_server=${i#puppet_server=}
++            ;;
++            puppet_certname=*)
++            puppet_certname=${i#puppet_certname=}
++            ;;
++
+             mem_overcommit* | ovirt_overcommit*)
+             i=${i#mem_overcommit=}
+             i=${i#ovirt_overcommit=}
+@@ -797,7 +821,7 @@
+ 
+ 
+     # save boot parameters as defaults for ovirt-config-*
+-    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install"
++    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install puppet_enabled puppet_server puppet_certname"
+     # mount /config unless firstboot is forced
+     if [ "$firstboot" != "1" ]; then
+         mount_config
+@@ -855,6 +879,13 @@
+         /usr/sbin/usermod -p "$rootpw" root
+         chage -d 0 root
+     fi
++    if [ "$puppet_enabled" = 1]; then
++        if [ `hostname` != "localhost" ] | [ -n $puppet_certname ]; then
++            python -c "from ovirt.node.setup.puppet_page import *; ActivatePuppet()"  
++        else
++            log "Puppet disabled. Hostname not set and puppet_certname not specified"
++        fi
++    fi
+     # check if root or admin password is expired, this might be upon reboot
+     # in case of automated installed with rootpw or adminpw parameter!
+     if LC_ALL=C chage -l root | grep  -q "password must be changed" \
+@@ -1373,8 +1404,6 @@
+     return $?
+ }
+ 
+-
+-
+ #
+ # If called with a param from .service file:
+ #
+EOF
+
+%preun
+
+%files recipe
+%{recipe_root}
+
+%files
+%{python_sitelib}/ovirt/node/setup/puppet_page.py*
+%{_localstatedir}/lib/puppet/facts/ovirt.rb
+
+%changelog
+* Fri Mar 22 2013 Ryan Barry <rbarry at redhat.com> 0.0.1
+- initial commit
diff --git a/plugins/puppet/build/recipe/Makefile.am b/plugins/puppet/build/recipe/Makefile.am
new file mode 100644
index 0000000..5f06fe0
--- /dev/null
+++ b/plugins/puppet/build/recipe/Makefile.am
@@ -0,0 +1,25 @@
+# Copyright (C) 2010, Red Hat, Inc.
+#
+# 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.
+
+EXTRA_DIST = \
+	*.ks
+
+OVIRT_NODE_RECIPEdir = $(datadir)/ovirt-node-recipe
+OVIRT_NODE_RECIPE_DATA =         \
+		puppet-plugin-minimizer.ks \
+		puppet-plugin-iso.ks
+
diff --git a/plugins/puppet/build/recipe/puppet-plugin-iso.ks b/plugins/puppet/build/recipe/puppet-plugin-iso.ks
new file mode 100644
index 0000000..28bb232
--- /dev/null
+++ b/plugins/puppet/build/recipe/puppet-plugin-iso.ks
@@ -0,0 +1 @@
+%include ovirt-node-image.ks
diff --git a/plugins/puppet/build/recipe/puppet-plugin-minimizer.ks b/plugins/puppet/build/recipe/puppet-plugin-minimizer.ks
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/plugins/puppet/build/recipe/puppet-plugin-minimizer.ks
diff --git a/plugins/puppet/build/src/Makefile.am b/plugins/puppet/build/src/Makefile.am
new file mode 100644
index 0000000..61b4714
--- /dev/null
+++ b/plugins/puppet/build/src/Makefile.am
@@ -0,0 +1,42 @@
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# 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.
+
+nodeconfdir = $(sysconfdir)/sysconfig
+localboottriggerdir=$(sysconfdir)/ovirt-config-boot.d
+
+#
+# newt tui
+#
+pyovirtsetupdir = $(pythondir)/ovirt/node/setup
+pyovirtsetup_PYTHON = \
+  puppet_page.py
+
+EXTRA_DIST = \
+  *.rb
+
+rbovirtsetupdir = $(localstatedir)/lib/puppet/facts
+rbovirtsetup_SCRIPTS = \
+  ovirt.rb
+
+# Requires python-pep8 package (Fedora)
+check-local: check-local-pep8
+
+check-local-pep8:
+	find $(srcdir) -name \*.py | sort | uniq | xargs pep8 --repeat --statistics --count
+
+check-local-doctest:
+	find $(srcdir) -name \*.py | sort | uniq | xargs python -m doctest -v
diff --git a/plugins/puppet/build/src/ovirt.rb b/plugins/puppet/build/src/ovirt.rb
new file mode 100644
index 0000000..4ef3575
--- /dev/null
+++ b/plugins/puppet/build/src/ovirt.rb
@@ -0,0 +1,26 @@
+Facter.add(:operatingsystem) do
+    has_weight 100_000_000
+    confine :kernel => :linux
+    setcode do
+        if FileTest.exists?("/etc/default/version")
+            txt = File.read("/etc/default/version")
+            if txt =~ /^PRODUCT='(.*?)\s/
+                $1
+            end
+        end
+    end
+end
+
+Facter.add(:operatingsystemrelease) do
+    confine :operatingsystem => %w{oVirt}
+    setcode do
+        if FileTest.exists?("/etc/default/version")
+            txt = File.read("/etc/default/version")
+            if txt =~ /^VERSION=(.*)/
+                $1
+            else
+                "unknown"
+            end
+        end
+    end
+end
diff --git a/plugins/puppet/build/src/puppet_page.py b/plugins/puppet/build/src/puppet_page.py
new file mode 100644
index 0000000..eed8ca0
--- /dev/null
+++ b/plugins/puppet/build/src/puppet_page.py
@@ -0,0 +1,157 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# puppet_page.py - Copyright (C) 2013 Red Hat, Inc.
+# Written by Ryan Barry <rbarry 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 import plugins, valid, ui, utils
+from ovirt.node.config.defaults import NodeConfigFileSection
+from ovirt.node.plugins import Changeset
+import logging
+import socket
+import re
+
+"""
+Configure Puppet
+"""
+
+
+LOGGER = logging.getLogger(__name__)
+
+
+class Plugin(plugins.NodePlugin):
+    _server = None
+
+    def name(self):
+        return "Puppet"
+
+    def rank(self):
+        return 105
+
+    def model(self):
+        cfg = Puppet().retrieve()
+        model = {
+            "puppet.enabled": True if cfg["enabled"] else False,
+            "puppet.server": cfg["server"] or "puppet",
+            "puppet.certname": cfg["certname"] or socket.gethostname()
+        }
+        return model
+
+    def validators(self):
+        return {"puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
+                }
+
+    def ui_content(self):
+        ws = [ui.Header("header[0]", "Puppet Configuration"),
+              ui.Checkbox("puppet.enabled", "Enable Puppet"),
+              ui.Entry("puppet.server", "Puppet Server:"),
+              ui.Entry("puppet.certname", "Puppet Certificate Name"),
+              ui.Divider("divider[0]"),
+              ]
+
+        page = ui.Page("page", ws)
+        page.buttons = [ui.SaveButton("action.register", "Save & Run")]
+
+        self.widgets.add(page)
+        return page
+
+    def on_change(self, changes):
+        pass
+
+    def on_merge(self, effective_changes):
+        self.logger.info("Saving Puppet config")
+        changes = Changeset(self.pending_changes(False))
+        effective_model = Changeset(self.model())
+        effective_model.update(effective_changes)
+
+        puppet_keys = ["puppet.enabled", "puppet.server", "puppet.certname"]
+        if changes.contains_any(puppet_keys):
+            Puppet().update(*effective_model.values_for(puppet_keys))
+
+        self.logger.debug("Changes: %s" % changes)
+        self.logger.debug("Effective Model: %s" % effective_model)
+
+        txs = utils.Transaction("Configuring Puppet")
+
+        if effective_changes.contains_any(["action.register"]):
+            self.logger.debug("Connecting to puppet")
+            txs += [ActivatePuppet()]
+
+        if len(txs) > 0:
+            progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs,
+                                                           self)
+            progress_dialog.run()
+
+        # Acts like a page reload
+        return self.ui_content()
+
+
+#
+#
+# Functions and classes to support the UI
+#
+#
+class Puppet(NodeConfigFileSection):
+    """Class to handle Puppet configuration in /etc/default/ovirt file
+
+    >>> from ovirt.node.config.defaults import ConfigFile, SimpleProvider
+    >>> fn = "/tmp/cfg_dummy"
+    >>> cfgfile = ConfigFile(fn, SimpleProvider)
+    >>> n = Puppet(cfgfile)
+    >>> n.update("puppet.example.com")
+    >>> sorted(n.retrieve().items())
+    [(server, 'puppet.example.com')]
+    """
+    keys = ("OVIRT_PUPPET_ENABLED",
+            "OVIRT_PUPPET_SERVER",
+            "OVIRT_PUPPET_CERTIFICATE_NAME"
+            )
+
+    @NodeConfigFileSection.map_and_update_defaults_decorator
+    def update(self, enabled, server, certname):
+        valid.Boolean()(enabled)
+        (valid.Empty() | valid.FQDNOrIPAddress())(server)
+        (valid.Empty() | valid.FQDN())(certname)
+        return {"OVIRT_PUPPET_ENABLED": "yes" if enabled else False}
+
+
+class ActivatePuppet(utils.Transaction.Element):
+
+    title = "Activating Puppet"
+
+    def commit(self):
+
+        self.logger.info("Connecting to Puppet server")
+
+        cfg = Puppet().retrieve()
+
+        with open("/etc/puppet/puppet.conf") as conf:
+            lines = conf.readlines()
+        with open("/etc/puppet/puppet.conf", "w") as conf:
+            for line in lines:
+                try:
+                    item = re.match(r'^\s+(\w+) =', line).group(1)
+                    if item in cfg:
+                        print "matched"
+                        conf.write(re.sub(r'(^.*?' + item + ' =).*', r'\1 "' +
+                        cfg[item] + '"', line))
+                except:
+                    conf.write(line)
+
+        utils.process.call("service puppet stop")
+        #utils.process.check_call("puppet agent --test")
+        #utils.process.call("service puppet start")
diff --git a/plugins/puppet/configure.ac b/plugins/puppet/configure.ac
new file mode 100644
index 0000000..f408efb
--- /dev/null
+++ b/plugins/puppet/configure.ac
@@ -0,0 +1,10 @@
+AC_INIT([puppet-ovirt-node-plugin], [0.0.1], [node-devel at ovirt.org])
+AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax])
+
+AM_PATH_PYTHON
+
+AC_CONFIG_FILES([Makefile
+                src/Makefile
+                recipe/Makefile
+                puppet-ovirt-node-plugin.spec])
+AC_OUTPUT
diff --git a/plugins/puppet/provider/Makefile.am b/plugins/puppet/provider/Makefile.am
new file mode 100644
index 0000000..0d2886c
--- /dev/null
+++ b/plugins/puppet/provider/Makefile.am
@@ -0,0 +1,25 @@
+# Copyright (C) 2010, Red Hat, Inc.
+#
+# 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.
+
+EXTRA_DIST = \
+	*.rb
+
+OVIRT_NODE_RECIPEdir = $(datadir)/ovirt-node-recipe
+OVIRT_NODE_RECIPE_DATA =         \
+		puppet-plugin-minimizer.ks \
+		puppet-plugin-iso.ks
+
diff --git a/plugins/puppet/provider/lib/ovirt_node.rb b/plugins/puppet/provider/lib/ovirt_node.rb
new file mode 100644
index 0000000..bb75f40
--- /dev/null
+++ b/plugins/puppet/provider/lib/ovirt_node.rb
@@ -0,0 +1,113 @@
+require 'fileutils'
+require 'filetest'
+require 'augeas'
+
+Puppet::Type.type(:ovirt_node).provide(:ovirt) do
+    commands :python => "/usr/bin/python"
+
+    def initialize(value={})
+        super(value)
+        @property_flush = {}
+    end
+
+    def update_wrapper(type, value)
+        python("-c 'from ovirt.node.config import defaults; model = defaults.#{type}(); model.update(#{value}); tx = model.transaction(); tx()'")
+    end
+
+    def instances
+        config_vars = %w[hostname ssh_pwauth dns ip_address ip_gateway ip_netmask
+                         management_server use_strong_rng]
+        if FileTests.exists?("/etc/pki/vdsm/certs/engine_web_ca.pem")
+          engine = %x(openssl x509 -in /etc/pki/vdsm/certs/engine_web_ca.pem -noout -issuer).
+              match(/CN=CA-(.*?)\.\d+$/)
+          if engine?
+              vars = {}
+#              augtool = %x(augtool print /files/etc/default/ovirt | grep = | awk '{print $1}')
+              keys = Hash[keys.split("\n").collect.map { |x| [x, nil] } ]
+              keys.each.key do |key|
+                  if config_vars.include? "OVIRT_#{key}".downcase
+                      Augeas::open do |aug|
+                          x = aug.get(key)
+                          vars[key.split("/").last.to_sym] = x
+                      end
+                  end
+              end
+              new(vars)
+          end
+        end
+    end
+
+    def exists?
+        `openssl x509 -in /etc/pki/vdsm/certs/engine_web_ca.pem -noout -issuer`
+        .match(/CN=CA-#{@resource[:address]}/) ? true : false
+    end
+
+    def address=(engine)
+        puts "Do nothing"
+        #Waiting to see logic from new VDSM plugin
+    end
+
+    def nfsdomain=(domain)
+        # The py snippet below will only change the runtime configuratio (NFSv4 domain)
+        # To make persistent changes we'll need to use the ovirt.node.config.defaults
+        # module, which gives us access to all topics which are covered by Node's logic.
+        # ovirt.node.utils.* modules only change the runtime config, but don't persist the
+        # changes.
+        # See ssh_pwauth for a complete example
+        update_wrapper("NFS", domain)
+    end
+
+    def iscsi_initiator=(name)
+        update_wrapper("iSCSI", name)
+    end
+
+    def ssh=(bool) 
+        # It needs to be ensured that #{bool} is either True or False (so a bool in py syntax)
+        value = ""
+        if bool
+            value = "True"
+        else
+            value = "False"
+        end
+        update_wrapper("SSH", value)
+    end
+
+    def kdump=(options)
+        kdump = options.first
+        kdump.each do |type, server|
+            if type.downcase == "ssh"
+                #It's SSH
+                update_wrapper("KDump", "None, #{server}, None")
+            elsif type.downcase == "nfs"
+                update_wrapper("KDump", "#{server}, None, None")
+            end
+        end
+    end
+
+    def rsyslog=(server)
+        server, port = server.split(":")[0]
+        port = port ? port : 514
+        update_wrapper("Syslog", "#{server}, #{port}")
+    end
+
+    def netconsole=(server)
+        server, port = server.split(":")[0]
+        port = port ? port : 6666
+        update_wrapper("Netconsole", "#{server}, #{port}")
+    end
+
+    def monitoring=(server)
+        server, port = server.split(":")[0]
+        port = port ? port : 7634
+        update_wrapper("Collectd", "#{server}, #{port}")
+    end
+
+    def ntp=(servers)
+        update_wrapper("Timeservers", "[#{servers.join(", ")}]")
+    end
+    
+    def ntp=(servers)
+        update_wrapper("Nameservers", "[#{servers.join(", ")}]")
+    end
+
+end
diff --git a/plugins/puppet/provider/type/.ovirt_node.rb.swp b/plugins/puppet/provider/type/.ovirt_node.rb.swp
new file mode 100644
index 0000000..26502ae
--- /dev/null
+++ b/plugins/puppet/provider/type/.ovirt_node.rb.swp
Binary files differ
diff --git a/plugins/puppet/provider/type/ovirt_node.rb b/plugins/puppet/provider/type/ovirt_node.rb
new file mode 100644
index 0000000..8efb9ed
--- /dev/null
+++ b/plugins/puppet/provider/type/ovirt_node.rb
@@ -0,0 +1,61 @@
+Puppet::Type.newtype(:ovirt_node) do
+    #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, either version 3 of the License, or
+    #(at your option) any later version.
+    #
+    #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, see <http://www.gnu.org/licenses/>.
+    
+    ensurable
+
+    newparam(:address, :namevar => true) do
+        desc "The address of the engine"
+    end
+
+    newparam(:nfsdomain) do
+        desc "The NFSv4 domain for the node"
+    end
+
+    newparam(:iscsi_initiator) do
+        desc "The iSCSI Initiator Name"
+    end
+
+    newparam(:kdump) do
+        desc "kdump configuration"
+    end
+
+    newparam(:ssh) do
+        desc "Enable SSH authentication"
+        newvalues(:True, :true, :False, :false)
+        defaultto :False
+
+        munge do |value|
+            case value
+            when :true
+                :True
+            when :false
+                :False
+            else
+                super
+            end
+        end
+    end
+
+    newparam(:rsyslog) do
+        desc "RSyslog server"
+    end
+
+    newparam(:netconsole) do
+        desc "Netconsole server"
+    end
+
+    newparam(:monitoring) do
+        desc "Monitoring server"
+    end
+end
diff --git a/plugins/puppet/puppet-ovirt-node-plugin.spec.in b/plugins/puppet/puppet-ovirt-node-plugin.spec.in
new file mode 100644
index 0000000..bbdbc0f
--- /dev/null
+++ b/plugins/puppet/puppet-ovirt-node-plugin.spec.in
@@ -0,0 +1,191 @@
+Summary:        A plugin to make oVirt Node installs compatible with Puppet
+Name:           puppet-ovirt-node-plugin
+Version:        @VERSION@
+Release:        0%{?BUILD_NUMBER}%{?extra_release}%{?dist}
+Source0:        %{name}-%{version}.tar.gz
+License:        GPLv2+
+Group:          Applications/System
+
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+URL:            http://www.ovirt.org/
+BuildRequires:  automake autoconf
+Requires:       ovirt-node >= 2.6.0
+Requires:       puppet
+
+BuildArch:      noarch
+
+%define app_root %{_datadir}/%{name}
+%define recipe_root %{_datadir}/ovirt-node-recipe
+
+%description
+Provides UI and associated scripts for integrating oVirt Node and Puppet
+
+%package recipe
+Summary:        Kickstarts for building oVirt Node isos including %{name}
+Group:          Applications/System
+Requires:       ovirt-node-recipe >= 2.6.0
+
+%description recipe
+Provides kickstart files for generating an oVirt Node ISO image containing
+%{name}.
+
+%prep
+%setup -q
+
+
+%build
+aclocal && autoheader && automake --add-missing && autoconf
+
+
+%configure
+make
+
+
+%install
+%{__rm} -rf %{buildroot}
+make install DESTDIR=%{buildroot}
+
+
+%clean
+%{__rm} -rf %{buildroot}
+
+
+%post -p /bin/bash
+cd /usr/share/ruby/vendor_ruby/facter
+patch -p0 << EOF
+--- operatingsystem.rb  2013-03-19 16:12:46.610079038 -0700
++++ operatingsystemnew.rb   2013-03-21 11:51:59.199657472 -0700
+@@ -10,6 +10,9 @@
+ #
+ # Caveats:
+ #
++#
++\$LOAD_PATH.unshift('/var/lib/puppet/facts')
++require 'ovirt.rb'
+
+ Facter.add(:operatingsystem) do
+   confine :kernel => :sunos
+@@ -25,7 +28,12 @@
+ Facter.add(:operatingsystem) do
+   confine :kernel => :linux
+   setcode do
+-    if Facter.value(:lsbdistid) == "Ubuntu"
++    if FileTest.exists?("/etc/default/version")
++        txt = File.read("/etc/default/version")
++        if txt =~ /^PRODUCT='(.*?)\s/
++            $1
++        end
++    elsif Facter.value(:lsbdistid) == "Ubuntu"
+        "Ubuntu"
+     elsif FileTest.exists?("/etc/debian_version")
+       "Debian"
+EOF
+
+cd /etc/puppet
+patch -p0 << EOF
+--- puppet.conf 2013-03-21 14:55:43.969130799 -0700
++++ puppet.conf.new 2013-03-21 14:56:02.690178578 -0700
+@@ -1,4 +1,6 @@
+ [main]
++    server = ""
++    certname = ""
+     # The Puppet log directory.
+     # The default value is '$vardir/log'.
+     logdir = /var/log/puppet
+EOF
+
+cd /usr/libexec
+patch -p0 << EOF
+--- ovirt-init-functions.sh 2013-03-21 15:30:13.078014954 -0700
++++ ovirt-init-functions-new.sh 2013-03-21 16:33:52.893135359 -0700
+@@ -223,6 +223,9 @@
+     #   rhn_proxyuser=PROXY-USERNAME
+     #   rhn_proxypassword=PROXY-PASSWORD
+     #   snmp_password=<authpassphrase>
++    #   puppet_enabled=<y|n>
++    #   puppet_server=server
++    #   puppet_certname=<certname>
+ 
+     #   BOOTIF=link|eth*|<MAC> (appended by pxelinux)
+     # network boot interface is assumed to be on management network where
+@@ -329,6 +332,14 @@
+     cim_passwd=
+     cim_enabled=
+ 
++    # Puppet related options
++    # puppet_enabled=y|n
++    # puppet_server=server
++    # puppet_certname=<certname>
++    puppet_enabled=
++    puppet_server=
++    puppet_certame=
++
+     #   pxelinux format: ip=<client-ip>:<boot-server-ip>:<gw-ip>:<netmask>
+     #   anaconda format: ip=<client-ip> netmask=<netmask> gateway=<gw-ip>
+     #   or               ip=dhcp|off
+@@ -613,6 +624,19 @@
+             snmp_password=${i#snmp_password=}
+             ;;
+ 
++            puppet_enabled=n | puppet_enabled=0)
++            puppet_enabled=0
++            ;;
++            puppet_enabled* | puppet_enabled=y | puppet_enabled=1)
++            puppet_enabled=1
++            ;;
++            puppet_server=*)
++            puppet_server=${i#puppet_server=}
++            ;;
++            puppet_certname=*)
++            puppet_certname=${i#puppet_certname=}
++            ;;
++
+             mem_overcommit* | ovirt_overcommit*)
+             i=${i#mem_overcommit=}
+             i=${i#ovirt_overcommit=}
+@@ -797,7 +821,7 @@
+ 
+ 
+     # save boot parameters as defaults for ovirt-config-*
+-    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install"
++    params="bootif init init_app vol_boot_size vol_efi_size vol_swap_size vol_root_size vol_config_size vol_logging_size vol_data_size vol_swap2_size vol_data2_size crypt_swap crypt_swap2 upgrade standalone overcommit ip_address ip_netmask ip_gateway ipv6 dns ntp vlan ssh_pwauth syslog_server syslog_port collectd_server collectd_port bootparams hostname firstboot rhn_type rhn_url rhn_ca_cert rhn_username rhn_password rhn_profile rhn_activationkey rhn_org rhn_proxy rhn_proxyuser rhn_proxypassword runtime_mode kdump_nfs iscsi_name snmp_password install netconsole_server netconsole_port stateless cim_enabled wipe_fakeraid iscsi_init iscsi_target_name iscsi_target_host iscsi_target_port iscsi_install puppet_enabled puppet_server puppet_certname"
+     # mount /config unless firstboot is forced
+     if [ "$firstboot" != "1" ]; then
+         mount_config
+@@ -855,6 +879,13 @@
+         /usr/sbin/usermod -p "$rootpw" root
+         chage -d 0 root
+     fi
++    if [ "$puppet_enabled" = 1]; then
++        if [ `hostname` != "localhost" ] | [ -n $puppet_certname ]; then
++            python -c "from ovirt.node.setup.puppet_page import *; ActivatePuppet()"
++        else
++            log "Puppet disabled. Hostname not set and puppet_certname not specified"
++        fi
++    fi
+     # check if root or admin password is expired, this might be upon reboot
+     # in case of automated installed with rootpw or adminpw parameter!
+     if LC_ALL=C chage -l root | grep  -q "password must be changed" \
+@@ -1373,8 +1404,6 @@
+     return $?
+ }
+ 
+-
+-
+ #
+ # If called with a param from .service file:
+ #
+EOF
+
+%preun
+
+%files recipe
+%{recipe_root}
+
+%files
+%{python_sitelib}/ovirt/node/setup/puppet_page.py*
+%{_localstatedir}/lib/puppet/facts/ovirt.rb
+
+%changelog
+* Fri Mar 22 2013 Ryan Barry <rbarry at redhat.com> 0.0.1
+- initial commit
diff --git a/plugins/puppet/recipe/Makefile.am b/plugins/puppet/recipe/Makefile.am
new file mode 100644
index 0000000..5f06fe0
--- /dev/null
+++ b/plugins/puppet/recipe/Makefile.am
@@ -0,0 +1,25 @@
+# Copyright (C) 2010, Red Hat, Inc.
+#
+# 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.
+
+EXTRA_DIST = \
+	*.ks
+
+OVIRT_NODE_RECIPEdir = $(datadir)/ovirt-node-recipe
+OVIRT_NODE_RECIPE_DATA =         \
+		puppet-plugin-minimizer.ks \
+		puppet-plugin-iso.ks
+
diff --git a/plugins/puppet/recipe/puppet-plugin-iso.ks b/plugins/puppet/recipe/puppet-plugin-iso.ks
new file mode 100644
index 0000000..28bb232
--- /dev/null
+++ b/plugins/puppet/recipe/puppet-plugin-iso.ks
@@ -0,0 +1 @@
+%include ovirt-node-image.ks
diff --git a/plugins/puppet/recipe/puppet-plugin-minimizer.ks b/plugins/puppet/recipe/puppet-plugin-minimizer.ks
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/plugins/puppet/recipe/puppet-plugin-minimizer.ks
diff --git a/plugins/puppet/src/Makefile.am b/plugins/puppet/src/Makefile.am
new file mode 100644
index 0000000..537a03f
--- /dev/null
+++ b/plugins/puppet/src/Makefile.am
@@ -0,0 +1,34 @@
+# Copyright (C) 2010 Red Hat, Inc.
+#
+# 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.
+
+nodeconfdir = $(sysconfdir)/sysconfig
+localboottriggerdir=$(sysconfdir)/ovirt-config-boot.d
+
+#
+# newt tui
+#
+pyovirtsetupdir = $(pythondir)/ovirt/node/setup
+pyovirtsetup_PYTHON = \
+  puppet_page.py
+
+EXTRA_DIST = \
+  *.rb
+
+rbovirtsetupdir = $(localstatedir)/lib/puppet/facts
+rbovirtsetup_SCRIPTS = \
+  ovirt.rb
+include ../../../src/Makefile.check
diff --git a/plugins/puppet/src/ovirt.rb b/plugins/puppet/src/ovirt.rb
new file mode 100644
index 0000000..9b1071a
--- /dev/null
+++ b/plugins/puppet/src/ovirt.rb
@@ -0,0 +1,36 @@
+Facter.add(:operatingsystem) do
+    has_weight 100_000_000
+    confine :kernel => :linux
+    setcode do
+        if FileTest.exists?("/etc/system-release")
+            txt = File.read("/etc/system-release")
+            if txt =~ /^(.*?)\srelease.*/
+                $1
+            end
+        elsif FileTest.exists?("/etc/default/version")
+            txt = File.read("/etc/default/version")
+            if txt =~ /^PRODUCT='(.*?)\s/
+                $1
+            end
+        end
+    end
+end
+
+Facter.add(:operatingsystemrelease) do
+    confine :operatingsystem => %w{oVirt}
+    setcode do
+        if FileText.exists?("/etc/system-release")
+            txt = File.text("/etc/system-release")
+            if txt =~ /.*?release\s(.*?)\s/
+                $1
+            end
+        elsif FileTest.exists?("/etc/default/version")
+            txt = File.read("/etc/default/version")
+            if txt =~ /^VERSION=(.*)/
+                $1
+            else
+                "unknown"
+            end
+        end
+    end
+end
diff --git a/plugins/puppet/src/puppet_page.py b/plugins/puppet/src/puppet_page.py
new file mode 100644
index 0000000..8b81384
--- /dev/null
+++ b/plugins/puppet/src/puppet_page.py
@@ -0,0 +1,156 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# puppet_page.py - Copyright (C) 2013 Red Hat, Inc.
+# Written by Ryan Barry <rbarry 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 import plugins, valid, ui, utils
+from ovirt.node.config.defaults import NodeConfigFileSection
+from ovirt.node.plugins import Changeset
+import logging
+import socket
+import re
+
+"""
+Configure Puppet
+"""
+
+
+LOGGER = logging.getLogger(__name__)
+
+
+class Plugin(plugins.NodePlugin):
+    _server = None
+
+    def name(self):
+        return "Puppet"
+
+    def rank(self):
+        return 105
+
+    def model(self):
+        cfg = Puppet().retrieve()
+        model = {
+            "puppet.enabled": True if cfg["enabled"] else False,
+            "puppet.server": cfg["server"] or "puppet",
+            "puppet.certname": cfg["certname"] or socket.gethostname()
+        }
+        return model
+
+    def validators(self):
+        return {"puppet.server": valid.FQDNOrIPAddress() | valid.Empty(),
+                }
+
+    def ui_content(self):
+        ws = [ui.Header("header[0]", "Puppet Configuration"),
+              ui.Checkbox("puppet.enabled", "Enable Puppet"),
+              ui.Entry("puppet.server", "Puppet Server:"),
+              ui.Entry("puppet.certname", "Puppet Certificate Name"),
+              ui.Divider("divider[0]"),
+              ]
+
+        page = ui.Page("page", ws)
+        page.buttons = [ui.SaveButton("action.register", "Save & Run")]
+
+        self.widgets.add(page)
+        return page
+
+    def on_change(self, changes):
+        pass
+
+    def on_merge(self, effective_changes):
+        self.logger.info("Saving Puppet config")
+        changes = Changeset(self.pending_changes(False))
+        effective_model = Changeset(self.model())
+        effective_model.update(effective_changes)
+
+        puppet_keys = ["puppet.enabled", "puppet.server", "puppet.certname"]
+        if changes.contains_any(puppet_keys):
+            Puppet().update(*effective_model.values_for(puppet_keys))
+
+        self.logger.debug("Changes: %s" % changes)
+        self.logger.debug("Effective Model: %s" % effective_model)
+
+        txs = utils.Transaction("Configuring Puppet")
+
+        if effective_changes.contains_any(["action.register"]):
+            self.logger.debug("Connecting to puppet")
+            txs += [ActivatePuppet()]
+
+        if len(txs) > 0:
+            progress_dialog = ui.TransactionProgressDialog("dialog.txs", txs,
+                                                           self)
+            progress_dialog.run()
+
+        # Acts like a page reload
+        return self.ui_content()
+
+
+#
+#
+# Functions and classes to support the UI
+#
+#
+class Puppet(NodeConfigFileSection):
+    """Class to handle Puppet configuration in /etc/default/ovirt file
+
+    >>> from ovirt.node.config.defaults import ConfigFile, SimpleProvider
+    >>> fn = "/tmp/cfg_dummy"
+    >>> cfgfile = ConfigFile(fn, SimpleProvider)
+    >>> n = Puppet(cfgfile)
+    >>> n.update("puppet.example.com")
+    >>> sorted(n.retrieve().items())
+    [(server, 'puppet.example.com')]
+    """
+    keys = ("OVIRT_PUPPET_ENABLED",
+            "OVIRT_PUPPET_SERVER",
+            "OVIRT_PUPPET_CERTIFICATE_NAME"
+            )
+
+    @NodeConfigFileSection.map_and_update_defaults_decorator
+    def update(self, enabled, server, certname):
+        valid.Boolean()(enabled)
+        (valid.Empty() | valid.FQDNOrIPAddress())(server)
+        (valid.Empty() | valid.FQDN())(certname)
+        return {"OVIRT_PUPPET_ENABLED": "yes" if enabled else False}
+
+
+class ActivatePuppet(utils.Transaction.Element):
+
+    title = "Activating Puppet"
+
+    def commit(self):
+
+        self.logger.info("Connecting to Puppet server")
+
+        cfg = Puppet().retrieve()
+
+        with open("/etc/puppet/puppet.conf") as conf:
+            lines = conf.readlines()
+        with open("/etc/puppet/puppet.conf", "w") as conf:
+            for line in lines:
+                try:
+                    item = re.match(r'^\s+(\w+) =', line).group(1)
+                    if item in cfg:
+                        conf.write(re.sub(r'(^.*?' + item + ' =).*', r'\1 "' +
+                        cfg[item] + '"', line))
+                except:
+                    conf.write(line)
+
+        utils.process.call("service puppet stop")
+        utils.process.check_call("puppet agent --test")
+        utils.process.call("service puppet start")
diff --git a/src/ovirt/node/setup/.logging_page.py.swp b/src/ovirt/node/setup/.logging_page.py.swp
new file mode 100644
index 0000000..9ee0df9
--- /dev/null
+++ b/src/ovirt/node/setup/.logging_page.py.swp
Binary files differ


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icb639acf019a48e809fb983ab2124c6215c00157
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