[Python-modules-commits] [python-vagrant] 01/13: Imported Upstream version 0.5.13
Hans-Christoph Steiner
eighthave at moszumanska.debian.org
Fri Jun 17 12:01:26 UTC 2016
This is an automated email from the git hooks/post-receive script.
eighthave pushed a commit to branch master
in repository python-vagrant.
commit afabb2cc879c1c1cac684e95ef8ab941f2f9be45
Author: Hans-Christoph Steiner <hans at eds.org>
Date: Thu Jun 16 21:45:15 2016 +0200
Imported Upstream version 0.5.13
---
CHANGELOG.md | 351 +++++++++
LICENSE.txt | 20 +
MANIFEST.in | 2 +
PKG-INFO | 242 ++++++
README.md | 225 ++++++
python_vagrant.egg-info/PKG-INFO | 242 ++++++
python_vagrant.egg-info/SOURCES.txt | 20 +
python_vagrant.egg-info/dependency_links.txt | 1 +
python_vagrant.egg-info/top_level.txt | 1 +
setup.cfg | 5 +
setup.py | 32 +
tests/__init__.py | 0
tests/test_vagrant.py | 582 +++++++++++++++
tests/test_vagrant_test_case.py | 57 ++
tests/vagrantfiles/multi_box/Vagrantfile | 15 +
tests/vagrantfiles/multivm_Vagrantfile | 18 +
tests/vagrantfiles/shell_provision_Vagrantfile | 6 +
tests/vagrantfiles/single_box/Vagrantfile | 9 +
tests/vagrantfiles/vm_Vagrantfile | 4 +
vagrant/__init__.py | 996 +++++++++++++++++++++++++
vagrant/compat.py | 24 +
vagrant/test.py | 102 +++
22 files changed, 2954 insertions(+)
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..998254e
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,351 @@
+
+# Changelog
+
+This document lists the changes (and individuals who contributed to those
+changes) for each release of python-vagrant.
+
+## 0.5.13
+
+- Pull Request #50: Filter out unneeded status lines for AWS instances
+ Author: Brian Berry (https://github.com/bryanwb)
+
+## 0.5.11
+
+- Pull Request #47: Add support for snapshot command (vagrant version >= 1.8.0)
+ Author: Renat Zaripov (https://github.com/rrzaripov)
+
+## 0.5.10
+
+- Pull Request 46: Adds support for Vagrant 1.8 `--machine-readable` changes.
+ See https://github.com/todddeluca/python-vagrant/pull/46.
+ Author: Conor (https://github.com/conorsch)
+
+## 0.5.9
+
+- Support Python 3 in addition to Python 2
+ Author: Volodymyr Vitvitskyi (https://github.com/signalpillar)
+- Use `os.devnull` for Windows compatability.
+ Author: Renat Zaripov (https://github.com/rrzaripov)
+
+
+## 0.5.8
+
+- Fix regression where vagrant commands were being printed to stdout.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+
+
+## 0.5.7
+
+- Allow redirection of the output of the vagrant command subprocess to a file.
+
+ In order to log the output of the subprocess that runs vagrant commands,
+ or alternatively to silence that output, `Vagrant.__init__` accepts two
+ parameters, `out_cm` and `err_cm` that are no-argument functions that, when
+ executed, return a context manager that yields a filehandle, etc., suitable
+ for use with the `stdout` and `stderr` parameters of `subprocess.Popen`.
+ Author: Manuel Sanchez (https://github.com/omoman)
+ Author: Todd DeLuca (https://github.com/todddeluca)
+
+
+## 0.5.6
+
+- add instance attribute `Vagrant.env` which is a mapping of environment
+ variables to be passed to the vagrant subprocess when invoked. This allows
+ basic inter-process communication between Python and Vagrant via environment
+ variables.
+ Author: Alex Conrad (https://github.com/aconrad)
+
+- `Vagrant.__init__` now accepts a keyword argument `env=None` which will be
+ assigned to the instance attribute `Vagrant.env`.
+ Author: Alex Conrad (https://github.com/aconrad)
+
+
+## 0.5.5
+
+Oops. Pushed non-master branch to PyPI, for version 0.5.4. Pushing master
+branch for 0.5.5.
+
+
+## 0.5.4
+
+The major change in this version is switching to using `--machine-readable` in
+some vagrant commands to make the underlying `vagrant` commands return
+easily-parseable output. The `--machine-readable` option requires Vagrant 1.4
+or higher.
+
+- Use `--machine-readable` output for `status`, `box_list`, and `plugin_list`.
+- Allow arbitrary status codes, so new statuses do not break parsing.
+ Previously, statuses were constrained to known ones for the sake of parsing.
+ Now that machine-readable vagrant output is being used, any status can be
+ parsed.
+- Status value constants (e.g. vagrant.Vagrant.NOT_CREATED) have changed to
+ match the "state" value returned by the `--machine-readable` output of
+ the `vagrant status` command.
+- The box version is now returned for a box listing
+
+## 0.5.3
+
+- Add box update command.
+ Author: Alex Lourie (https://github.com/alourie)
+
+## 0.5.2
+
+- Add resume command.
+ Author: Renat Zaripov (https://github.com/rrzaripov)
+
+## 0.5.1
+
+- Find the correct executable on Cygwin systems. See `which` and
+ https://github.com/todddeluca/python-vagrant/issues/26.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+
+## 0.5.0 (release 2014/03/25)
+
+This is a backwards-incompatible release with a number of breaking changes to
+the API. Some of these changes were made to bring the python-vagrant API more
+closely in line with the vagrant CLI, a key design goal of python-vagrant.
+Other changes simplify the code. This release also includes a number of pull
+requests.
+
+Major (backwards-incompatible) changes:
+
+- Fix inconsistencies between python-vagrant and the vagrant CLI.
+
+ A goal of the design of methods like `status()`, `box_list()`, and
+ `plugin_list()` is to be a thin wrapper around the corresponding vagrant CLI
+ commands, with a very similar API. These changes bring python-vagrant closer
+ to that goal, I hope.
+
+ When status() was originally written, it was with single-VM environments
+ in mind, before provider information was available. Since then it was
+ altered to return a dict to handle multi-VM environments. However it
+ still did not return the provider information vagrant outputs. This
+ command updates the status API so that it returns every tuple of VM name
+ (i.e. target), state (i.e. status), and provider output by the
+ underlying vagrant command. These tuples of values are returned as a
+ list of Status classes. The decision to return a list of Statuses
+ instead of a dict mapping VM name to Status was made because the vagrant
+ CLI does not make clear that the status information it returns can be
+ keyed on VM name. In the case of `vagrant box list`, box names can be
+ repeated if there are multiple version of boxes. Therefore, returning a
+ list of Statuses seemed more consistent with (my understanding of)
+ vagrant's API.
+
+ The box_list() method was originally written, as I recall, before
+ providers and versions were a part of Vagrant. Then box_list_long() was
+ written to accommodate provider information, without changing the
+ box_list() API. Unfortunately, this meant box_list() diverged more from
+ the output of `vagrant box list`. To bring the python-vagrant API back
+ in line with the vagrant API, while keeping it simple, the
+ box_list_long() method is being removed and the box_list() method is
+ being updated to return a list of Box instances. Each box instance
+ contains the information that the `vagrant box list` command returns for
+ a box, the box name, provider, and version. The user who wants a list
+ of box names can do:
+
+ [box.name for box in v.box_list()]
+
+ For consistency with status() and box_list(), the relatively new
+ plugin_list() command is updated to return a list of Plugin objects
+ instead of a list of dicts containing the plugin info from vagrant.
+
+ The choice to use classes for Status, Box, and Plugin information was
+ motivated by the lower syntactic weight compared to using a dicts.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+- Pull Request #22. Don't die if vagrant executable is missing when the vagrant module is imported. Wait until the Vagrant class is used.
+ Author: Gertjan Oude Lohuis (https://github.com/gertjanol)
+- Move verbosity/quiet flags from `**kwargs` to instance vars.
+
+ Unfortunately, this is a breaking change for people who use these keywords.
+ Nevertheless, the proliferation of `**kwargs` in the method signatures is a bad
+ smell. The code is not self documenting. It is not clear from the code what
+ keywords you can pass, and it will accept keywords it does not use. Also, as
+ new methods are added, their signatures must be polluted either by the vague
+ `**kwargs` or a host of seemingly irrelevant keywords, like capture_output and
+ quiet_stderr. Moving the verbosity and quietness functions to instance
+ variables from function parameters makes their functionality more well
+ documented, simplifies and makes more explicit many method signatures, and
+ maintains the desired functionality.
+
+ For a "loud" instance, use vagrant.Vagrant(quiet_stdout=False). Set quiet_stderr=False for an even louder version.
+
+ In keeping with past behavior, vagrant instances are quiet by default.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+
+Other minor changes and fixes:
+
+- Pull Request #21. Fix Sandbox Tests
+ Author: Gertjan Oude Lohuis (https://github.com/gertjanol)
+- Split internal _run_vagrant_command method into _run_vagrant_command (for capturing output) and _call_vagrant_command (when output is not needed, e.g. for parsing).
+ Author: Todd DeLuca (https://github.com/todddeluca)
+- Fix provisioning test.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+
+## 0.4.5 (released 2014/03/22)
+
+- Add a 'quiet_stderr' keyword to silence the stderr output of vagrant commands.
+ Author: Rich Smith (https://github.com/MyNameIsMeerkat). The original author of the pull request
+ Author: Todd DeLuca. Split the pull request and tweaked the code.
+- Disable broken SandboxVagrant tests. Does a Sahara user want to fix these tests?
+ Author: Todd DeLuca.
+
+## 0.4.4 (released 2014/03/21)
+
+This minor release *should* be backwards-compatible.
+Add a 'reload' command, which the Vagrant docs describe as akin to a "halt" followed by an "up".
+Add a 'plugin list' command that returns a list of installed plugins.
+Add 'version' command, which gives programmatic access to the vagrant version string.
+Add '--provision-with' option to 'up', 'provision', and 'reload' commands.
+Author: Todd DeLuca (https://github.com/todddeluca)
+
+Add support LXC statuses 'frozen' and 'stopped'
+Author: Allard Hoeve (https://github.com/allardhoeve)
+
+
+## 0.4.3 (released 2013/12/18)
+
+Allow the underlying vagrant command output to be visible on the command line.
+Author: Alexandre Joseph (https://github.com/jexhson)
+
+
+## 0.4.2 (released 2013/12/08)
+
+This release fixes a bug in setup.py.
+Author: Nick Allen (https://github.com/nick-allen).
+
+
+## 0.4.1 (released 2013/12/08)
+
+This release includes improved testing, including a new VagrantTestCase.
+Author: Nick Allen (https://github.com/nick-allen).
+
+
+## 0.4.0 (released 2013/07/30)
+
+To indicate that this release includes a significant backwards-incompatible API
+change to `status`, the minor version number is being bumped.
+
+Backwards-incompatible enhancements and bug fixes:
+
+- Return a dictionary from `status()` in all cases, instead of returning None
+ for no status found, the status string for a single-VM or multi-VM with a
+ VM name specified, or a dictionary for the multi-VM case. This change makes
+ the return value more consistent. It also more closely parallels the return
+ value of the underlying `vagrant status` call.
+ Author: Alek Storm (https://github.com/alekstorm)
+ Author: Todd DeLuca (https://github.com/todddeluca) fixed tests.
+
+Enhancements and bug fixes:
+
+- Add ability for up to take a provider option
+ Author: Brett Cooley (https://github.com/brcooley)
+
+
+## 0.3.1 (released 2013/05/09)
+
+This release includes two bug fixes aimed at getting vagrant commands to work
+on Windows:
+
+- Use explicit vagrant executable instead of 'vagrant' in subprocess commands.
+ Author: Mohan Raj Rajamanickam (https://github.com/mohanraj-r)
+- Fix 'which' command so that it finds the vagrant executable on the PATH in
+ Windows.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+ Windows Tester: Mohan Raj Rajamanickam (https://github.com/mohanraj-r)
+
+## 0.3.0 (released 2013/04/12)
+
+This release contains backwards-incompatible changes related to the changes in
+Vagrant 1.1+. Vagrant 1.1 introduces the concept of providers (like virtualbox
+or vmware_fusion) which affect the API of `vagrant box` commands and the output
+of `vagrant status` (and other commands).
+
+New functionality and bug fixes:
+
+- Add new vm state: ABORTED
+ Author: Robert Strind (https://github.com/stribert)
+- Add new vm state: SAVED
+ Author: Todd DeLuca (https://github.com/todddeluca)
+- Fix parsing of vagrant 1.1 status messages.
+ Author: Vincent Viallet (https://github.com/zbal)
+ Author: Todd DeLuca (https://github.com/todddeluca)
+- Add new lifecycle method, suspend(), corresponding to `vagrant suspend`.
+ Author: Todd DeLuca (https://github.com/todddeluca)
+- Fix parsing of vagrant 1.1 ssh config output.
+ Author: Vincent Viallet (https://github.com/zbal)
+
+Backwards-incompatible changes:
+
+- Removed redundant `box_` prefix from `box_name` and `box_url` parameters
+ in `box_add` and `box_remove` methods. This aligns these parameter names
+ with the parameter names in the corresponding vagrant CLI commands.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- Added required parameter `provider` to `box_remove` method. This is
+ consistent with the backwards-incompatible change in the underlying
+ `vagrant box remove` command.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- Method `init`, corresponding to `vagrant init`, has been changed to more
+ closely reflect `vagrant init`. The parameter `box_path` has been changed
+ to `box_url`. The method no longer attempts to interactively add a box if
+ it has not already been added.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+
+
+## 0.2.0 (released 2012/12/09)
+
+This release incorporates numerous changes from a couple of forks on github,
+https://github.com/kamilgrymuza/python-vagrant and
+https://github.com/nithinbose87/python-vagrant.
+
+- A rewritten test suite allowing easier addition of new features.
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- The init() method which initialized the VM based on the named base box.
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- The halt() method which stops the VM without destroying it.
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- Support for sandbox mode using the Sahara gem
+ (https://github.com/jedi4ever/sahara).
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- Support for box-related commands - box_add(), box_list(), box_remove() methods.
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- Support for provisioning - up() accepts no_provision and there is the provision()
+ method.
+ Author: Kamil Grymuza (https://github.com/kamilgrymuza).
+- Added auto download of official boxes in the init()
+ Author: Nithin Bose (https://github.com/nithinbose87).
+
+Additionally, support for Multi-VM environments has been added, along with
+several other changes:
+
+- `vagrant.Vagrant` and `vagrant.SandboxVagrant` methods which support multi-VM
+ environments through the `vm_name` parameter.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- A new subclass, SandboxVagrant, for using the sandbox extensions from the
+ Sahara gem. Method names in SandboxVagrant were changed to conform to the
+ cli names of sandbox. E.g. sandbox_enable() was changed to sandbox_on().
+ This is in keeping with the goal of python-vagrant to stick closely to the
+ nomenclature of vagrant.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- A rewritten `tests/test_vagrant.py` which removes a dependency on Fabric,
+ adds tests for multi-VM functionality, and moves some setup and teardown up
+ to the module level.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- Vagrant and SandboxVagrant no longer invoke subprocesses with `shell=True`.
+ This way something like `vagrant ssh -c <command>` could be used without
+ worry about how to quote the command.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- Configuration is now cached under the given vm_name, when relevant.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+- `status()` now returns multiple statuses when in a multi-VM environment.
+ Author: Todd DeLuca (https://github.com/todddeluca).
+
+Please note that the changes to sandbox functionality are not
+backwards-compatible with the kamilgrymuza fork, though updating the code to
+use this project should be straightforward, should one want to do so.
+
+
+## 0.1.0 (released 2012/06/07)
+
+This is the original release of python-vagrant as its own package.
+
+- Author: Todd DeLuca (https://github.com/todddeluca).
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..0dc5de5
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,20 @@
+The MIT License (MIT)
+Copyright (c) 2014 Todd F. DeLuca
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the "Software"),
+to deal in the Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense,
+and/or sell copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..46f8500
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+include *.md *.txt
+recursive-include tests *.py Vagrantfile
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..0a46133
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,242 @@
+Metadata-Version: 1.1
+Name: python-vagrant
+Version: 0.5.13
+Summary: Python bindings for interacting with Vagrant virtual machines.
+Home-page: https://github.com/todddeluca/python-vagrant
+Author: Todd Francis DeLuca
+Author-email: todddeluca at yahoo.com
+License: MIT
+Description: ## Introduction
+
+ Python-vagrant is a python module that provides a _thin_ wrapper around the
+ `vagrant` command line executable, allowing programmatic control of Vagrant
+ virtual machines (boxes). This module is useful for:
+
+ - Starting a Vagrant virtual machine (VM) (`up`).
+ - Terminating a Vagrant VM (`destroy`).
+ - Halting a Vagrant VM without destroying it (`halt`).
+ - Querying the status of a VM or VMs (`status`).
+ - Getting ssh configuration information useful for SSHing into the VM. (`host`, `port`, ...)
+ - Running `vagrant` commands in a multi-VM environment
+ (http://vagrantup.com/v1/docs/multivm.html) by using `vm_name` parameter.
+ - Initializing the VM based on a named base box, using init().
+ - Adding, Removing, and Listing boxes (`box add`, `box remove`, `box list`).
+ - Provisioning VMs - up() accepts options like `no_provision`, `provision`, and `provision_with`, and there is a `provision()` method.
+ - Using sandbox mode from the Sahara gem (https://github.com/jedi4ever/sahara).
+
+ This project began because I wanted python bindings for Vagrant so I could
+ programmatically access my vagrant box using Fabric. Drop me a line to let me
+ know how you use python-vagrant. I'd love to share more use cases. -Todd DeLuca
+
+
+ ## Versioning and API Stability
+
+ This package is _beta_ and its API is not guaranteed to be stable. The API
+ attempts to be congruent with the `vagrant` API terminology, to facilitate
+ knowledge transfer for users already familiar with Vagrant. Over time, the
+ python-vagrant API has changed to better match the underling `vagrant` CLI and
+ to evolve with the changes in that CLI.
+
+ The package version numbering is in the form `0.X.Y`. The initial `0` reflects
+ the _beta_ nature of this project. The number `X` is incremented when
+ backwards-incompatible changes occur. The number `Y` is incremented when
+ backwards-compatible features or bug fixes are added.
+
+
+ ## Requirements
+
+ - Vagrant 1.4 or greater (currently tested with 1.7.2). Using the latest
+ version of Vagrant is strongly recommended.
+ - Vagrant requires VirtualBox, VMWare, or another supported provider.
+ - Python 2.7 (the only version this package has been tested with.) or Python
+ 3.3 or higher.
+ - The Sahara gem for Vagrant is optional. It will allow you to use
+ `SandboxVagrant`.
+
+
+ ## Installation
+
+ ### Install from pypi.python.org
+
+ Download and install python-vagrant:
+
+ pip install python-vagrant
+
+ ### Install from github.com
+
+ Clone and install python-vagrant
+
+ cd ~
+ git clone git at github.com:todddeluca/python-vagrant.git
+ cd python-vagrant
+ python setup.py install
+
+
+ ## Usage
+
+ A contrived example of starting a vagrant box (using a Vagrantfile from the
+ current directory) and running a fabric task on it:
+
+ import vagrant
+ from fabric.api import env, execute, task, run
+
+ @task
+ def mytask():
+ run('echo $USER')
+
+
+ v = vagrant.Vagrant()
+ v.up()
+ env.hosts = [v.user_hostname_port()]
+ env.key_filename = v.keyfile()
+ env.disable_known_hosts = True # useful for when the vagrant box ip changes.
+ execute(mytask) # run a fabric task on the vagrant host.
+
+ Another example showing how to use vagrant multi-vm feature with fabric:
+
+ import vagrant
+ from fabric.api import *
+
+ @task
+ def start(machine_name):
+ """Starts the specified machine using vagrant"""
+ v = vagrant.Vagrant()
+ v.up(vm_name=machine_name)
+ with settings(host_string= v.user_hostname_port(vm_name=machine_name),
+ key_filename = v.keyfile(vm_name=machine_name),
+ disable_known_hosts = True):
+ run("echo hello")
+
+ By default python vagrant instances are quiet, meaning that they capture stdout
+ and stderr. For a "loud" instance, use `vagrant.Vagrant(quiet_stdout=False)`.
+ Set `quiet_stderr=False` for an even louder version.
+
+ ### Interacting With the Vagrant Subprocess
+
+ The `Vagrant` class works by executing `vagrant` commands in a subprocess and
+ interpreting the output. Depending on the needs of the user, the communication
+ to and from the subprocess can be tailored by altering its environment and
+ where it sends its stdout and stderr.
+
+ #### Silencing the Stdout or Stderr of the Vagrant Subprocess
+
+ The stdout and stderr of the underlying vagrant process can be silenced by
+ using the `out_cm` and `err_cm` parameters, or by using the `quiet_stdout` and
+ `quiet_stderr` parameters of `Vagrant.__init__`.
+
+ Using `out_cm` and `err_cm` to redirect stdout and stderr to `/dev/null`:
+
+ v = vagrant.Vagrant(out_cm=vagrant.devnull_cm, err_cm=vagrant.devnull_cm)
+ v.up() # normally noisy
+
+ Using `quiet_stdout` and `quiet_stderr` to redirect stdout and stderr to
+ `/dev/null`:
+
+ v = vagrant.Vagrant(quiet_stdout=True, quiet_stderr=True)
+ v.up() # normally noisy
+
+ These are functionally equivalent.
+
+ #### Logging the Stdout or Stderr of the Vagrant Subprocess
+
+ A user might wish to direct the stdout and stderr of a vagrant subprocess to
+ a file, perhaps to log and analyze the results of an automated process. This
+ can be accomplished using the `out_cm` and `err_cm` parameters of
+ `Vagrant.__init__`.
+
+ For example, log the stdout and stderr of the subprocess to the file
+ 'deployment.log':
+
+ log_cm = vagrant.make_file_cm('deployment.log')
+ v = vagrant.Vagrant(out_cm=log_cm, err_cm=log_cm)
+ v.up() # normally noisy
+
+ #### Altering the Environment of the Vagrant Subprocess
+
+ It's possible to communicate with the Vagrant subprocess using environment
+ variables. The `Vagrantfile` could expect environment variables to be present
+ and act accordingly. The environment variables can be set by `python-vagrant`.
+
+ ```python
+ import vagrant
+
+ v = vagrant.Vagrant()
+
+ os_env = os.environ.copy()
+ os_env['USE_NFS'] = '1'
+
+ v.env = os_env
+ v.up() # will pass env to the vagrant subprocess
+ ```
+
+ Alternatively, the environment can be passed at instantiation time.
+
+ ```python
+ import vagrant
+
+ os_env = os.environ.copy()
+ os_env['USE_NFS'] = '1'
+
+ v = vagrant.Vagrant(env=env)
+ assert v.env is env # True
+ v.up() # will pass env to the vagrant subprocess
+ ```
+
+ ## Contribute
+
+ If you use python and vagrant and this project does not do what you want,
+ please open an issue or a pull request on github at
+ https://github.com/todddeluca/python-vagrant.
+
+ Please see CHANGELOG.md for a detailed list of contributions and authors.
+
+ When making a pull request, please include unit tests that test your changes
+ and make sure any existing tests still work. See the Testing section below.
+
+
+ ## Testing
+
+ Running the full suite of tests might take 10 minutes or so. It involves
+ downloading boxes and starting and stopping virtual machines several times.
+
+ Run the tests from the top-level directory of the repository:
+
+ nosetests
+
+ Here is an example of running an individual test:
+
+ nosetests tests.test_vagrant:test_boxes
+
+
+ Manual test of functionality for controlling where the vagrant subcommand
+ output is sent -- console or devnull:
+
+ >>> import vagrant
+ >>> import os
+ >>> vagrantfile = '/Users/tfd/proj/python-vagrant/tests/vagrantfiles/single_box'
+ >>> # Demonstrate a quiet Vagrant. Equivalent to out_cm=vagrant.devnull_cm
+ ... v1 = vagrant.Vagrant(vagrantfile)
+ >>> v1.destroy() # output to /dev/null
+ >>> # Demonstrate a loud Vagrant. Equivalent to out_cm=vagrant.stdout_cm
+ ... v2 = vagrant.Vagrant(vagrantfile, quiet_stdout=False)
+ >>> v2.destroy() # stdout sent to console
+ ==> default: VM not created. Moving on...
+ >>> # Demonstrate that out_cm takes precedence over quiet_stdout=True
+ ... v3 = vagrant.Vagrant(vagrantfile, out_cm=vagrant.stdout_cm)
+ >>> v3.destroy() # output to console
+ ==> default: VM not created. Moving on...
+ >>> # Demonstrate a quiet Vagrant using devnull_cm directly
+ ... v4 = vagrant.Vagrant(vagrantfile, out_cm=vagrant.devnull_cm)
+ >>> v4.destroy() # output to console
+ >>>
+
+
+
+Keywords: python virtual machine box vagrant virtualbox vagrantfile
+Platform: UNKNOWN
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Development Status :: 4 - Beta
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3.3
+Classifier: Programming Language :: Python :: 3.4
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..2e05129
--- /dev/null
+++ b/README.md
@@ -0,0 +1,225 @@
+## Introduction
+
+Python-vagrant is a python module that provides a _thin_ wrapper around the
+`vagrant` command line executable, allowing programmatic control of Vagrant
+virtual machines (boxes). This module is useful for:
+
+- Starting a Vagrant virtual machine (VM) (`up`).
+- Terminating a Vagrant VM (`destroy`).
+- Halting a Vagrant VM without destroying it (`halt`).
+- Querying the status of a VM or VMs (`status`).
+- Getting ssh configuration information useful for SSHing into the VM. (`host`, `port`, ...)
+- Running `vagrant` commands in a multi-VM environment
+ (http://vagrantup.com/v1/docs/multivm.html) by using `vm_name` parameter.
+- Initializing the VM based on a named base box, using init().
+- Adding, Removing, and Listing boxes (`box add`, `box remove`, `box list`).
+- Provisioning VMs - up() accepts options like `no_provision`, `provision`, and `provision_with`, and there is a `provision()` method.
+- Using sandbox mode from the Sahara gem (https://github.com/jedi4ever/sahara).
+
+This project began because I wanted python bindings for Vagrant so I could
+programmatically access my vagrant box using Fabric. Drop me a line to let me
+know how you use python-vagrant. I'd love to share more use cases. -Todd DeLuca
+
+
+## Versioning and API Stability
+
+This package is _beta_ and its API is not guaranteed to be stable. The API
+attempts to be congruent with the `vagrant` API terminology, to facilitate
+knowledge transfer for users already familiar with Vagrant. Over time, the
+python-vagrant API has changed to better match the underling `vagrant` CLI and
+to evolve with the changes in that CLI.
+
+The package version numbering is in the form `0.X.Y`. The initial `0` reflects
+the _beta_ nature of this project. The number `X` is incremented when
+backwards-incompatible changes occur. The number `Y` is incremented when
+backwards-compatible features or bug fixes are added.
+
+
+## Requirements
+
+- Vagrant 1.4 or greater (currently tested with 1.7.2). Using the latest
+ version of Vagrant is strongly recommended.
+- Vagrant requires VirtualBox, VMWare, or another supported provider.
+- Python 2.7 (the only version this package has been tested with.) or Python
+ 3.3 or higher.
+- The Sahara gem for Vagrant is optional. It will allow you to use
+ `SandboxVagrant`.
+
+
+## Installation
+
+### Install from pypi.python.org
+
+Download and install python-vagrant:
+
+ pip install python-vagrant
+
+### Install from github.com
+
+Clone and install python-vagrant
+
+ cd ~
+ git clone git at github.com:todddeluca/python-vagrant.git
+ cd python-vagrant
+ python setup.py install
+
+
+## Usage
+
+A contrived example of starting a vagrant box (using a Vagrantfile from the
+current directory) and running a fabric task on it:
+
+ import vagrant
+ from fabric.api import env, execute, task, run
+
+ @task
+ def mytask():
+ run('echo $USER')
+
+
+ v = vagrant.Vagrant()
+ v.up()
+ env.hosts = [v.user_hostname_port()]
+ env.key_filename = v.keyfile()
+ env.disable_known_hosts = True # useful for when the vagrant box ip changes.
+ execute(mytask) # run a fabric task on the vagrant host.
+
+Another example showing how to use vagrant multi-vm feature with fabric:
+
+ import vagrant
+ from fabric.api import *
+
+ @task
+ def start(machine_name):
+ """Starts the specified machine using vagrant"""
+ v = vagrant.Vagrant()
+ v.up(vm_name=machine_name)
+ with settings(host_string= v.user_hostname_port(vm_name=machine_name),
+ key_filename = v.keyfile(vm_name=machine_name),
+ disable_known_hosts = True):
+ run("echo hello")
+
+By default python vagrant instances are quiet, meaning that they capture stdout
+and stderr. For a "loud" instance, use `vagrant.Vagrant(quiet_stdout=False)`.
+Set `quiet_stderr=False` for an even louder version.
+
+### Interacting With the Vagrant Subprocess
+
+The `Vagrant` class works by executing `vagrant` commands in a subprocess and
+interpreting the output. Depending on the needs of the user, the communication
+to and from the subprocess can be tailored by altering its environment and
+where it sends its stdout and stderr.
+
+#### Silencing the Stdout or Stderr of the Vagrant Subprocess
+
+The stdout and stderr of the underlying vagrant process can be silenced by
+using the `out_cm` and `err_cm` parameters, or by using the `quiet_stdout` and
+`quiet_stderr` parameters of `Vagrant.__init__`.
+
+Using `out_cm` and `err_cm` to redirect stdout and stderr to `/dev/null`:
+
+ v = vagrant.Vagrant(out_cm=vagrant.devnull_cm, err_cm=vagrant.devnull_cm)
+ v.up() # normally noisy
+
+Using `quiet_stdout` and `quiet_stderr` to redirect stdout and stderr to
+`/dev/null`:
+
+ v = vagrant.Vagrant(quiet_stdout=True, quiet_stderr=True)
+ v.up() # normally noisy
+
+These are functionally equivalent.
+
+#### Logging the Stdout or Stderr of the Vagrant Subprocess
+
+A user might wish to direct the stdout and stderr of a vagrant subprocess to
+a file, perhaps to log and analyze the results of an automated process. This
+can be accomplished using the `out_cm` and `err_cm` parameters of
+`Vagrant.__init__`.
+
+For example, log the stdout and stderr of the subprocess to the file
+'deployment.log':
+
+ log_cm = vagrant.make_file_cm('deployment.log')
+ v = vagrant.Vagrant(out_cm=log_cm, err_cm=log_cm)
+ v.up() # normally noisy
+
+#### Altering the Environment of the Vagrant Subprocess
+
+It's possible to communicate with the Vagrant subprocess using environment
+variables. The `Vagrantfile` could expect environment variables to be present
+and act accordingly. The environment variables can be set by `python-vagrant`.
+
+```python
+import vagrant
+
+v = vagrant.Vagrant()
+
+os_env = os.environ.copy()
+os_env['USE_NFS'] = '1'
+
+v.env = os_env
+v.up() # will pass env to the vagrant subprocess
+```
+
+Alternatively, the environment can be passed at instantiation time.
+
+```python
+import vagrant
+
+os_env = os.environ.copy()
+os_env['USE_NFS'] = '1'
+
+v = vagrant.Vagrant(env=env)
+assert v.env is env # True
+v.up() # will pass env to the vagrant subprocess
+```
+
+## Contribute
+
+If you use python and vagrant and this project does not do what you want,
+please open an issue or a pull request on github at
+https://github.com/todddeluca/python-vagrant.
+
+Please see CHANGELOG.md for a detailed list of contributions and authors.
+
+When making a pull request, please include unit tests that test your changes
+and make sure any existing tests still work. See the Testing section below.
+
+
+## Testing
+
+Running the full suite of tests might take 10 minutes or so. It involves
+downloading boxes and starting and stopping virtual machines several times.
+
+Run the tests from the top-level directory of the repository:
+
+ nosetests
+
+Here is an example of running an individual test:
+
+ nosetests tests.test_vagrant:test_boxes
+
+
+Manual test of functionality for controlling where the vagrant subcommand
+output is sent -- console or devnull:
+
+ >>> import vagrant
+ >>> import os
+ >>> vagrantfile = '/Users/tfd/proj/python-vagrant/tests/vagrantfiles/single_box'
+ >>> # Demonstrate a quiet Vagrant. Equivalent to out_cm=vagrant.devnull_cm
+ ... v1 = vagrant.Vagrant(vagrantfile)
+ >>> v1.destroy() # output to /dev/null
+ >>> # Demonstrate a loud Vagrant. Equivalent to out_cm=vagrant.stdout_cm
+ ... v2 = vagrant.Vagrant(vagrantfile, quiet_stdout=False)
+ >>> v2.destroy() # stdout sent to console
+ ==> default: VM not created. Moving on...
+ >>> # Demonstrate that out_cm takes precedence over quiet_stdout=True
+ ... v3 = vagrant.Vagrant(vagrantfile, out_cm=vagrant.stdout_cm)
+ >>> v3.destroy() # output to console
+ ==> default: VM not created. Moving on...
+ >>> # Demonstrate a quiet Vagrant using devnull_cm directly
+ ... v4 = vagrant.Vagrant(vagrantfile, out_cm=vagrant.devnull_cm)
+ >>> v4.destroy() # output to console
+ >>>
+
+
diff --git a/python_vagrant.egg-info/PKG-INFO b/python_vagrant.egg-info/PKG-INFO
new file mode 100644
index 0000000..0a46133
--- /dev/null
+++ b/python_vagrant.egg-info/PKG-INFO
@@ -0,0 +1,242 @@
+Metadata-Version: 1.1
+Name: python-vagrant
+Version: 0.5.13
+Summary: Python bindings for interacting with Vagrant virtual machines.
+Home-page: https://github.com/todddeluca/python-vagrant
+Author: Todd Francis DeLuca
+Author-email: todddeluca at yahoo.com
+License: MIT
+Description: ## Introduction
+
+ Python-vagrant is a python module that provides a _thin_ wrapper around the
+ `vagrant` command line executable, allowing programmatic control of Vagrant
+ virtual machines (boxes). This module is useful for:
+
+ - Starting a Vagrant virtual machine (VM) (`up`).
+ - Terminating a Vagrant VM (`destroy`).
+ - Halting a Vagrant VM without destroying it (`halt`).
+ - Querying the status of a VM or VMs (`status`).
+ - Getting ssh configuration information useful for SSHing into the VM. (`host`, `port`, ...)
+ - Running `vagrant` commands in a multi-VM environment
+ (http://vagrantup.com/v1/docs/multivm.html) by using `vm_name` parameter.
+ - Initializing the VM based on a named base box, using init().
+ - Adding, Removing, and Listing boxes (`box add`, `box remove`, `box list`).
+ - Provisioning VMs - up() accepts options like `no_provision`, `provision`, and `provision_with`, and there is a `provision()` method.
+ - Using sandbox mode from the Sahara gem (https://github.com/jedi4ever/sahara).
+
+ This project began because I wanted python bindings for Vagrant so I could
+ programmatically access my vagrant box using Fabric. Drop me a line to let me
+ know how you use python-vagrant. I'd love to share more use cases. -Todd DeLuca
+
+
+ ## Versioning and API Stability
+
+ This package is _beta_ and its API is not guaranteed to be stable. The API
+ attempts to be congruent with the `vagrant` API terminology, to facilitate
+ knowledge transfer for users already familiar with Vagrant. Over time, the
+ python-vagrant API has changed to better match the underling `vagrant` CLI and
+ to evolve with the changes in that CLI.
+
+ The package version numbering is in the form `0.X.Y`. The initial `0` reflects
+ the _beta_ nature of this project. The number `X` is incremented when
+ backwards-incompatible changes occur. The number `Y` is incremented when
+ backwards-compatible features or bug fixes are added.
+
+
+ ## Requirements
+
+ - Vagrant 1.4 or greater (currently tested with 1.7.2). Using the latest
+ version of Vagrant is strongly recommended.
+ - Vagrant requires VirtualBox, VMWare, or another supported provider.
+ - Python 2.7 (the only version this package has been tested with.) or Python
+ 3.3 or higher.
+ - The Sahara gem for Vagrant is optional. It will allow you to use
+ `SandboxVagrant`.
+
+
+ ## Installation
+
+ ### Install from pypi.python.org
+
+ Download and install python-vagrant:
+
+ pip install python-vagrant
+
+ ### Install from github.com
+
+ Clone and install python-vagrant
+
+ cd ~
+ git clone git at github.com:todddeluca/python-vagrant.git
+ cd python-vagrant
+ python setup.py install
+
+
+ ## Usage
+
+ A contrived example of starting a vagrant box (using a Vagrantfile from the
+ current directory) and running a fabric task on it:
+
+ import vagrant
+ from fabric.api import env, execute, task, run
+
+ @task
+ def mytask():
+ run('echo $USER')
+
+
+ v = vagrant.Vagrant()
+ v.up()
+ env.hosts = [v.user_hostname_port()]
+ env.key_filename = v.keyfile()
+ env.disable_known_hosts = True # useful for when the vagrant box ip changes.
+ execute(mytask) # run a fabric task on the vagrant host.
+
... 2114 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-vagrant.git
More information about the Python-modules-commits
mailing list