[Et-mgmt-commits-list] [SCM] koan branch, master now at v0.2.9-48-g7962075

Michael DeHaan mdehaan at redhat.com
Fri Jul 20 14:30:09 UTC 2007


Hello,

This is an automated email from the git hooks/update script, it was
generated because a ref change was pushed to the repository.

Updating branch, master,
       via  7962075fe8e348206a014320926f41c0ddcadb0e (commit)
      from  20c8b7e4f95bc33e0693a979ca0abe18b9758555 (commit)

- Log -----------------------------------------------------------------
commit 7962075fe8e348206a014320926f41c0ddcadb0e
Author: Michael DeHaan <mdehaan at mdehaan.rdu.redhat.com>
Date:   Fri Jul 20 10:31:46 2007 -0400

    added note about koan moving and removed old files
    so no one uses the stale copy
-----------------------------------------------------------------------

Diffstat:
 AUTHORS             |   19 -
 CHANGELOG           |   74 ----
 COPYING             |  340 ---------------
 MANIFEST.in         |    3 -
 Makefile            |   36 --
 NEWS                |    1 -
 README              |    7 -
 TODO                |    7 -
 codepush.sh         |    3 -
 koan.pod            |  169 --------
 koan.spec           |  132 ------
 koan/app.py         |  929 -----------------------------------------
 koan/koan           |   38 --
 koan/qcreate.py     |   70 ----
 koan/sub_process.py | 1149 ---------------------------------------------------
 koan/xencreate.py   |   89 ----
 live/base.cfg       |  159 -------
 live/build.py       |  104 -----
 setup.py            |   34 --
 tests/tests.py      |   28 --
 20 files changed, 0 insertions(+), 3391 deletions(-)

diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index 5b46880..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,19 +0,0 @@
-  Koan Authors
-  ============
-
-Koan is written & maintained by:
-
-    Michael DeHaan <mdehaan at redhat.com>
-
-Patches and other contributions from:
-
-    Tru Huynh <tru at pasteur.fr>
-    Matt Hyclak <hyclak at math.ohiou.edu>
-    Mark McLoughlin <markmc at redhat.com>
-    Adam Rosenwald <thestrider at gmail.com>
-    Adam Wolf <adamwolf at feelslikeburning.com>
-    [...send patches to get your name here...]
-    
-
--- End
-
diff --git a/CHANGELOG b/CHANGELOG
deleted file mode 100644
index 10d3d79..0000000
--- a/CHANGELOG
+++ /dev/null
@@ -1,74 +0,0 @@
-Koan CHANGELOG
-
-* Mon Jul 16 2007 Michael DeHaan <mdehaan at redhat.com> - 0.5.1-1
-- added qemu/kvm with --virt-type
-- --virt-path support
-- added --display to dump cobbler objects without taking action
-- misc code & manpage cleanup
-
-* Wed Jun 27 2007 Michael DeHaan <mdehaan at redhat.com> - 0.5.0-1
-- Upgrades to take advantage of (and work with) Cobbler 0.5.0
-
-* Thu May 31 2007 Michael DeHaan <mdehaan at redhat.com> - 0.4.0-1
-- Change virt kernel/initrd download location to make SELinux happy
-
-* Fri Apr 26 2007 Michael DeHaan <mdehaan at redhat.com> - 0.3.1-2
-- Restore missing initrd build code for --replace-self
-- Remove stray character from app.py
-
-* Tue Apr 24 2007 Michael DeHaan <mdehaan at redhat.com> - 0.3.0-1
-- Fix error with --system
-- Fix IP vs MAC regex checking
-
-* Thu Apr 19 2007 Michael DeHaan <mdehaan at redhat.com> - 0.2.9-1
-- koan now speaks XMLRPC with cobbler (requires cobbler > 0.4.7-4)
-- allow any RAM size >128MB.
-- add --virtname option (see manpage)
-
-* Fri Mar 23 2007 Michael DeHaan <mdehaan at redhat.com> - 0.2.8-3
-- Remove redundant code for --virt-name handling.
-
-* Wed Mar 14 2007 Michael DeHaan <mdehaan at redhat.com> - 0.2.7-1
-- Use virtinst for installing Xen
-
-* Thu Jan 24 2007 Michael DeHaan <mdehaan at redhat.com> - 0.2.6-1
-- koan --list commands now sort output
-- Added warning text when koan fails to import virtualization modules
-
-* Fri Dec 08 2006 Michael DeHaan <mdehaan at redhat.com> - 0.2.5-1
-- Now probes bootloader to determine what bootloader to edit, rather
-  than using the first installed package.
-
-* Wed Oct 25 2006 Michael DeHaan <mdehaan at redhat.com> - 0.2.4-1
-- To be more generic, koan uses --virt instead of --xen now.  --xen
-  will continue to work for some time.  Cobbler has updated it's YAML
-  to correspond with the Xen->Virt renaming, and koan will be backward
-  compatible.  So, basically, users shouldn't be affected all that much.
-
-* Tue Oct 24 2006 Michael DeHaan <mdehaan at redhat.com> - 0.2.3-1
-- bugfixes related to missing kickstart and MAC info if not filled in
-  by the profile/system definition.
-
-* Wed Oct 11 2006 Michael DeHaan <mdehaan at redhat.com> - 0.2.2-1
-- Bundled subprocess to allow it's use under python 2.3 (RHEL4, etc)
-- Hack to koan's main app to allow enchant to tolerate more distros
-
-* Mon Oct 09 2006 Michael DeHaan <mdehaan at redhat.com> - 0.2.1-1
-- Added --list-profiles and --list-systems option to show available
-  setups defined on the provisioning server.  See manpage.
-
-* Wed Sep 20 2006 Michael DeHaan <mdehaan at redhat.com> - 0.1.1-7
-- When provisioning Xen, if --system is a MAC address, use that
-  as the Xen MAC address.
-- Fixes to command line argument conflict resolution
-- A few fixes (mainly along error paths)
-
-* Thu Jul 20 2006 Michael DeHaan <mdehaan at redhat.com> - 0.1.1-4
-- Fixed python import paths in yaml code, which errantly assumed yaml was installed as a module.
-
-* Fri Jul 12 2006 Michael DeHaan <mdehaan at redhat.com> - 0.1.1-3
-- allow installing with per-system cobbler data in addition to per-profile
-
-* Wed Jun 28 2006 Michael DeHaan <mdehaan at redhat.com> - 0.1.0-1
-- genesis
-
diff --git a/COPYING b/COPYING
deleted file mode 100644
index 08ddefd..0000000
--- a/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
-		    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 Lesser 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 Lesser General
-Public License instead of this License.
-
diff --git a/MANIFEST.in b/MANIFEST.in
deleted file mode 100644
index b6ceba8..0000000
--- a/MANIFEST.in
+++ /dev/null
@@ -1,3 +0,0 @@
-include koan.1.gz
-include CHANGELOG COPYING NEWS README AUTHORS
-include koan/koan
diff --git a/Makefile b/Makefile
deleted file mode 100644
index d0c1557..0000000
--- a/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-all: rpms
-
-clean:
-	-rm -f koan*.gz koan*.rpm MANIFEST
-	-rm -rf koan-* dist build
-	-rm -rf rpm-build
-	-rm -rf *~ *.pyc *.pyo
-
-manpage:
-	pod2man --center="koan" --release= koan.pod | gzip -c > koan.1.gz
-	pod2html koan.pod > koan.html
-
-test:
-	python tests/tests.py
-
-build: clean
-	python setup.py build -f
-
-install: build
-	python setup.py install -f
-
-sdist: manpage
-	python setup.py sdist
-
-rpms:  sdist
-	mkdir -p rpm-build
-	cp dist/*.gz rpm-build/
-	rpmbuild --define "_topdir %(pwd)/rpm-build" \
-	--define "_builddir %{_topdir}" \
-	--define "_rpmdir %{_topdir}" \
-	--define "_srcrpmdir %{_topdir}" \
-	--define '_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' \
-	--define "_specdir %{_topdir}" \
-	--define "_sourcedir  %{_topdir}" \
-	-ba koan.spec
-
diff --git a/NEWS b/NEWS
deleted file mode 100644
index b102b2a..0000000
--- a/NEWS
+++ /dev/null
@@ -1 +0,0 @@
-# this file intentionally left blank
diff --git a/README b/README
deleted file mode 100644
index debf338..0000000
--- a/README
+++ /dev/null
@@ -1,7 +0,0 @@
-Docs are currently available in two ways:
-
-- Install and run "man koan"
-- Run "perldoc koan.pod" from a source checkout
-
-To build the RPM:
-- Run "make"
diff --git a/TODO b/TODO
deleted file mode 100644
index 2cf37f0..0000000
--- a/TODO
+++ /dev/null
@@ -1,7 +0,0 @@
-- have the RPM own the directories it creates for xen
-  (doesn't already?)
-- put koan in /usr/share so we don't have to deal with
-  different python paths
-- think about cobbler override options 
-- LVM partition targets (?)
-
diff --git a/codepush.sh b/codepush.sh
deleted file mode 100644
index e4f84c5..0000000
--- a/codepush.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-scp rpm-build/*.rpm et.redhat.com:/var/www/sites/cobbler.et.redhat.com/download
-scp rpm-build/*.tar.gz et.redhat.com:/var/www/sites/cobbler.et.redhat.com/download
diff --git a/koan.pod b/koan.pod
deleted file mode 100644
index ae759b3..0000000
--- a/koan.pod
+++ /dev/null
@@ -1,169 +0,0 @@
-=head1 NAME
-
-koan stands for "kickstart-over-a-network" and allows for both network provisioning of new virtualized guests (Xen, QEMU/KVM) and re-installation of an existing system.  koan is a client side application used with a Cobbler boot server.
-
-=head1 SYNOPSIS
-
-koan --server=<host> [--list-profiles|--list-systems]
-
-koan --server=<host> [--virt|--replace-self|--display] [--profile=<name>|--system=<name>] [--virt-name=<name>] [--virt-path=<path>] [--virt-type=<type>] [--virt-graphics]
-
-=head1 DESCRIPTION
-
-When invoked, koan requests install information from a remote cobbler boot server.   What koan does with the profile data depends on whether it was invoked with --virt or --replace-self.
-
-=head1 THE COBBLER SERVER
-
-=over 
-
-=item --server
-
-Indicates the hostname of the Cobbler boot server to be contacted.  Successful
-communication requires that no firewalls are blocking the cobbler XMLRPC port,
-which is usually 25151, and that "cobblerd" is running on the cobbler server.
-
-This argument must be specified for all koan commands.
-
-=back
-
-=head1 LISTING AVAILABLE RESOURCES
-
-Lists of the resources that can be installed from a remote server can be obtained by using the following commands:
-
-=over
-
-=item --list-profiles
-
-Shows a list of profiles that can be remotely installed from the cobbler server.
-
-=item --list-systems
-
-Shows a list of systems that can be remotely installed from the cobbler server.  Systems contain the same information as profiles but may be further customized in terms of parameters or kickstart information.  The level of customization varies depending on what has been specified on the cobbler server.
-
-=back
-
-Example:  koan --server=cobbler.example.org --list-systems
-
-=back
-
-=head1 MAIN COMMANDS
-
-The commands --virt, --replace-self, and --display all take the following arguments:
-
-=over
-
-=item --profile
-
-Names a profile, known to cobbler, that is to be installed.
-
-=item --system
-
-Names a system, known to cobbler, that is to be installed.  --system cannot
-be used at the same time as --profile; pick one or the other.
-
-=back
-
-=head1 VIEWING THE INSTALLATION DATA
-
-In depth data about what is being installed can be viewed prior to
-kicking off an installation.  Use --display instead of --virt or
---replace-self.  When using this argument, specify the data to display
-with --profile or --system.
-
-Example:  koan --server=cobbler.example.org --display --profile=fedora7-xen-i386
-
-=head1 VIRTUALIZED INSTALLS
-
-When using --virt, koan will create new virtualized guests on a machine in accordance to the orders from cobbler.  You can then, once finished, use "virsh" and "xm" commands to access the guest.  These can be Xen or QEMU/KVM guests.
-
-Example:  koan --server=cobbler.example.org --virt --profile=fedora7-xen-i386
-
-If --profile is specified, cobbler will default to naming domains based on their mac addresses, using --system will use the exact name given to the cobbler system object.  To install using a more descriptive name, specify one with --virtname.  
-
-The additional parameters --virt-path, and --virt-type allow overriding certain defaults that are ordinarily defined by the remote cobbler server.
-
-Optional advanced-configuration parameters for --virt:
-
-=over
-
-=item --virt-name
-
-Overrides the name of the virtual machine.   This name must not conflict with
-other virtual machines running on the same system.   If not specified, cobbler
-will provide reasonable defaults.
-
-=item --virt-path
-
-(optional) Specifies the storage for the virtual image.  This path must be an absolute path of an existing directory in which to store the image, with an optional filename component.  
-
-There is also experimental support for specifying partitions such as "/dev/sda4".  Volume Groups with available free space can also be used by specifying a group name such as "VolGroup00".  Partitions should always start with /dev and Volume Groups should be represented by their names.
-
-=item --virt-type
-
-(optional) Koan can install virtual guests for Xen (paravirtualized), or QEMU/KVM (paravirtualized or fully virtualized based on hardware support).  Use --virt-type="kvm" or --virt-type="xenpv" to override the values already defined in cobbler.  Since this parameter can be set in the cobbler profile, it's best to just set it there.  See the cobbler manpage for more documentation.
-
-=item --virt-graphics
-
-(optional) This enables VNC graphics for virtual installs.  
-
-=back
-
-Example:  koan --server=cobbler.example.org --virt --profile=rhel5-x86_64 --virt-type="qemu" --virt-path="/home/username/qemu/" --virt-name="test_setup"
-
-=head1 REINSTALLATION 
-
-When using '--replace-self', cobbler will reprovision the system, blowing away any current data and replacing it with the results of a network install.  Specify a specific item from cobbler with --system or --profile, otherwise cobbler will try to see if there is a cobbler system record that matches a MAC address on the system.
-
-This is useful to reinstall systems in conditions where ordinary PXE is not possible.
-
-After using this feature, run "/sbin/reboot" to initiate the fully automatic reinstallation.
-
-Example:  koan --server=cobbler.example.org --profile=fedora7-xen-i386 --replace-self
-
-Example:  koan --server=cobbler.example.org --replace-self
-
-=head1 NOTES FOR USERS OF COBBLER TEMPLATING
-
-Cobbler contains a templating feature that allows a single kickstart file to be customized on a per-system basis.  See the cobbler manpage for more details.
-
-If you have system specific customizations in your kickstarts and have cobbler system definitions defined server side for those systems, use --system and not --profile, to request the more specific per-system information from Cobbler.
-
-=head1 NEW LIVE CD
-
-Koan's source checkout (see http://cobbler.et.redhat.com) can be used to build
-a live CD for use with koan.  This live CD serves the purpose of running
---replace-self with no OS present -- bare metal installation.  This tool may prove useful to emulate a PXE environment with a cobbler server, when no local DHCPconfiguration is not feasible or otherwise undesired.
-
-To build a CD (on Fedora 7):
-
-yum install livecd-tools
-
-git clone git://et.redhat.com/koan
-
-cd /checkout/koan
-
-make
-
-cd /checkout/koan/live
-
-python build.py --server=cobbler.example.org --koan="--profile=foo"
-
-# OR (for auto-detection)
-
-python build.py --server=cobbler.example.org --koan=""
-
-# burn the CD, and insert it in a bare metal machine
-
-The koan live CD is in the early stages of development and may not
-support all direct attached storage.  NOTE: Usage of the Live CD will
-erase all data on the first DASD disk during the course of provisioning.
-
-=head1 ADDITIONAL
-
-Consult the man page for cobbler for more information.
-
-=head1 AUTHOR
-
-Michael DeHaan <mdehaan at redhat.com>
-
-
diff --git a/koan.spec b/koan.spec
deleted file mode 100644
index 9e27009..0000000
--- a/koan.spec
+++ /dev/null
@@ -1,132 +0,0 @@
-%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
-
-Summary: Network provisioning tool for Xen and Bare Metal Machines 
-Name: koan
-Version: 0.5.1
-Release: 1%{?dist}
-Source0: %{name}-%{version}.tar.gz
-License: GPL
-Group: Applications/System
-Requires: mkinitrd
-Requires: syslinux
-Requires: python >= 2.2
-BuildRequires: python-devel
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-BuildArch: noarch
-ExcludeArch: ppc
-Url: http://cobbler.et.redhat.com/
-
-%description
-
-Koan stands for kickstart-over-a-network and allows for both
-network provisioning of new virtualized guests and destructive re-provisioning 
-of any existing system.  For use with a boot-server configured with
-'cobbler'
-
-%prep
-%setup -q
-
-%build
-%{__python} setup.py build
-
-%install
-test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
-%{__python} setup.py install --optimize=1 --root=$RPM_BUILD_ROOT
-
-%clean
-test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr(-,root,root)
-%dir /var/spool/koan
-%{_bindir}/koan
-%dir %{python_sitelib}/koan
-%{python_sitelib}/koan/*.py*
-%{_mandir}/man1/koan.1.gz
-
-%doc AUTHORS COPYING CHANGELOG README NEWS
-
-%changelog
-
-* Mon Jul 16 2007 Michael DeHaan <mdehaan at redhat.com> - 0.5.1-1
-- Upstream changes (see CHANGELOG)
-
-* Wed Jun 27 2007 Michael DeHaan <mdehaan at redhat.com> - 0.5.0-1
-- Upstream changes (see CHANGELOG)
-
-* Thu May 31 2007 Michael DeHaan <mdehaan at redhat.com> - 0.4.0-1
-- Upstream changes (see CHANGELOG)
-
-* Fri Apr 27 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.3.1-2
-- Upstream changes (see CHANGELOG)
-
-* Tue Apr 24 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.3.0-1
-- Upstream changes (see CHANGELOG)
-
-* Fri Apr 20 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.2.9-1
-- Upstream changes (see CHANGELOG)
-- Removed yaml packages
-
-* Fri Mar 23 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.2.8-2
-- Upstream changes (see CHANGELOG)
-
-* Wed Mar 08 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.2.7-1
-- Upstream changes (see CHANGELOG)
-
-* Wed Feb 28 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.2.6-2
-- BuildRequires python-devel for FC7
-
-* Thu Jan 24 2007 - Michael DeHaan <mdehaan at redhat.com> - 0.2.6-1
-- Upstream changes (see CHANGELOG)
-- Lowering python version number requirements
-
-* Fri Dec 08 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.5-1
-- Upstream changes (see CHANGELOG)
-- tweaked MANIFEST.in to appease rhel3 builds
-
-* Wed Oct 25 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.4-1
-- Upstream changes (see CHANGELOG)
-- Description update
-
-* Tue Oct 24 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.3-1
-- Upstream changes (see CHANGELOG)
-
-* Wed Oct 18 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.2-2
-- Use __python instead of python, test RPM dir before deletion
-- Update URLs
-
-* Mon Oct 09 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.2-1
-- Upstream change -- support Python 2.3
-
-* Mon Oct 09 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.2.1-1
-- Upstream features (see CHANGELOG)
-
-* Thu Sep 28 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-10
-- Bumping build rev for FC-E
-
-* Thu Sep 28 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-9
-- Excluding PPC since syslinux (gethostip) isn't available for ppc
-
-* Thu Sep 21 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-8
-- Added doc files to %%doc, removed INSTALLED_FILES code
-
-* Wed Sep 20 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-7
-- Upstream updates
-
-* Fri Sep 15 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-6
-- Make koan own it's directory, add GPL "COPYING" file.
-
-* Wed Aug 16 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-5
-- Spec-file only changes for FC-Extras submission
-
-* Thu Jul 20 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-4
-- Fixed python import paths in yaml code, which errantly assumed yaml was installed as a module.
-
-* Fri Jul 12 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.1-3
-- allow installing with per-system cobbler data in addition to per-profile
-
-* Thu Jul 09 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.0-2
-- rpm tweaks for Fedora Extras
-
-* Wed Jun 28 2006 - Michael DeHaan <mdehaan at redhat.com> - 0.1.0-1
-- rpm genesis
diff --git a/koan/__init__.py b/koan/__init__.py
deleted file mode 100644
index e69de29..0000000
diff --git a/koan/app.py b/koan/app.py
deleted file mode 100755
index 8ca8d83..0000000
--- a/koan/app.py
+++ /dev/null
@@ -1,929 +0,0 @@
-"""
-koan = kickstart over a network
-
-a tool for network provisioning of virtualization (xen,kvm/qemu) 
-and network re-provisioning of existing Linux systems.  
-used with 'cobbler'. see manpage for usage.
-
-Copyright 2006-2007 Red Hat, Inc.
-Michael DeHaan <mdehaan at redhat.com>
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import random
-import os
-import traceback
-import tempfile
-import urllib2
-import optparse
-import exceptions
-import sub_process
-import time
-import shutil
-import errno
-import re
-import sys
-import xmlrpclib
-import string
-import qcreate
-
-"""
-koan --virt [--profile=webserver|--system=name] --server=hostname
-koan --replace-self --profile=foo --server=hostname
-"""
-
-DISPLAY_PARAMS = [
-   "name",
-   "distro","profile",
-   "kernel","initrd",
-   "kernel_options","kickstart","ks_meta",
-   "repos",
-   "virt_ram","virt_disk","virt_type", "virt_path"
-]
-
-def main():
-    """
-    Command line stuff...
-    """
-    p = optparse.OptionParser()
-    p.add_option("-C", "--livecd",
-                 dest="live_cd",
-                 action="store_true",
-                 help="indicates koan is running from custom LiveCD")
-    p.add_option("-l", "--list-profiles",
-                 dest="list_profiles",
-                 action="store_true",
-                 help="list profiles the server can provision")
-    p.add_option("-L", "--list-systems",
-                 dest="list_systems",
-                 action="store_true",
-                 help="list systems the server can provision")
-    p.add_option("-v", "--virt",
-                 dest="is_virt",
-                 action="store_true",
-                 help="requests new virtualized image installation")
-    p.add_option("-V", "--virt-name",
-                 dest="virt_name",
-                 help="create the virtual guest with this name")
-    p.add_option("-r", "--replace-self",
-                 dest="is_replace",
-                 action="store_true",
-                 help="requests re-provisioning of this host")
-    p.add_option("-D", "--display",
-                 dest="is_display",
-                 action="store_true",
-                 help="display the configuration, don't install it")
-    p.add_option("-p", "--profile",
-                 dest="profile",
-                 help="cobbler profile to install")
-    p.add_option("-y", "--system",
-                 dest="system",
-                 help="cobbler system to install")
-    p.add_option("-s", "--server",
-                 dest="server",
-                 help="specify the cobbler server")
-    p.add_option("-t", "--port",
-                 dest="port",
-                 help="cobbler xmlrpc port (default 25151)")
-    p.add_option("-P", "--virt-path",
-                 dest="virt_path",
-                 help="virtual install location (see manpage)")  
-    p.add_option("-T", "--virt-type",
-                 dest="virt_type",
-                 help="specify virtualization install type (xenpv,qemu)")
-    p.add_option("-g", "--virt-graphics",
-                 action="store_true",
-                 dest="virt_graphics",
-                 help="enable virt graphics (varies with --virt-type)")
-    (options, args) = p.parse_args()
-
-    if not os.getuid() == 0:
-        print "koan requires root access"
-        return 3
-
-    try:
-        k = Koan()
-        k.list_systems      = options.list_systems
-        k.list_profiles     = options.list_profiles
-        k.server            = options.server
-        k.is_virt           = options.is_virt
-        k.is_replace        = options.is_replace
-        k.is_display        = options.is_display
-        k.profile           = options.profile
-        k.system            = options.system
-        k.live_cd           = options.live_cd
-        k.virt_path         = options.virt_path
-        k.virt_type         = options.virt_type
-        k.virt_graphics     = options.virt_graphics
-        if options.virt_name is not None:
-            k.virt_name          = options.virt_name
-        if options.port is not None:
-            k.port              = options.port
-        k.run()
-
-    except InfoException, ie:
-        print str(ie)
-        return 1
-    except:
-        traceback.print_exc()
-        return 3
-    return 0
-
-#=======================================================
-
-class InfoException(exceptions.Exception):
-    """
-    Custom exception for tracking of fatal errors.
-    """
-    pass
-
-#=======================================================
-
-class ServerProxy(xmlrpclib.ServerProxy):
-
-    def __init__(self, url=None):
-        xmlrpclib.ServerProxy.__init__(self, url, allow_none=True)
-
-#=======================================================
-
-class Koan:
-
-    def __init__(self):
-        """
-        Constructor.  Arguments will be filled in by optparse...
-        """
-        self.server            = None
-        self.system            = None
-        self.profile           = None
-        self.list_profiles     = None
-        self.list_systems      = None
-        self.is_virt           = None
-        self.is_replace        = None
-        self.dryrun            = None
-        self.port              = 25151
-        self.virt_name         = None
-        self.virt_type         = None
-        self.virt_path         = None 
-        self.virt_graphics     = None
-
-    #---------------------------------------------------
-
-    def run(self):
-        """
-        koan's main function...
-        """
-
-        # set up XMLRPC connection
-        if self.server is None:
-            raise InfoException, "no server specified"
-        url = "http://%s:%s" % (self.server, self.port)
-        self.xmlrpc_server = ServerProxy(url)
-
-        # if command line input was just for listing commands,
-        # run them now and quit
-        if self.list_systems:
-            self.list(False)
-            return
-        if self.list_profiles:
-            self.list(True)
-            return
-
-        # check to see that exclusive arguments weren't used together
-        found = 0
-        for x in (self.is_virt, self.is_replace, self.is_display):
-            if x:
-               found = found+1
-        if found != 1:
-            raise InfoException, "choose: --virt, --replace-self or --display"
-
-        # if both --profile and --system were ommitted, autodiscover
-        if (not self.profile and not self.system):
-            self.system = self.autodetect_system()
-
-        # if --virt-type was specified and invalid, then fail
-        if self.virt_type is not None:
-            if self.virt_type not in [ "qemu", "xenpv" ]:
-               raise InfoException, "--virttype should be qemu or xenpv"
-
-        # perform one of three key operations
-        if self.is_virt:
-            self.virt()
-        elif self.is_replace:
-            self.replace()
-        else:
-            self.display()
-    
-    #---------------------------------------------------
-
-    def autodetect_system(self):
-        """
-        Determine the name of the cobbler system record that
-        matches this MAC address.  FIXME: should use IP 
-        matching as secondary lookup eventually to be more PXE-like
-        """
-
-        fd = os.popen("/sbin/ifconfig")
-	mac = [line.strip() for line in fd.readlines()][0].split()[-1] #this needs to be replaced
-	fd.close()
-	if self.is_mac(mac) == False:
-		raise InfoException, "Mac address not accurately detected"
-	data = self.get_systems_xmlrpc()
-	detectedsystem = [system['name'] for system in data if system['mac_address'].upper() == mac.upper()]
-	if len(detectedsystem) > 1:
-		raise InfoException, "Multiple systems with matching mac addresses"
-	elif len(detectedsystem) == 0:
-		raise InfoException, "No system matching MAC address %s found" % mac
-	elif len(detectedsystem) == 1:
-		print "- Auto detected: %s" % detectedsystem[0]
-                return detectedsystem[0]
-    
-    #---------------------------------------------------
-
-    def urlread(self,url):
-        """
-        to support more distributions, implement (roughly) some 
-        parts of urlread and urlgrab from urlgrabber, in ways that
-        are less cool and less efficient.
-        """
-        fd = urllib2.urlopen(url)
-        data = fd.read()
-        fd.close()
-        return data
-
-    #---------------------------------------------------
-
-    def urlgrab(self,url,saveto):
-        """
-        like urlread, but saves contents to disk.
-        see comments for urlread as to why it's this way.
-        """
-        data = self.urlread(url)
-        fd = open(saveto, "w+")
-        fd.write(data)
-        fd.close()
-
-    #---------------------------------------------------
-
-    def subprocess_call(self,cmd,ignore_rc=False):
-        """
-        Wrapper around subprocess.call(...)
-        """
-        print "- %s" % cmd
-        rc = sub_process.call(cmd)
-        if rc != 0 and not ignore_rc:
-            raise InfoException, "command failed (%s)" % rc
-        return rc
-
-    #---------------------------------------------------
-
-    def safe_load(self,hash,primary_key,alternate_key=None,default=None):
-        if hash.has_key(primary_key): 
-            return hash[primary_key]
-        elif alternate_key is not None and hash.has_key(alternate_key):
-            return hash[alternate_key]
-        else:
-            return default
-
-    #---------------------------------------------------
-
-    def net_install(self,after_download):
-        """
-        Actually kicks off downloads and auto-ks or virt installs
-        """
-
-        # load the data via XMLRPC
-        if self.profile:
-            profile_data = self.get_profile_xmlrpc(self.profile)
-            filler = "kickstarts"
-        else:
-            profile_data = self.get_system_xmlrpc(self.system)
-            filler = "kickstarts_sys"
-        if profile_data.has_key("kickstart"):
-            if profile_data["kickstart"].startswith("/"):
-               profile_data["kickstart"] = "http://%s/cblr/%s/%s/ks.cfg" % (profile_data['server'], filler, profile_data['name'])
-       
-        # find the correct file download location 
-        if not self.is_virt:
-            download = "/boot"
-            if self.live_cd:
-                download = "/tmp/boot/boot"
-
-        else:
-            # ensure we have a good virt type choice and know where
-            # to download the kernel/initrd
-            if self.virt_type is None:
-                self.virt_type = self.safe_load(profile_data,'virt_type',default=None)
-            if self.virt_type is None or self.virt_type == "":
-                self.virt_type = 'xenpv'
-
-            if self.virt_type == "xenpv":
-                download = "/var/lib/xen" 
-            else:
-                # FIXME: should use temp dir to allow parallel installs?
-                download = "/var/spool/koan" 
-
-        # download required files
-        if not self.is_display:
-           self.get_distro_files(profile_data, download)
-  
-        # perform specified action
-        after_download(self, profile_data)
-
-    #---------------------------------------------------
-
-    def url_read(self,url):
-        fd = urllib2.urlopen(url)
-        data = fd.read()
-        fd.close()
-        return data
-    
-    #---------------------------------------------------
-
-    def list(self,is_profiles):
-        if is_profiles:
-            data = self.get_profiles_xmlrpc()
-        else:
-            data = self.get_systems_xmlrpc()
-        for x in data:
-            if x.has_key("name"):
-                print x["name"]
-        return True
-
-    #---------------------------------------------------
-
-    def display(self):
-        def after_download(self, profile_data):
-            for x in DISPLAY_PARAMS:
-                if profile_data.has_key(x):
-                    print "%20s  : %s" % (x, profile_data[x])
-        return self.net_install(after_download)
-
-    #---------------------------------------------------
-                 
-    def virt(self):
-        """
-        Handle virt provisioning.
-        """
-
-        def after_download(self, profile_data):
-            self.virt_net_install(profile_data)
-
-        return self.net_install(after_download)
-
-    #---------------------------------------------------
-
-    def replace(self):
-        """
-        Handle morphing an existing system through downloading new
-        kernel, new initrd, and installing a kickstart in the initrd,
-        then manipulating grub.
-        """
-        try:
-            shutil.rmtree("/var/spool/koan")
-        except OSError, (err, msg):
-            if err != errno.ENOENT:
-                raise
-        try:
-            os.makedirs("/var/spool/koan")
-        except OSError, (err, msg):
-            if err != errno.EEXIST:
-                raise
-
-        def after_download(self, profile_data):
-            if not os.path.exists("/sbin/grubby"):
-                raise InfoException, "grubby is not installed"
-            k_args = self.safe_load(profile_data,'kernel_options')
-            k_args = k_args + " ks=file:ks.cfg"
-
-            self.build_initrd(
-                self.safe_load(profile_data,'initrd_local'),
-                self.safe_load(profile_data,'kickstart'),
-                profile_data
-            )
-            k_args = k_args.replace("lang ","lang= ")
-
-            cmd = [ "/sbin/grubby", 
-                    "--bootloader-probe" ]
-
-            which_loader = sub_process.Popen(cmd, stdout=sub_process.PIPE).communicate()[0]
- 
-            loader = "--grub"
-            if which_loader.find("elilo") != -1:
-                loader = "--elilo"
-            elif which_loader.find("lilo") != -1:
-                loader = "--lilo"
-
-            cmd = [ "/sbin/grubby",
-                    loader,
-                    "--add-kernel", self.safe_load(profile_data,'kernel_local'),
-                    "--initrd", self.safe_load(profile_data,'initrd_local'),
-                    "--make-default",
-                    "--title", "kick%s" % int(time.time()),
-                    "--args", k_args,
-                    "--copy-default"
-            ]
-            if self.live_cd:
-               cmd.append("--bad-image-okay")
-               cmd.append("--boot-filesystem=/dev/sda1")
-               cmd.append("--config-file=/tmp/boot/boot/grub/grub.conf")
-            self.subprocess_call(cmd)
-
-            if loader == "--lilo":
-                print "- applying lilo changes"
-                cmd = [ "/sbin/lilo" ]
-                sub_process.Popen(cmd, stdout=sub_process.PIPE).communicate()[0]
-
-            print "- reboot to apply changes"
-
-
-        return self.net_install(after_download)
-
-    #---------------------------------------------------
-
-    def get_kickstart_data(self,kickstart,data):
-        """
-        Get contents of data in network kickstart file.
-        """
-        print "- kickstart: %s" % kickstart
-        if kickstart is None or kickstart == "":
-            return None
-
-        if kickstart.startswith("nfs"):
-            ndir  = os.path.dirname(kickstart[6:])
-            nfile = os.path.basename(kickstart[6:])
-            nfsdir = tempfile.mkdtemp(prefix="koan_nfs",dir="/tmp")
-            nfsfile = os.path.join(nfsdir,nfile)
-            cmd = ["mount","-t","nfs","-o","ro", ndir, nfsdir]
-            self.subprocess_call(cmd)
-            fd = open(nfsfile)
-            data = fd.read()
-            fd.close()
-            cmd = ["umount",nfsdir]
-            self.subprocess_call(cmd)
-            return data
-        elif kickstart.startswith("http") or kickstart.startswith("ftp"):
-            print "- downloading %s" % kickstart
-            try:
-                return self.urlread(kickstart)
-            except:
-                raise InfoException, "Couldn't download: %s" % kickstart
-        else:
-            raise InfoException, "invalid kickstart URL"
-
-    #---------------------------------------------------
-
-    def get_insert_script(self,initrd):
-        """
-        Create bash script for inserting kickstart into initrd.
-        Code heavily borrowed from internal auto-ks scripts.
-        """
-        return """
-        cd /var/spool/koan
-        mkdir initrd
-        gzip -dc %s > initrd.tmp
-        if file initrd.tmp | grep "filesystem data" >& /dev/null; then
-            mount -o loop -t ext2 initrd.tmp initrd
-            cp ks.cfg initrd/
-            ln initrd/ks.cfg initrd/tmp/ks.cfg
-            umount initrd
-            gzip -c initrd.tmp > initrd_final
-        else
-            echo "cpio"
-            cat initrd.tmp | (
-               cd initrd ; \
-               cpio -id ; \
-               cp /var/spool/koan/ks.cfg . ; \
-               ln ks.cfg tmp/ks.cfg ; \
-               find . | \
-               cpio -c -o | gzip -9 ) \
-            > initrd_final
-            echo "done"
-        fi
-        """ % initrd
-
-    #---------------------------------------------------
-
-    def build_initrd(self,initrd,kickstart,data):
-        """
-        Crack open an initrd and install the kickstart file.
-        """
-
-        # save kickstart to file
-        ksdata = self.get_kickstart_data(kickstart,data)
-        fd = open("/var/spool/koan/ks.cfg","w+")
-        if ksdata is not None:
-            fd.write(ksdata)
-        fd.close()
-
-        # handle insertion of kickstart based on type of initrd
-        fd = open("/var/spool/koan/insert.sh","w+")
-        fd.write(self.get_insert_script(initrd))
-        fd.close()
-        self.subprocess_call([ "/bin/bash", "/var/spool/koan/insert.sh" ])
-        shutil.copyfile("/var/spool/koan/initrd_final", initrd)
-
-    #---------------------------------------------------
-
-    def connect_fail(self):
-        raise InfoException, "Could not communicate with %s:%s" % (self.server, self.port)
-
-    #---------------------------------------------------
-
-    def get_profiles_xmlrpc(self):
-        try:
-            data = self.xmlrpc_server.get_profiles()
-        except:
-            traceback.print_exc()
-            self.connect_fail()
-        if data == {}:
-            raise InfoException("No profiles found on cobbler server")
-        return data
-
-    #---------------------------------------------------
-
-    def get_profile_xmlrpc(self,profile_name):
-        """
-        Fetches profile yaml from a from a remote bootconf tree.
-        """
-        try:
-            data = self.xmlrpc_server.get_profile_for_koan(profile_name)
-        except:
-            traceback.print_exc()
-            self.connect_fail()
-        if data == {}:
-            raise InfoException("no cobbler entry for this profile")
-        return data
-
-    #---------------------------------------------------
-
-    def get_systems_xmlrpc(self):
-        try:
-            return self.xmlrpc_server.get_systems()
-        except:
-            traceback.print_exc()
-            self.connect_fail()
-
-    #---------------------------------------------------
-
-    def is_ip(self,strdata):
-        """
-        Is strdata an IP?
-        warning: not IPv6 friendly
-        """
-        if re.search(r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}',strdata):
-            return True
-        return False
-
-    #---------------------------------------------------
-
-    def is_mac(self,strdata):
-        """
-        Return whether the argument is a mac address.
-        """
-        if strdata is None:
-            return False
-        strdata = strdata.upper()
-        if re.search(r'[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}:[A-F0-9]{2}:[A-F:0-9]{2}:[A-F:0-9]{2}',strdata):
-            return True
-        return False
-
-    #---------------------------------------------------
-
-    def get_system_xmlrpc(self,system_name):
-        """
-        If user specifies --system, return the profile data
-        but use the system kickstart and kernel options in place
-        of what was specified in the system's profile.
-        """
-        system_data = None
-        try:
-            system_data = self.xmlrpc_server.get_system_for_koan(system_name)
-        except:
-            traceback.print_exc()
-            self.connect_fail()
-        if system_data == {}:
-            raise InfoException("no cobbler entry for system")        
-        return system_data
-
-    #---------------------------------------------------
-
-    def get_distro_files(self,profile_data, download_root):
-        """
-        Using distro data (fetched from bootconf tree), determine
-        what kernel and initrd to download, and save them locally.
-        """
-        os.chdir(download_root)
-        distro = self.safe_load(profile_data,'distro')
-        kernel = self.safe_load(profile_data,'kernel')
-        initrd = self.safe_load(profile_data,'initrd')
-        kernel_short = os.path.basename(kernel)
-        initrd_short = os.path.basename(initrd)
-        kernel_save = "%s/%s" % (download_root, kernel_short)
-        initrd_save = "%s/%s" % (download_root, initrd_short)
-        try:
-            print "downloading initrd %s to %s" % (initrd_short, initrd_save)
-            url = "http://%s/cobbler/images/%s/%s" % (self.server, distro, initrd_short)
-            print "url=%s" % url
-            self.urlgrab(url,initrd_save)
-            print "downloading kernel %s to %s" % (kernel_short, kernel_save)
-            url = "http://%s/cobbler/images/%s/%s" % (self.server, distro, kernel_short)
-            print "url=%s" % url
-            self.urlgrab(url,kernel_save)
-        except:
-            raise InfoException, "error downloading files"
-        profile_data['kernel_local'] = kernel_save
-        print "kernel saved = %s" % kernel_save
-        profile_data['initrd_local'] = initrd_save
-        print "initrd saved = %s" % initrd_save
-
-    #---------------------------------------------------
-
-    def virt_net_install(self,profile_data):
-        """
-        Invoke virt guest-install (or tweaked copy thereof)
-        """
-        pd = profile_data
-
-        kextra = ""
-        lkickstart = self.safe_load(pd,'kickstart')
-        loptions   = self.safe_load(pd,'kernel_options')
-        if lkickstart != "" or loptions != "":
-            if lkickstart != "":
-                kextra = kextra + "ks=" + lkickstart
-            if lkickstart !="" and loptions !="":
-                kextra = kextra + " "
-            if loptions != "":
-                kextra = kextra + loptions
-
-        # parser issues?  lang needs a trailing = and somehow doesn't have it.
-        kextra = kextra.replace("lang ","lang= ")
-
-        if self.virt_type == "xenpv":
-            try:
-                import xencreate
-            except:
-                print "no virtualization support available, install python-virtinst?"
-                sys.exit(1)
-
-        # if the object has a "profile" entry, then it's a system
-        # and we pass in the name straight.  If it's not, pass in None
-        # for the Name, such that we can use the MAC or the override value.
-        pro = self.safe_load(pd,'profile')
-        if pro is None or pro == "":
-            # this is a system object, use name as entered
-            name = self.safe_load(pd,'name')
-        else:
-            # this is a profile object, use MAC or override value
-            name = None
-
-        mac = self.calc_virt_mac(pd)
-        if self.virt_type == "xenpv":
-            uuid    = xencreate.get_uuid(self.calc_virt_uuid(pd))
-            creator = xencreate.start_paravirt_install
-        elif self.virt_type == "qemu":
-            uuid    = None
-            creator = qcreate.start_install
-        else:
-            raise InfoException, "Unspecified virt type: %s" % self.virt_type
-
-        virtname = self.calc_virt_name(pd,mac)
-        (path, special)       =  self.calc_virt_path(pd, virtname)
-
-        results = creator(
-                name          =  virtname,
-                ram           =  self.calc_virt_ram(pd),
-                disk          =  self.calc_virt_filesize(pd),
-                mac           =  mac,
-                uuid          =  uuid,
-                kernel        =  self.safe_load(pd,'kernel_local'),
-                initrd        =  self.safe_load(pd,'initrd_local'),
-                extra         =  kextra,
-                vcpus         =  self.calc_virt_cpus(pd),
-                path          =  path,
-                virt_graphics =  self.virt_graphics,
-                special_disk  =  special
-        )
-
-        print results
-
-    #---------------------------------------------------
-
-    def calc_virt_name(self,profile_data,mac):
-        if self.virt_name is not None:
-           # explicit override
-           return self.virt_name
-        if profile_data.has_key("mac_address"):
-           # this is a system object, just use the name
-           return profile_data["name"]
-        # just use the MAC, which we might have generated
-        return mac.replace(":","_").upper()
-
-    #---------------------------------------------------
-
-    def calc_virt_filesize(self,data,default_filesize=1):
-        """
-        Assign a virt filesize if none is given in the profile.
-        """
-        size = self.safe_load(data,'virt_file_size','xen_file_size',0)
-        err = False
-        try:
-            int(size)
-        except:
-            err = True
-        if size is None or size == '' or int(size)<default_filesize:
-            err = True
-        if err:
-            print "invalid file size specified, using defaults"
-            return default_filesize
-        return int(size)
-
-    #---------------------------------------------------
-
-    def calc_virt_ram(self,data,default_ram=64):
-        """
-        Assign a virt ram size if none is given in the profile.
-        """
-        size = self.safe_load(data,'virt_ram','xen_ram',0)
-        err = False
-        try:
-            int(size)
-        except:
-            err = True
-        if size is None or size == '' or int(size) < default_ram:
-            err = True
-        if err:
-            print "invalid RAM size specified, using defaults."
-            return default_ram
-        return int(size)
-
-    #---------------------------------------------------
-
-    def calc_virt_cpus(self,data,default_cpus=1):
-        """
-        Assign virtual CPUs if none is given in the profile.
-        """
-        size = self.safe_load(data,'virt_cpus','xen_cpus',0)
-        err = False
-        try:
-            int(size)
-        except:
-            err = True
-        if size is None or size == '' or int(size) < default_cpus:
-            err = True
-        if err:
-            print "invalid number of VCPUS specified, using defaults"
-            return default_cpus
-        return int(size)
-
-    #---------------------------------------------------
-
-    def calc_virt_mac(self,data):
-        if not self.is_virt:
-            return None # irrelevant 
-        if self.is_mac(self.system):
-            return self.system.upper()
-        return self.random_mac()
-
-    #---------------------------------------------------
-
-    def calc_virt_uuid(self,data):
-        # TODO: eventually we may want to allow some koan CLI
-        # option (or cobbler system option) for passing in the UUID.  
-        # Until then, it's random.
-        return None
-        """
-        Assign a UUID if none/invalid is given in the profile.
-        """
-        id = self.safe_load(data,'virt_uuid','xen_uuid',0)
-        uuid_re = re.compile('[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}')
-        err = False
-        try:
-            str(id)
-        except:
-            err = True
-        if id is None or id == '' or not uuid_re.match(id):
-            err = True
-        if err and id is not None:
-            print "invalid UUID specified.  randomizing..."
-            return None
-        return id
-
-    #---------------------------------------------------
-
-    def random_mac(self):
-        """
-        from xend/server/netif.py
-        Generate a random MAC address.
-        Uses OUI 00-16-3E, allocated to
-        Xensource, Inc.  Last 3 fields are random.
-        return: MAC address string
-        """
-        mac = [ 0x00, 0x16, 0x3e,
-            random.randint(0x00, 0x7f),
-            random.randint(0x00, 0xff),
-            random.randint(0x00, 0xff) ]
-        return ':'.join(map(lambda x: "%02x" % x, mac))
-
-
-    #---------------------------------------------------
-
-    def calc_virt_path(self,pd,name):
-        """
-        Assign virtual disk location.
-        """
-
-        location = self.virt_path
-
-        # determine if any suggested location info is available
-        if location is None:
-            # no explicit CLI override, what did the cobbler server say?
-            location = self.safe_load(pd, 'virt_path', default=None)
-        if location is None or location == "":  
-            # not set in cobbler either? then assume reasonable defaults
-            location = None            
-            if location == None:
-                if self.virt_type == "xenpv":
-                    prefix = "/var/lib/xen/images/"
-                elif self.virt_type == "qemu":
-                    prefix = "/opt/qemu/"
-                if not os.path.exists(prefix):
-                    os.makedirs(prefix)
-                return ("%s/%s" % (prefix, name), False)
-
-        # Parse the command line to determine if this is a 
-        # path, a partition, or a volume group parameter
-        #   Ex:   /foo
-        #   Ex:   partition:/dev/foo
-        #   Ex:   volume-group:/dev/foo/
-            
-        # chosing the disk image name (if applicable) is somewhat
-        # complicated ...
-
-        # use default location for the virt type
-
-        if not location.startswith("/dev/") and location.startswith("/"):
-            # filesystem path
-            if os.path.isdir(location):
-                return ("%s/%s" % (location, name), False)
-            elif not os.path.exists(location) and os.path.isdir(os.path.dirname(location)):
-                return (location, False)
-            else:
-                raise InfoException, "invalid location: %s" % location                
-        elif location.startswith("/dev/"):
-            # partition
-            if os.path.exists(location):
-                return (location, True)
-            else:
-                raise InfoException, "virt path is not a valid block device"
-        else:
-            # it's a volume group, verify that it exists
-            args = "/usr/sbin/vgs -o vg_name"
-            print "%s" % args
-            vgnames = sub_process.Popen(args, shell=True, stdout=sub_process.PIPE).communicate()[0]
-            print vgnames
-
-            if vgnames.find(location) == -1:
-                raise InfoException, "The volume group [%s] does not exist." % location
-            
-            # check free space
-            args = "/usr/sbin/lvs --noheadings -o vg_free --units g %s" % location
-            print args
-            cmd = sub_process.Popen(args, stdout=sub_process.PIPE, shell=True)
-            freespace_str = cmd.communicate()[0]
-            freespace_str = freespace_str.split("\n")[0].strip()
-            freespace_str = freespace_str.replace("G","") # remove gigabytes
-            print "(%s)" % freespace_str
-            freespace = int(float(freespace_str))
-
-            virt_size = self.safe_load(pd,'virt_file_size','xen_file_size',5)
-           
-            if freespace >= int(virt_size):
-            
-                # look for LVM partition named foo, create if doesn't exist
-                args = "/usr/sbin/lvs -o lv_name %s" % location
-                print "%s" % args
-                lvs_str=sub_process.Popen(args, stdout=sub_process.PIPE, shell=True).communicate()[0]
-                print lvs_str
-          
-                # have to create it?
-                if lvs_str.find(name) == -1:
-                    args = "/usr/sbin/lvcreate -L %sG -n %s %s" % (virt_size, name, location)
-                    print "%s" % args
-                    lv_create = sub_process.call(args, shell=True)
-                    if lv_create != 0:
-                        raise InfoException, "LVM creation failed"
-
-                # return partition location
-                return ("/dev/mapper/%s-%s" % (location,name), True)
-            else:
-                raise InfoException, "volume group [%s] needs %s GB free space." % virt_size
-
-
-if __name__ == "__main__":
-    main()
diff --git a/koan/koan b/koan/koan
deleted file mode 100755
index 594e137..0000000
--- a/koan/koan
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/python
-
-"""
-Koan wrapper script.  See 'man koan' for details.
-
-Copyright 2006 Red Hat, Inc.
-Michael DeHaan <mdehaan at redhat.com>
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import sys
-
-# ok, about this sys.path voodoo...
-# ordinarily cobbler and koan are intended for FC-5/6 and derivs
-#
-# this hack makes "cobbler enchant" using FC-5 RPMs work on 
-# python 2.3 distros as well when installed with --nodeps.
-# yes, I know it looks evil.  It IS evil.
-#
-# though since "enchant" is there to blow away a system, evil is allowed.
-# eventually "cobbler enchant" may be modified to not need the koan rpm.
-#
-# when using koan normally, the RPM will be built for the proper distro
-# and this code will be mostly harmless.
-
-for version in [ "2.2", "2.3", "2.4", "2.5" ]:
-    for arch in [ "lib", "lib64" ]:
-        append = "/usr/%s/python%s/site-packages" % (arch,version)
-        sys.path.append(append)
-
-import koan.app as app
-sys.exit(app.main() or 0)
diff --git a/koan/qcreate.py b/koan/qcreate.py
deleted file mode 100755
index 59c89b4..0000000
--- a/koan/qcreate.py
+++ /dev/null
@@ -1,70 +0,0 @@
-# Virtualization installation functions.  
-#
-# Copyright 2007 Red Hat, Inc.
-# Michael DeHaan <mdehaan at redhat.com>
-#
-# This software may be freely redistributed under the terms of the GNU
-# general public license.
-#
-# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-import os, sys, time, stat
-import tempfile
-import random
-from optparse import OptionParser
-import exceptions
-import errno
-import re
-
-class VirtCreateException(exceptions.Exception):
-    pass
-
-def start_install(name=None, ram=None, disk=None, mac=None,
-                  uuid=None, kernel=None, initrd=None, 
-                  extra=None, path=None,
-                  vcpus=None, virt_graphics=None, special_disk=False):
-
-    if os.path.isdir(path):
-       path = os.path.join(path, name)
-     
-    if not special_disk and os.path.exists(path):
-       msg = "ERROR: disk path (%s) exists. " % path
-       msg = msg + "You can delete it, try a "
-       msg = msg + "different --virt-path, or specify a different --virt-name."
-       msg = msg + "However, koan will not overwrite an existing file."
-       return msg
-
-    if not special_disk:
-        cmd = "qemu-img create -f qcow2 %s %sG" % (path, disk)
-        rc = os.system(cmd)
-
-        if rc != 0:
-            return "image creation failed"
-
-    print "- starting background install to %s" % path
-    if virt_graphics:
-        print "- access your installation with vncviewer :0"
-    print "- restart with qemu-kvm -hda %s -m %s" % (path, ram)
-
-    cmd2 = "qemu-kvm -m %s -hda %s" % (ram,path)
-    cmd2 = cmd2  + " -kernel %s" % (kernel)
-    cmd2 = cmd2  + " -initrd %s" % (initrd)
-    cmd2 = cmd2  + " -net nic,macaddr=%s -net user" % (mac)
-    cmd2 = cmd2  + " -daemonize -append \"%s\"" % (extra)
-
-    if virt_graphics:
-        # FIXME: detect vnc collisions?
-        cmd2 = cmd2  + " -vnc :0 -serial vc -monitor vc"
-    else:
-        cmd2 = cmd2  + " -nographic"
-
-    print cmd2
-
-    rc2 = os.system(cmd2)
-    if rc2 != 0:
-       return "installation failed"
-
-    return "installation complete"
-
diff --git a/koan/sub_process.py b/koan/sub_process.py
deleted file mode 100644
index bbd26c7..0000000
--- a/koan/sub_process.py
+++ /dev/null
@@ -1,1149 +0,0 @@
-# subprocess - Subprocesses with accessible I/O streams
-#
-# For more information about this module, see PEP 324.
-#
-# This module should remain compatible with Python 2.2, see PEP 291.
-#
-# Copyright (c) 2003-2005 by Peter Astrand <astrand at lysator.liu.se>
-#
-# Licensed to PSF under a Contributor Agreement.
-# See http://www.python.org/2.4/license for licensing details.
-
-r"""subprocess - Subprocesses with accessible I/O streams
-
-This module allows you to spawn processes, connect to their
-input/output/error pipes, and obtain their return codes.  This module
-intends to replace several other, older modules and functions, like:
-
-os.system
-os.spawn*
-os.popen*
-popen2.*
-commands.*
-
-Information about how the subprocess module can be used to replace these
-modules and functions can be found below.
-
-
-
-Using the subprocess module
-===========================
-This module defines one class called Popen:
-
-class Popen(args, bufsize=0, executable=None,
-            stdin=None, stdout=None, stderr=None,
-            preexec_fn=None, close_fds=False, shell=False,
-            cwd=None, env=None, universal_newlines=False,
-            startupinfo=None, creationflags=0):
-
-
-Arguments are:
-
-args should be a string, or a sequence of program arguments.  The
-program to execute is normally the first item in the args sequence or
-string, but can be explicitly set by using the executable argument.
-
-On UNIX, with shell=False (default): In this case, the Popen class
-uses os.execvp() to execute the child program.  args should normally
-be a sequence.  A string will be treated as a sequence with the string
-as the only item (the program to execute).
-
-On UNIX, with shell=True: If args is a string, it specifies the
-command string to execute through the shell.  If args is a sequence,
-the first item specifies the command string, and any additional items
-will be treated as additional shell arguments.
-
-On Windows: the Popen class uses CreateProcess() to execute the child
-program, which operates on strings.  If args is a sequence, it will be
-converted to a string using the list2cmdline method.  Please note that
-not all MS Windows applications interpret the command line the same
-way: The list2cmdline is designed for applications using the same
-rules as the MS C runtime.
-
-bufsize, if given, has the same meaning as the corresponding argument
-to the built-in open() function: 0 means unbuffered, 1 means line
-buffered, any other positive value means use a buffer of
-(approximately) that size.  A negative bufsize means to use the system
-default, which usually means fully buffered.  The default value for
-bufsize is 0 (unbuffered).
-
-stdin, stdout and stderr specify the executed programs' standard
-input, standard output and standard error file handles, respectively.
-Valid values are PIPE, an existing file descriptor (a positive
-integer), an existing file object, and None.  PIPE indicates that a
-new pipe to the child should be created.  With None, no redirection
-will occur; the child's file handles will be inherited from the
-parent.  Additionally, stderr can be STDOUT, which indicates that the
-stderr data from the applications should be captured into the same
-file handle as for stdout.
-
-If preexec_fn is set to a callable object, this object will be called
-in the child process just before the child is executed.
-
-If close_fds is true, all file descriptors except 0, 1 and 2 will be
-closed before the child process is executed.
-
-if shell is true, the specified command will be executed through the
-shell.
-
-If cwd is not None, the current directory will be changed to cwd
-before the child is executed.
-
-If env is not None, it defines the environment variables for the new
-process.
-
-If universal_newlines is true, the file objects stdout and stderr are
-opened as a text files, but lines may be terminated by any of '\n',
-the Unix end-of-line convention, '\r', the Macintosh convention or
-'\r\n', the Windows convention.  All of these external representations
-are seen as '\n' by the Python program.  Note: This feature is only
-available if Python is built with universal newline support (the
-default).  Also, the newlines attribute of the file objects stdout,
-stdin and stderr are not updated by the communicate() method.
-
-The startupinfo and creationflags, if given, will be passed to the
-underlying CreateProcess() function.  They can specify things such as
-appearance of the main window and priority for the new process.
-(Windows only)
-
-
-This module also defines two shortcut functions:
-
-call(*args, **kwargs):
-    Run command with arguments.  Wait for command to complete, then
-    return the returncode attribute.
-
-    The arguments are the same as for the Popen constructor.  Example:
-
-    retcode = call(["ls", "-l"])
-
-
-Exceptions
-----------
-Exceptions raised in the child process, before the new program has
-started to execute, will be re-raised in the parent.  Additionally,
-the exception object will have one extra attribute called
-'child_traceback', which is a string containing traceback information
-from the childs point of view.
-
-The most common exception raised is OSError.  This occurs, for
-example, when trying to execute a non-existent file.  Applications
-should prepare for OSErrors.
-
-A ValueError will be raised if Popen is called with invalid arguments.
-
-
-Security
---------
-Unlike some other popen functions, this implementation will never call
-/bin/sh implicitly.  This means that all characters, including shell
-metacharacters, can safely be passed to child processes.
-
-
-Popen objects
-=============
-Instances of the Popen class have the following methods:
-
-poll()
-    Check if child process has terminated.  Returns returncode
-    attribute.
-
-wait()
-    Wait for child process to terminate.  Returns returncode attribute.
-
-communicate(input=None)
-    Interact with process: Send data to stdin.  Read data from stdout
-    and stderr, until end-of-file is reached.  Wait for process to
-    terminate.  The optional stdin argument should be a string to be
-    sent to the child process, or None, if no data should be sent to
-    the child.
-
-    communicate() returns a tuple (stdout, stderr).
-
-    Note: The data read is buffered in memory, so do not use this
-    method if the data size is large or unlimited.
-
-The following attributes are also available:
-
-stdin
-    If the stdin argument is PIPE, this attribute is a file object
-    that provides input to the child process.  Otherwise, it is None.
-
-stdout
-    If the stdout argument is PIPE, this attribute is a file object
-    that provides output from the child process.  Otherwise, it is
-    None.
-
-stderr
-    If the stderr argument is PIPE, this attribute is file object that
-    provides error output from the child process.  Otherwise, it is
-    None.
-
-pid
-    The process ID of the child process.
-
-returncode
-    The child return code.  A None value indicates that the process
-    hasn't terminated yet.  A negative value -N indicates that the
-    child was terminated by signal N (UNIX only).
-
-
-Replacing older functions with the subprocess module
-====================================================
-In this section, "a ==> b" means that b can be used as a replacement
-for a.
-
-Note: All functions in this section fail (more or less) silently if
-the executed program cannot be found; this module raises an OSError
-exception.
-
-In the following examples, we assume that the subprocess module is
-imported with "from subprocess import *".
-
-
-Replacing /bin/sh shell backquote
----------------------------------
-output=`mycmd myarg`
-==>
-output = Popen(["mycmd", "myarg"], stdout=PIPE).communicate()[0]
-
-
-Replacing shell pipe line
--------------------------
-output=`dmesg | grep hda`
-==>
-p1 = Popen(["dmesg"], stdout=PIPE)
-p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
-output = p2.communicate()[0]
-
-
-Replacing os.system()
----------------------
-sts = os.system("mycmd" + " myarg")
-==>
-p = Popen("mycmd" + " myarg", shell=True)
-sts = os.waitpid(p.pid, 0)
-
-Note:
-
-* Calling the program through the shell is usually not required.
-
-* It's easier to look at the returncode attribute than the
-  exitstatus.
-
-A more real-world example would look like this:
-
-try:
-    retcode = call("mycmd" + " myarg", shell=True)
-    if retcode < 0:
-        print >>sys.stderr, "Child was terminated by signal", -retcode
-    else:
-        print >>sys.stderr, "Child returned", retcode
-except OSError, e:
-    print >>sys.stderr, "Execution failed:", e
-
-
-Replacing os.spawn*
--------------------
-P_NOWAIT example:
-
-pid = os.spawnlp(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg")
-==>
-pid = Popen(["/bin/mycmd", "myarg"]).pid
-
-
-P_WAIT example:
-
-retcode = os.spawnlp(os.P_WAIT, "/bin/mycmd", "mycmd", "myarg")
-==>
-retcode = call(["/bin/mycmd", "myarg"])
-
-
-Vector example:
-
-os.spawnvp(os.P_NOWAIT, path, args)
-==>
-Popen([path] + args[1:])
-
-
-Environment example:
-
-os.spawnlpe(os.P_NOWAIT, "/bin/mycmd", "mycmd", "myarg", env)
-==>
-Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"})
-
-
-Replacing os.popen*
--------------------
-pipe = os.popen(cmd, mode='r', bufsize)
-==>
-pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout
-
-pipe = os.popen(cmd, mode='w', bufsize)
-==>
-pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin
-
-
-(child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize)
-==>
-p = Popen(cmd, shell=True, bufsize=bufsize,
-          stdin=PIPE, stdout=PIPE, close_fds=True)
-(child_stdin, child_stdout) = (p.stdin, p.stdout)
-
-
-(child_stdin,
- child_stdout,
- child_stderr) = os.popen3(cmd, mode, bufsize)
-==>
-p = Popen(cmd, shell=True, bufsize=bufsize,
-          stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True)
-(child_stdin,
- child_stdout,
- child_stderr) = (p.stdin, p.stdout, p.stderr)
-
-
-(child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize)
-==>
-p = Popen(cmd, shell=True, bufsize=bufsize,
-          stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True)
-(child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout)
-
-
-Replacing popen2.*
-------------------
-Note: If the cmd argument to popen2 functions is a string, the command
-is executed through /bin/sh.  If it is a list, the command is directly
-executed.
-
-(child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode)
-==>
-p = Popen(["somestring"], shell=True, bufsize=bufsize
-          stdin=PIPE, stdout=PIPE, close_fds=True)
-(child_stdout, child_stdin) = (p.stdout, p.stdin)
-
-
-(child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode)
-==>
-p = Popen(["mycmd", "myarg"], bufsize=bufsize,
-          stdin=PIPE, stdout=PIPE, close_fds=True)
-(child_stdout, child_stdin) = (p.stdout, p.stdin)
-
-The popen2.Popen3 and popen3.Popen4 basically works as subprocess.Popen,
-except that:
-
-* subprocess.Popen raises an exception if the execution fails
-* the capturestderr argument is replaced with the stderr argument.
-* stdin=PIPE and stdout=PIPE must be specified.
-* popen2 closes all filedescriptors by default, but you have to specify
-  close_fds=True with subprocess.Popen.
-
-
-"""
-
-import sys
-mswindows = (sys.platform == "win32")
-
-import os
-import types
-import traceback
-
-if mswindows:
-    import threading
-    import msvcrt
-    if 0: # <-- change this to use pywin32 instead of the _subprocess driver
-        import pywintypes
-        from win32api import GetStdHandle, STD_INPUT_HANDLE, \
-                             STD_OUTPUT_HANDLE, STD_ERROR_HANDLE
-        from win32api import GetCurrentProcess, DuplicateHandle, \
-                             GetModuleFileName, GetVersion
-        from win32con import DUPLICATE_SAME_ACCESS, SW_HIDE
-        from win32pipe import CreatePipe
-        from win32process import CreateProcess, STARTUPINFO, \
-                                 GetExitCodeProcess, STARTF_USESTDHANDLES, \
-                                 STARTF_USESHOWWINDOW, CREATE_NEW_CONSOLE
-        from win32event import WaitForSingleObject, INFINITE, WAIT_OBJECT_0
-    else:
-        from _subprocess import *
-        class STARTUPINFO:
-            dwFlags = 0
-            hStdInput = None
-            hStdOutput = None
-            hStdError = None
-        class pywintypes:
-            error = IOError
-else:
-    import select
-    import errno
-    import fcntl
-    import pickle
-
-__all__ = ["Popen", "PIPE", "STDOUT", "call"]
-
-try:
-    MAXFD = os.sysconf("SC_OPEN_MAX")
-except:
-    MAXFD = 256
-
-# True/False does not exist on 2.2.0
-try:
-    False
-except NameError:
-    False = 0
-    True = 1
-
-_active = []
-
-def _cleanup():
-    for inst in _active[:]:
-        inst.poll()
-
-PIPE = -1
-STDOUT = -2
-
-
-def call(*args, **kwargs):
-    """Run command with arguments.  Wait for command to complete, then
-    return the returncode attribute.
-
-    The arguments are the same as for the Popen constructor.  Example:
-
-    retcode = call(["ls", "-l"])
-    """
-    return Popen(*args, **kwargs).wait()
-
-
-def list2cmdline(seq):
-    """
-    Translate a sequence of arguments into a command line
-    string, using the same rules as the MS C runtime:
-
-    1) Arguments are delimited by white space, which is either a
-       space or a tab.
-
-    2) A string surrounded by double quotation marks is
-       interpreted as a single argument, regardless of white space
-       contained within.  A quoted string can be embedded in an
-       argument.
-
-    3) A double quotation mark preceded by a backslash is
-       interpreted as a literal double quotation mark.
-
-    4) Backslashes are interpreted literally, unless they
-       immediately precede a double quotation mark.
-
-    5) If backslashes immediately precede a double quotation mark,
-       every pair of backslashes is interpreted as a literal
-       backslash.  If the number of backslashes is odd, the last
-       backslash escapes the next double quotation mark as
-       described in rule 3.
-    """
-
-    # See
-    # http://msdn.microsoft.com/library/en-us/vccelng/htm/progs_12.asp
-    result = []
-    needquote = False
-    for arg in seq:
-        bs_buf = []
-
-        # Add a space to separate this argument from the others
-        if result:
-            result.append(' ')
-
-        needquote = (" " in arg) or ("\t" in arg)
-        if needquote:
-            result.append('"')
-
-        for c in arg:
-            if c == '\\':
-                # Don't know if we need to double yet.
-                bs_buf.append(c)
-            elif c == '"':
-                # Double backspaces.
-                result.append('\\' * len(bs_buf)*2)
-                bs_buf = []
-                result.append('\\"')
-            else:
-                # Normal char
-                if bs_buf:
-                    result.extend(bs_buf)
-                    bs_buf = []
-                result.append(c)
-
-        # Add remaining backspaces, if any.
-        if bs_buf:
-            result.extend(bs_buf)
-
-        if needquote:
-            result.extend(bs_buf)
-            result.append('"')
-
-    return ''.join(result)
-
-
-class Popen(object):
-    def __init__(self, args, bufsize=0, executable=None,
-                 stdin=None, stdout=None, stderr=None,
-                 preexec_fn=None, close_fds=False, shell=False,
-                 cwd=None, env=None, universal_newlines=False,
-                 startupinfo=None, creationflags=0):
-        """Create new Popen instance."""
-        _cleanup()
-
-        if not isinstance(bufsize, (int, long)):
-            raise TypeError("bufsize must be an integer")
-
-        if mswindows:
-            if preexec_fn is not None:
-                raise ValueError("preexec_fn is not supported on Windows "
-                                 "platforms")
-            if close_fds:
-                raise ValueError("close_fds is not supported on Windows "
-                                 "platforms")
-        else:
-            # POSIX
-            if startupinfo is not None:
-                raise ValueError("startupinfo is only supported on Windows "
-                                 "platforms")
-            if creationflags != 0:
-                raise ValueError("creationflags is only supported on Windows "
-                                 "platforms")
-
-        self.stdin = None
-        self.stdout = None
-        self.stderr = None
-        self.pid = None
-        self.returncode = None
-        self.universal_newlines = universal_newlines
-
-        # Input and output objects. The general principle is like
-        # this:
-        #
-        # Parent                   Child
-        # ------                   -----
-        # p2cwrite   ---stdin--->  p2cread
-        # c2pread    <--stdout---  c2pwrite
-        # errread    <--stderr---  errwrite
-        #
-        # On POSIX, the child objects are file descriptors.  On
-        # Windows, these are Windows file handles.  The parent objects
-        # are file descriptors on both platforms.  The parent objects
-        # are None when not using PIPEs. The child objects are None
-        # when not redirecting.
-
-        (p2cread, p2cwrite,
-         c2pread, c2pwrite,
-         errread, errwrite) = self._get_handles(stdin, stdout, stderr)
-
-        self._execute_child(args, executable, preexec_fn, close_fds,
-                            cwd, env, universal_newlines,
-                            startupinfo, creationflags, shell,
-                            p2cread, p2cwrite,
-                            c2pread, c2pwrite,
-                            errread, errwrite)
-
-        if p2cwrite:
-            self.stdin = os.fdopen(p2cwrite, 'wb', bufsize)
-        if c2pread:
-            if universal_newlines:
-                self.stdout = os.fdopen(c2pread, 'rU', bufsize)
-            else:
-                self.stdout = os.fdopen(c2pread, 'rb', bufsize)
-        if errread:
-            if universal_newlines:
-                self.stderr = os.fdopen(errread, 'rU', bufsize)
-            else:
-                self.stderr = os.fdopen(errread, 'rb', bufsize)
-
-        _active.append(self)
-
-
-    def _translate_newlines(self, data):
-        data = data.replace("\r\n", "\n")
-        data = data.replace("\r", "\n")
-        return data
-
-
-    if mswindows:
-        #
-        # Windows methods
-        #
-        def _get_handles(self, stdin, stdout, stderr):
-            """Construct and return tupel with IO objects:
-            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
-            """
-            if stdin == None and stdout == None and stderr == None:
-                return (None, None, None, None, None, None)
-
-            p2cread, p2cwrite = None, None
-            c2pread, c2pwrite = None, None
-            errread, errwrite = None, None
-
-            if stdin == None:
-                p2cread = GetStdHandle(STD_INPUT_HANDLE)
-            elif stdin == PIPE:
-                p2cread, p2cwrite = CreatePipe(None, 0)
-                # Detach and turn into fd
-                p2cwrite = p2cwrite.Detach()
-                p2cwrite = msvcrt.open_osfhandle(p2cwrite, 0)
-            elif type(stdin) == types.IntType:
-                p2cread = msvcrt.get_osfhandle(stdin)
-            else:
-                # Assuming file-like object
-                p2cread = msvcrt.get_osfhandle(stdin.fileno())
-            p2cread = self._make_inheritable(p2cread)
-
-            if stdout == None:
-                c2pwrite = GetStdHandle(STD_OUTPUT_HANDLE)
-            elif stdout == PIPE:
-                c2pread, c2pwrite = CreatePipe(None, 0)
-                # Detach and turn into fd
-                c2pread = c2pread.Detach()
-                c2pread = msvcrt.open_osfhandle(c2pread, 0)
-            elif type(stdout) == types.IntType:
-                c2pwrite = msvcrt.get_osfhandle(stdout)
-            else:
-                # Assuming file-like object
-                c2pwrite = msvcrt.get_osfhandle(stdout.fileno())
-            c2pwrite = self._make_inheritable(c2pwrite)
-
-            if stderr == None:
-                errwrite = GetStdHandle(STD_ERROR_HANDLE)
-            elif stderr == PIPE:
-                errread, errwrite = CreatePipe(None, 0)
-                # Detach and turn into fd
-                errread = errread.Detach()
-                errread = msvcrt.open_osfhandle(errread, 0)
-            elif stderr == STDOUT:
-                errwrite = c2pwrite
-            elif type(stderr) == types.IntType:
-                errwrite = msvcrt.get_osfhandle(stderr)
-            else:
-                # Assuming file-like object
-                errwrite = msvcrt.get_osfhandle(stderr.fileno())
-            errwrite = self._make_inheritable(errwrite)
-
-            return (p2cread, p2cwrite,
-                    c2pread, c2pwrite,
-                    errread, errwrite)
-
-
-        def _make_inheritable(self, handle):
-            """Return a duplicate of handle, which is inheritable"""
-            return DuplicateHandle(GetCurrentProcess(), handle,
-                                   GetCurrentProcess(), 0, 1,
-                                   DUPLICATE_SAME_ACCESS)
-
-
-        def _find_w9xpopen(self):
-            """Find and return absolut path to w9xpopen.exe"""
-            w9xpopen = os.path.join(os.path.dirname(GetModuleFileName(0)),
-                                    "w9xpopen.exe")
-            if not os.path.exists(w9xpopen):
-                # Eeek - file-not-found - possibly an embedding
-                # situation - see if we can locate it in sys.exec_prefix
-                w9xpopen = os.path.join(os.path.dirname(sys.exec_prefix),
-                                        "w9xpopen.exe")
-                if not os.path.exists(w9xpopen):
-                    raise RuntimeError("Cannot locate w9xpopen.exe, which is "
-                                       "needed for Popen to work with your "
-                                       "shell or platform.")
-            return w9xpopen
-
-
-        def _execute_child(self, args, executable, preexec_fn, close_fds,
-                           cwd, env, universal_newlines,
-                           startupinfo, creationflags, shell,
-                           p2cread, p2cwrite,
-                           c2pread, c2pwrite,
-                           errread, errwrite):
-            """Execute program (MS Windows version)"""
-
-            if not isinstance(args, types.StringTypes):
-                args = list2cmdline(args)
-
-            # Process startup details
-            default_startupinfo = STARTUPINFO()
-            if startupinfo == None:
-                startupinfo = default_startupinfo
-            if not None in (p2cread, c2pwrite, errwrite):
-                startupinfo.dwFlags |= STARTF_USESTDHANDLES
-                startupinfo.hStdInput = p2cread
-                startupinfo.hStdOutput = c2pwrite
-                startupinfo.hStdError = errwrite
-
-            if shell:
-                default_startupinfo.dwFlags |= STARTF_USESHOWWINDOW
-                default_startupinfo.wShowWindow = SW_HIDE
-                comspec = os.environ.get("COMSPEC", "cmd.exe")
-                args = comspec + " /c " + args
-                if (GetVersion() >= 0x80000000L or
-                        os.path.basename(comspec).lower() == "command.com"):
-                    # Win9x, or using command.com on NT. We need to
-                    # use the w9xpopen intermediate program. For more
-                    # information, see KB Q150956
-                    # (http://web.archive.org/web/20011105084002/http://support.microsoft.com/support/kb/articles/Q150/9/56.asp)
-                    w9xpopen = self._find_w9xpopen()
-                    args = '"%s" %s' % (w9xpopen, args)
-                    # Not passing CREATE_NEW_CONSOLE has been known to
-                    # cause random failures on win9x.  Specifically a
-                    # dialog: "Your program accessed mem currently in
-                    # use at xxx" and a hopeful warning about the
-                    # stability of your system.  Cost is Ctrl+C wont
-                    # kill children.
-                    creationflags |= CREATE_NEW_CONSOLE
-
-            # Start the process
-            try:
-                hp, ht, pid, tid = CreateProcess(executable, args,
-                                         # no special security
-                                         None, None,
-                                         # must inherit handles to pass std
-                                         # handles
-                                         1,
-                                         creationflags,
-                                         env,
-                                         cwd,
-                                         startupinfo)
-            except pywintypes.error, e:
-                # Translate pywintypes.error to WindowsError, which is
-                # a subclass of OSError.  FIXME: We should really
-                # translate errno using _sys_errlist (or simliar), but
-                # how can this be done from Python?
-                raise WindowsError(*e.args)
-
-            # Retain the process handle, but close the thread handle
-            self._handle = hp
-            self.pid = pid
-            ht.Close()
-
-            # Child is launched. Close the parent's copy of those pipe
-            # handles that only the child should have open.  You need
-            # to make sure that no handles to the write end of the
-            # output pipe are maintained in this process or else the
-            # pipe will not close when the child process exits and the
-            # ReadFile will hang.
-            if p2cread != None:
-                p2cread.Close()
-            if c2pwrite != None:
-                c2pwrite.Close()
-            if errwrite != None:
-                errwrite.Close()
-
-
-        def poll(self):
-            """Check if child process has terminated.  Returns returncode
-            attribute."""
-            if self.returncode == None:
-                if WaitForSingleObject(self._handle, 0) == WAIT_OBJECT_0:
-                    self.returncode = GetExitCodeProcess(self._handle)
-                    _active.remove(self)
-            return self.returncode
-
-
-        def wait(self):
-            """Wait for child process to terminate.  Returns returncode
-            attribute."""
-            if self.returncode == None:
-                obj = WaitForSingleObject(self._handle, INFINITE)
-                self.returncode = GetExitCodeProcess(self._handle)
-                _active.remove(self)
-            return self.returncode
-
-
-        def _readerthread(self, fh, buffer):
-            buffer.append(fh.read())
-
-
-        def communicate(self, input=None):
-            """Interact with process: Send data to stdin.  Read data from
-            stdout and stderr, until end-of-file is reached.  Wait for
-            process to terminate.  The optional input argument should be a
-            string to be sent to the child process, or None, if no data
-            should be sent to the child.
-
-            communicate() returns a tuple (stdout, stderr)."""
-            stdout = None # Return
-            stderr = None # Return
-
-            if self.stdout:
-                stdout = []
-                stdout_thread = threading.Thread(target=self._readerthread,
-                                                 args=(self.stdout, stdout))
-                stdout_thread.setDaemon(True)
-                stdout_thread.start()
-            if self.stderr:
-                stderr = []
-                stderr_thread = threading.Thread(target=self._readerthread,
-                                                 args=(self.stderr, stderr))
-                stderr_thread.setDaemon(True)
-                stderr_thread.start()
-
-            if self.stdin:
-                if input != None:
-                    self.stdin.write(input)
-                self.stdin.close()
-
-            if self.stdout:
-                stdout_thread.join()
-            if self.stderr:
-                stderr_thread.join()
-
-            # All data exchanged.  Translate lists into strings.
-            if stdout != None:
-                stdout = stdout[0]
-            if stderr != None:
-                stderr = stderr[0]
-
-            # Translate newlines, if requested.  We cannot let the file
-            # object do the translation: It is based on stdio, which is
-            # impossible to combine with select (unless forcing no
-            # buffering).
-            if self.universal_newlines and hasattr(open, 'newlines'):
-                if stdout:
-                    stdout = self._translate_newlines(stdout)
-                if stderr:
-                    stderr = self._translate_newlines(stderr)
-
-            self.wait()
-            return (stdout, stderr)
-
-    else:
-        #
-        # POSIX methods
-        #
-        def _get_handles(self, stdin, stdout, stderr):
-            """Construct and return tupel with IO objects:
-            p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite
-            """
-            p2cread, p2cwrite = None, None
-            c2pread, c2pwrite = None, None
-            errread, errwrite = None, None
-
-            if stdin == None:
-                pass
-            elif stdin == PIPE:
-                p2cread, p2cwrite = os.pipe()
-            elif type(stdin) == types.IntType:
-                p2cread = stdin
-            else:
-                # Assuming file-like object
-                p2cread = stdin.fileno()
-
-            if stdout == None:
-                pass
-            elif stdout == PIPE:
-                c2pread, c2pwrite = os.pipe()
-            elif type(stdout) == types.IntType:
-                c2pwrite = stdout
-            else:
-                # Assuming file-like object
-                c2pwrite = stdout.fileno()
-
-            if stderr == None:
-                pass
-            elif stderr == PIPE:
-                errread, errwrite = os.pipe()
-            elif stderr == STDOUT:
-                errwrite = c2pwrite
-            elif type(stderr) == types.IntType:
-                errwrite = stderr
-            else:
-                # Assuming file-like object
-                errwrite = stderr.fileno()
-
-            return (p2cread, p2cwrite,
-                    c2pread, c2pwrite,
-                    errread, errwrite)
-
-
-        def _set_cloexec_flag(self, fd):
-            try:
-                cloexec_flag = fcntl.FD_CLOEXEC
-            except AttributeError:
-                cloexec_flag = 1
-
-            old = fcntl.fcntl(fd, fcntl.F_GETFD)
-            fcntl.fcntl(fd, fcntl.F_SETFD, old | cloexec_flag)
-
-
-        def _close_fds(self, but):
-            for i in range(3, MAXFD):
-                if i == but:
-                    continue
-                try:
-                    os.close(i)
-                except:
-                    pass
-
-
-        def _execute_child(self, args, executable, preexec_fn, close_fds,
-                           cwd, env, universal_newlines,
-                           startupinfo, creationflags, shell,
-                           p2cread, p2cwrite,
-                           c2pread, c2pwrite,
-                           errread, errwrite):
-            """Execute program (POSIX version)"""
-
-            if isinstance(args, types.StringTypes):
-                args = [args]
-
-            if shell:
-                args = ["/bin/sh", "-c"] + args
-
-            if executable == None:
-                executable = args[0]
-
-            # For transferring possible exec failure from child to parent
-            # The first char specifies the exception type: 0 means
-            # OSError, 1 means some other error.
-            errpipe_read, errpipe_write = os.pipe()
-            self._set_cloexec_flag(errpipe_write)
-
-            self.pid = os.fork()
-            if self.pid == 0:
-                # Child
-                try:
-                    # Close parent's pipe ends
-                    if p2cwrite:
-                        os.close(p2cwrite)
-                    if c2pread:
-                        os.close(c2pread)
-                    if errread:
-                        os.close(errread)
-                    os.close(errpipe_read)
-
-                    # Dup fds for child
-                    if p2cread:
-                        os.dup2(p2cread, 0)
-                    if c2pwrite:
-                        os.dup2(c2pwrite, 1)
-                    if errwrite:
-                        os.dup2(errwrite, 2)
-
-                    # Close pipe fds.  Make sure we doesn't close the same
-                    # fd more than once.
-                    if p2cread:
-                        os.close(p2cread)
-                    if c2pwrite and c2pwrite not in (p2cread,):
-                        os.close(c2pwrite)
-                    if errwrite and errwrite not in (p2cread, c2pwrite):
-                        os.close(errwrite)
-
-                    # Close all other fds, if asked for
-                    if close_fds:
-                        self._close_fds(but=errpipe_write)
-
-                    if cwd != None:
-                        os.chdir(cwd)
-
-                    if preexec_fn:
-                        apply(preexec_fn)
-
-                    if env == None:
-                        os.execvp(executable, args)
-                    else:
-                        os.execvpe(executable, args, env)
-
-                except:
-                    exc_type, exc_value, tb = sys.exc_info()
-                    # Save the traceback and attach it to the exception object
-                    exc_lines = traceback.format_exception(exc_type,
-                                                           exc_value,
-                                                           tb)
-                    exc_value.child_traceback = ''.join(exc_lines)
-                    os.write(errpipe_write, pickle.dumps(exc_value))
-
-                # This exitcode won't be reported to applications, so it
-                # really doesn't matter what we return.
-                os._exit(255)
-
-            # Parent
-            os.close(errpipe_write)
-            if p2cread and p2cwrite:
-                os.close(p2cread)
-            if c2pwrite and c2pread:
-                os.close(c2pwrite)
-            if errwrite and errread:
-                os.close(errwrite)
-
-            # Wait for exec to fail or succeed; possibly raising exception
-            data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB
-            os.close(errpipe_read)
-            if data != "":
-                os.waitpid(self.pid, 0)
-                child_exception = pickle.loads(data)
-                raise child_exception
-
-
-        def _handle_exitstatus(self, sts):
-            if os.WIFSIGNALED(sts):
-                self.returncode = -os.WTERMSIG(sts)
-            elif os.WIFEXITED(sts):
-                self.returncode = os.WEXITSTATUS(sts)
-            else:
-                # Should never happen
-                raise RuntimeError("Unknown child exit status!")
-
-            _active.remove(self)
-
-
-        def poll(self):
-            """Check if child process has terminated.  Returns returncode
-            attribute."""
-            if self.returncode == None:
-                try:
-                    pid, sts = os.waitpid(self.pid, os.WNOHANG)
-                    if pid == self.pid:
-                        self._handle_exitstatus(sts)
-                except os.error:
-                    pass
-            return self.returncode
-
-
-        def wait(self):
-            """Wait for child process to terminate.  Returns returncode
-            attribute."""
-            if self.returncode == None:
-                pid, sts = os.waitpid(self.pid, 0)
-                self._handle_exitstatus(sts)
-            return self.returncode
-
-
-        def communicate(self, input=None):
-            """Interact with process: Send data to stdin.  Read data from
-            stdout and stderr, until end-of-file is reached.  Wait for
-            process to terminate.  The optional input argument should be a
-            string to be sent to the child process, or None, if no data
-            should be sent to the child.
-
-            communicate() returns a tuple (stdout, stderr)."""
-            read_set = []
-            write_set = []
-            stdout = None # Return
-            stderr = None # Return
-
-            if self.stdin:
-                # Flush stdio buffer.  This might block, if the user has
-                # been writing to .stdin in an uncontrolled fashion.
-                self.stdin.flush()
-                if input:
-                    write_set.append(self.stdin)
-                else:
-                    self.stdin.close()
-            if self.stdout:
-                read_set.append(self.stdout)
-                stdout = []
-            if self.stderr:
-                read_set.append(self.stderr)
-                stderr = []
-
-            while read_set or write_set:
-                rlist, wlist, xlist = select.select(read_set, write_set, [])
-
-                if self.stdin in wlist:
-                    # When select has indicated that the file is writable,
-                    # we can write up to PIPE_BUF bytes without risk
-                    # blocking.  POSIX defines PIPE_BUF >= 512
-                    bytes_written = os.write(self.stdin.fileno(), input[:512])
-                    input = input[bytes_written:]
-                    if not input:
-                        self.stdin.close()
-                        write_set.remove(self.stdin)
-
-                if self.stdout in rlist:
-                    data = os.read(self.stdout.fileno(), 1024)
-                    if data == "":
-                        self.stdout.close()
-                        read_set.remove(self.stdout)
-                    stdout.append(data)
-
-                if self.stderr in rlist:
-                    data = os.read(self.stderr.fileno(), 1024)
-                    if data == "":
-                        self.stderr.close()
-                        read_set.remove(self.stderr)
-                    stderr.append(data)
-
-            # All data exchanged.  Translate lists into strings.
-            if stdout != None:
-                stdout = ''.join(stdout)
-            if stderr != None:
-                stderr = ''.join(stderr)
-
-            # Translate newlines, if requested.  We cannot let the file
-            # object do the translation: It is based on stdio, which is
-            # impossible to combine with select (unless forcing no
-            # buffering).
-            if self.universal_newlines and hasattr(open, 'newlines'):
-                if stdout:
-                    stdout = self._translate_newlines(stdout)
-                if stderr:
-                    stderr = self._translate_newlines(stderr)
-
-            self.wait()
-            return (stdout, stderr)
-
-
-def _demo_posix():
-    #
-    # Example 1: Simple redirection: Get process list
-    #
-    plist = Popen(["ps"], stdout=PIPE).communicate()[0]
-    print "Process list:"
-    print plist
-
-    #
-    # Example 2: Change uid before executing child
-    #
-    if os.getuid() == 0:
-        p = Popen(["id"], preexec_fn=lambda: os.setuid(100))
-        p.wait()
-
-    #
-    # Example 3: Connecting several subprocesses
-    #
-    print "Looking for 'hda'..."
-    p1 = Popen(["dmesg"], stdout=PIPE)
-    p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE)
-    print repr(p2.communicate()[0])
-
-    #
-    # Example 4: Catch execution error
-    #
-    print
-    print "Trying a weird file..."
-    try:
-        print Popen(["/this/path/does/not/exist"]).communicate()
-    except OSError, e:
-        if e.errno == errno.ENOENT:
-            print "The file didn't exist.  I thought so..."
-            print "Child traceback:"
-            print e.child_traceback
-        else:
-            print "Error", e.errno
-    else:
-        print >>sys.stderr, "Gosh.  No error."
-
-
-def _demo_windows():
-    #
-    # Example 1: Connecting several subprocesses
-    #
-    print "Looking for 'PROMPT' in set output..."
-    p1 = Popen("set", stdout=PIPE, shell=True)
-    p2 = Popen('find "PROMPT"', stdin=p1.stdout, stdout=PIPE)
-    print repr(p2.communicate()[0])
-
-    #
-    # Example 2: Simple execution of program
-    #
-    print "Executing calc..."
-    p = Popen("calc")
-    p.wait()
-
-
-if __name__ == "__main__":
-    if mswindows:
-        _demo_windows()
-    else:
-        _demo_posix()
diff --git a/koan/xencreate.py b/koan/xencreate.py
deleted file mode 100755
index accb326..0000000
--- a/koan/xencreate.py
+++ /dev/null
@@ -1,89 +0,0 @@
-# Virtualization installation functions.  
-# Currently somewhat Xen/paravirt specific, will evolve later.
-#
-# Copyright 2006-2007 Red Hat, Inc.
-# Michael DeHaan <mdehaan at redhat.com>
-#
-# Original version based on virtguest-install
-# Jeremy Katz <katzj at redhat.com>
-# Option handling added by Andrew Puch <apuch at redhat.com>
-# Simplified for use as library by koan, Michael DeHaan <mdehaan at redhat.com>
-#
-# This software may be freely redistributed under the terms of the GNU
-# general public license.
-#
-# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-import os, sys, time, stat
-import tempfile
-import random
-from optparse import OptionParser
-import exceptions
-import errno
-import re
-import virtinst
-
-class VirtCreateException(exceptions.Exception):
-    pass
-
-def randomUUID():
-    """
-    Generate a random UUID.  Copied from xend/uuid.py
-    """
-    return [ random.randint(0, 255) for x in range(0, 16) ]
-
-
-def uuidToString(u):
-    """
-    return uuid as a string
-    """
-    return "-".join(["%02x" * 4, "%02x" * 2, "%02x" * 2, "%02x" * 2,
-                     "%02x" * 6]) % tuple(u)
-
-def get_uuid(uuid):
-    """
-    return the passed-in uuid, or a random one if it's not set.
-    """
-    if uuid:
-       return uuid
-    return uuidToString(randomUUID())
-
-def start_paravirt_install(name=None, ram=None, disk=None, mac=None,
-                           uuid=None, kernel=None, initrd=None, 
-                           extra=None, path=None,
-                           vcpus=None, virt_graphics=False, special_disk=False):
-
-
-    guest = virtinst.ParaVirtGuest()
-    guest.set_boot((kernel,initrd))
-    guest.set_extra_args(extra)
-    guest.set_name(name)
-    guest.set_memory(ram)
-    if vcpus is None:
-        vcpus = 1
-    guest.set_vcpus(vcpus)
-    if virt_graphics:
-        guest.set_graphics("vnc")
-    else:
-        guest.set_graphics(False)
-    if uuid is not None:
-        guest.set_uuid(uuid)
-
-    disk_path = path
-    disk_obj = virtinst.XenDisk(disk_path, size=disk)
-
-    try:
-        nic_obj = virtinst.XenNetworkInterface(macaddr=mac, type="user")
-    except:
-        # try to be backward compatible
-        nic_obj = virtinst.XenNetworkInterface(macaddr=mac)
-
-    guest.disks.append(disk_obj)
-    guest.nics.append(nic_obj)
-
-    guest.start_install()
-    
-    return "reconnect with xm console %s" % name 
-     
diff --git a/live/base.cfg b/live/base.cfg
deleted file mode 100644
index 30bb58f..0000000
--- a/live/base.cfg
+++ /dev/null
@@ -1,159 +0,0 @@
-lang en_US.UTF-8
-keyboard us
-timezone US/Eastern
-auth --useshadow --enablemd5
-selinux --disabled
-firewall --disabled
-rootpw --iscrypted \$1\$mF86/UHC\$WvcIcX2t6crBz2onWxyac.
-
-# TODO: how to replace i386 with $basearch
-
-# TODO: apparently calling it fedora-dev instead of a-dev makes things
-# not work. Perhaps it has something to do with the default repos in
-# /etc/yum.repos.d not getting properly disabled?
-
-repo --name=todos --baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/7/Everything/i386/os/
-repo --name=updatez --baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/7/i386/
-repo --name=newkoan --baseurl=file:///tmp/newkoan/
-
-text
-bootloader --location=mbr
-install
-zerombr
-
-part / --fstype ext3 --size=1024 --grow --ondisk=/dev/sda --asprimary
-part swap --size=1027 --ondisk=/dev/sda --asprimary
-
-%packages
- at base
-#@core
- at hardware-support
-file
-syslinux
-kernel
-bash
-util-linux
-koan
-#aspell-*
--m17n-db-*
--man-pages-*
-# gimp help is huge
--gimp-help
-# lose the compat stuff
--compat*
-# space sucks
--gnome-user-docs
--specspo
--esc
--samba-client
--a2ps
--vino
--redhat-lsb
--sox
-# smartcards won't really work on the livecd.  and we _need_ space
--coolkey
--ccid
-# duplicate functionality
--tomboy
--pinfo
--wget
-# scanning takes quite a bit of space :/
--xsane
--xsane-gimp
-# while hplip requires pyqt, it has to go
--hplip
-#-*debuginfo # error
-
-%post
-
-cat > /etc/rc.d/init.d/fedora-live << EOF
-#!/bin/bash
-#
-# live: Init script for live image
-#
-# chkconfig: 345 99 99
-
-# description: Init script for live image.
-
-#if ! strstr "\`cat /proc/cmdline\`" liveimg || [ "\$1" != "start" ] || [ -e /.liveimg-configured ] ; then
-#    exit 0
-#fi
-
-exists() {
-    which \$1 >/dev/null 2>&1 || return
-    \$*
-}
-
-touch /.liveimg-configured
-
-echo "RUN_FIRSTBOOT=NO" > /etc/sysconfig/firstboot
-
-useradd -c "Fedora Live" fedora
-passwd -d fedora > /dev/null
-
-# don't start cron/at as they tend to spawn things which are
-# disk intensive that are painful on a live image
-chkconfig --level 345 crond off
-chkconfig --level 345 atd off
-chkconfig --level 345 anacron off
-chkconfig --level 345 readahead_early off
-chkconfig --level 345 readahead_later off
-
-# Stopgap fix for RH #217966; should be fixed in HAL instead
-touch /media/.hal-mtab
-
-# take over a drive to use as temporary space
-sfdisk /dev/sda -uM << ESFDISK
-	,1000
-	;
-ESFDISK
-mkfs -t ext3 /dev/sda1
-
-# fix fstab/mtab
-
-cat >> /etc/fstab << EFSTAB
-/dev/sda1	/tmp/boot	ext3	defaults,noatime 0 0
-EFSTAB
-
-cat >> /etc/mtab << EMTAB
-/dev/sda1 /tmp/boot ext3 rw,noatime 0 0
-EMTAB
-
-# make a boot directory on the filesystem so grub can be happy
-mkdir /tmp/boot
-mount /dev/sda1 /tmp/boot
-mkdir -p /tmp/boot/boot
-
-# install grub
-mknod /dev/mapper/livecd-rw b 8 0
-grub-install --root-directory=/tmp/boot/ --no-floppy /dev/sda
-
-# need a grub.conf file to run grubby from within koan
-cat > /tmp/boot/boot/grub/grub.conf << EGRUB
-# grub.conf
-default=0
-timeout=5
-#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
-hiddenmenu
-title spacer (2.6.21-1.3228.fc7)
-	root (hd0,0)
-	kernel /boot/vmlinuz
-	initrd /boot/initrd.img
-EGRUB
-
-# now we're ready to do it for real
-INSERT_KOAN_ARGS --livecd
-
-# once through debugging
-# eject
-# reboot
-
-EOF
-
-chmod 755 /etc/rc.d/init.d/fedora-live
-/sbin/restorecon /etc/rc.d/init.d/fedora-live
-/sbin/chkconfig --add fedora-live
-
-# save a little bit of space at least...
-rm -f /boot/initrd*
-
diff --git a/live/build.py b/live/build.py
deleted file mode 100644
index 65948c4..0000000
--- a/live/build.py
+++ /dev/null
@@ -1,104 +0,0 @@
-"""
-Validates whether the system is reasonably well configured for
-serving up content.  This is the code behind 'cobbler check'.
-
-Copyright 2007, Red Hat, Inc
-Michael DeHaan <mdehaan at redhat.com>
-
-This software may be freely redistributed under the terms of the GNU
-general public license.
-
-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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-# usage: --server=bootserver.example.com --koan="--profile=FOO"
-# requires latest git://git.fedoraproject.org/git/hosted/livecd
-
-import optparse
-import subprocess
-import sys
-import os
-
-# this configuration is the kickstart for the live CD, not the install system
-# tweak at your own risk
-
-basef = open("./base.cfg")
-base_config = basef.read()
-basef.close()
-
-# not expected to work with anything lower than FC-7
-# use i386 for compatibility, still works with x86_64
-# this is the LiveCD's OS, not the target install OS
-
-USE_DISTRO_SHORT = "FC-7"
-USE_DISTRO = "FC-7-i386"
-USE_REPO   = "fc7i386extras"
-
-# packages to put on the LiveCD
-
-packages = [
-  "kernel", "bash", "koan", "policycoreutils", "grub", "eject", "tree"
-]
-
-# some debug checks
-   
-#prereqs = {
-#      "/usr/bin/livecd-creator" : "make and make install -> http://gitweb.freedesktop.org/?p=users/david/livecd-tools.git",
-#      "/sbin/mksquashfs"        : "yum install squashfs-tools"
-#}
-
-#=======
-
-def main(args):
-
-
-   p = optparse.OptionParser()
-   p.add_option("-k","--koan",action="store",help="koan arguments")
-   p.add_option("-s","--server",action="store",help="cobbler server name")
-   (options,args) = p.parse_args()
-
-   if options.server is None:
-      print >>sys.stderr, "error: --server is required"
-      sys.exit(1)
-   if options.koan is None:
-      options.koan = "--replace-self --server=%s" % options.server
-   if options.koan.find("--server") == -1 and options.koan.find("-s") == -1:
-      options.koan = options.koan + " --server=%s" % options.server
-   if options.koan.find("--replace-self") == -1:
-      options.koan = options.koan + " --replace-self"
-
-   # create the local repo so we can have the latest koan
-   # even if it's not in Fedora yet
-   subprocess.call("createrepo ../rpm-build",shell=True)
-
-   subprocess.call("mkdir -p /tmp/newkoan", shell=True) 
-   subprocess.call("cp -r ../rpm-build/* /tmp/newkoan/",shell=True) 
-
-   # write config file
-   cfg = open("/tmp/koanlive.cfg","w+")
-   cfg.write(base_config.replace("INSERT_KOAN_ARGS", "/usr/bin/koan %s" % options.koan))
-   cfg.close()
-
-   # ======
-
-   cmd = "livecd-creator"
-   cmd = cmd + " --fslabel=koan-live-cd"
-   cmd = cmd + " --config=/tmp/koanlive.cfg"
-   
-
-   for x in packages:
-      cmd = cmd + " --package=%s" % x
-   
-   print "running: %s" % cmd
-
-   try:
-       os.remove("koan-live-cd.iso")
-   except:
-       print "existing file not removed"
-   subprocess.call(cmd, shell=True)
-
-if __name__ == "__main__":
-   main(sys.argv)
-
diff --git a/setup.py b/setup.py
deleted file mode 100644
index b70cecb..0000000
--- a/setup.py
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/usr/bin/python
-
-import sys
-from distutils.core import setup, Extension
-import string
-
-VERSION = "0.5.1"
-SHORT_DESC = "Network provisioning tool for Virtualized Images and Existing Non-Bare Metal"
-LONG_DESC = """
-koan stands for "kickstart-over-a-network" and allows for both
-network provisioning of new virtualized guests and destructive provisioning of
-any existing system.  For use with a boot-server configured with
-'cobbler'.
-"""
-
-if __name__ == "__main__":
-        docspath="share/doc/koan-%s/" % VERSION
-        manpath="share/man/man1/"
-	setup(
-                name="koan",
-                version = VERSION,
-                author = "Michael DeHaan",
-                author_email = "mdehaan at redhat.com",
-                url = "http://cobbler.et.redhat.com/",
-                license = "GPL",
-                packages = ["koan"],
-                scripts = ["koan/koan"],
-                data_files = [
-				("/var/spool/koan", []),
-				(manpath, ['koan.1.gz']),
-                             ],
-                description = SHORT_DESC,
-                long_description = LONG_DESC
-        )
diff --git a/tests/tests.py b/tests/tests.py
deleted file mode 100644
index 8bc3126..0000000
--- a/tests/tests.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import sys
-import unittest
-import traceback
-
-from koan import koan
-
-class Basic(unittest.TestCase):
-    """
-    Koan is very network, system, and configuration dependent, so there isn't
-    a *ton* of things that can be added here.  But things *should* be added.
-    """
-    def setUp(self):
-       pass
-
-    def tearDown(self):
-       pass
-
-    def test_basicCli(self):
-       try:
-           koan.main()
-       except SystemExit:
-           pass
-       except:
-           traceback.print_exc()
-           self.fail("raised exception")
-
-if __name__ == "__main__":
-    unittest.main(argv=sys.argv)

hooks/update
---
Git Source Code Management System
hooks/update refs/heads/master \
  20c8b7e4f95bc33e0693a979ca0abe18b9758555 \
  7962075fe8e348206a014320926f41c0ddcadb0e




More information about the Et-mgmt-commits-list mailing list