Skip to content

Commit

Permalink
Merge to devel july 12,2013
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodney Quillo committed Jul 12, 2013
2 parents bc7aa79 + fba1f7e commit e1cf9e4
Show file tree
Hide file tree
Showing 373 changed files with 32,769 additions and 6,877 deletions.
18 changes: 13 additions & 5 deletions .gitignore
@@ -1,6 +1,7 @@
# build products...
*.py[co]
build
AUTHORS.TXT
# Emacs backup files...
*~
.\#*
Expand All @@ -13,6 +14,8 @@ rpm-build
.pydevproject
# PyCharm stuff...
.idea
#IntelliJ IDEA stuff..
*.iml
# Mac OS X stuff...
.DS_Store
# manpage build stuff...
Expand All @@ -21,10 +24,15 @@ docs/man/man3/*
*.sublime-project
*.sublime-workspace
# docsite stuff...
docsite/rst/modules
docsite/*.html
docsite/_static/*.gif
docsite/_static/*.png
docsite/_static/websupport.js
docsite/latest/rst/modules
docsite/latest/*.html
docsite/latest/_static/*.gif
docsite/latest/_static/*.png
docsite/latest/_static/websupport.js
docsite/latest/searchindex.js
docsite/latest/htmlout
# deb building stuff...
debian/
# Vim swap files
*.swp
*.swo
358 changes: 353 additions & 5 deletions CHANGELOG.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -60,6 +60,9 @@ Automation tests are run by "make tests" and contain a mixture of integration an
* Your user environment should allow "ssh 127.0.0.1"
without a password - so a key held in ssh-agent and an authorized_keys entry.

If your module does not require any additional dependencies beyond ansible-core, it is a good idea to write some
tests for the module.

Contributors License Agreement
==============================

Expand Down
44 changes: 22 additions & 22 deletions Makefile
Expand Up @@ -20,11 +20,16 @@ OS = $(shell uname -s)
# Manpages are currently built with asciidoc -- would like to move to markdown
# This doesn't evaluate until it's called. The -D argument is the
# directory of the target file ($@), kinda like `dirname`.
MANPAGES := docs/man/man1/ansible.1 docs/man/man1/ansible-playbook.1 docs/man/man1/ansible-pull.1 docs/man/man1/ansible-doc.1
ifneq ($(shell which a2x 2>/dev/null),)
ASCII2MAN = a2x -D $(dir $@) -d manpage -f manpage $<
ASCII2HTMLMAN = a2x -D docs/html/man/ -d manpage -f xhtml
MANPAGES := docs/man/man1/ansible.1 docs/man/man1/ansible-playbook.1 docs/man/man1/ansible-pull.1 docs/man/man1/ansible-doc.1
else
ASCII2MAN = @echo "ERROR: AsciiDoc 'a2x' command is not installed but is required to build $(MANPAGES)" && exit 1
endif

SITELIB = $(shell python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
PYTHON=python
SITELIB = $(shell $(PYTHON) -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")

# VERSION file provides one place to update the software version
VERSION := $(shell cat VERSION)
Expand All @@ -47,23 +52,28 @@ endif
# RPM build parameters
RPMSPECDIR= packaging/rpm
RPMSPEC = $(RPMSPECDIR)/ansible.spec
RPMDIST = $(shell rpm --eval '%dist')
RPMDIST = $(shell rpm --eval '%{?dist}')
RPMRELEASE = 1
ifeq ($(OFFICIAL),)
RPMRELEASE = 0.git$(DATE)
endif
RPMNVR = "$(NAME)-$(VERSION)-$(RPMRELEASE)$(RPMDIST)"

NOSETESTS := nosetests

########################################################

all: clean python

tests:
PYTHONPATH=./lib nosetests -d -v
PYTHONPATH=./lib $(NOSETESTS) -d -v

# To force a rebuild of the docs run 'touch VERSION && make docs'
docs: $(MANPAGES) modulepages

authors:
sh hacking/authors.sh

# Regenerate %.1.asciidoc if %.1.asciidoc.in has been modified more
# recently than %.1.asciidoc.
%.1.asciidoc: %.1.asciidoc.in
Expand Down Expand Up @@ -109,15 +119,17 @@ clean:
rm -rf deb-build
rm -rf docs/json
rm -rf docs/js
@echo "Cleaning up authors file"
rm -f AUTHORS.TXT

python:
python setup.py build
$(PYTHON) setup.py build

install:
python setup.py install
$(PYTHON) setup.py install

sdist: clean docs
python setup.py sdist -t MANIFEST.in
$(PYTHON) setup.py sdist -t MANIFEST.in

rpmcommon: sdist
@mkdir -p rpm-build
Expand Down Expand Up @@ -146,6 +158,7 @@ rpm: rpmcommon
--define "_specdir $(RPMSPECDIR)" \
--define "_sourcedir %{_topdir}" \
--define "_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm" \
--define "__python `which $(PYTHON)`" \
-ba rpm-build/$(NAME).spec
@rm -f rpm-build/$(NAME).spec
@echo "#############################################"
Expand All @@ -164,23 +177,10 @@ deb: debian
# for arch or gentoo, read instructions in the appropriate 'packaging' subdirectory directory

modulepages:
PYTHONPATH=./lib hacking/module_formatter.py -A $(VERSION) -t man -o docs/man/man3/ --module-dir=library --template-dir=hacking/templates

modulejson:
mkdir -p docs/json
PYTHONPATH=./lib hacking/module_formatter.py -A $(VERSION) -t json -o docs/json --module-dir=library --template-dir=hacking/templates

modulejs:
mkdir -p docs/js
make modulejson
PYTHONPATH=./lib hacking/module_formatter.py -A $(VERSION) -t js -o docs/js --module-dir=docs/json --template-dir=hacking/templates
PYTHONPATH=./lib $(PYTHON) hacking/module_formatter.py -A $(VERSION) -t man -o docs/man/man3/ --module-dir=library --template-dir=hacking/templates # --verbose

# because this requires Sphinx it is not run as part of every build, those building the RPM and so on can ignore this

webdocs:
(cd docsite; make docs)

# just for quick testing of all the module docs
webdocs2:
(cd docsite; make modules)
(cd docsite/latest; make docs)

14 changes: 6 additions & 8 deletions README.md
Expand Up @@ -4,11 +4,11 @@ Ansible
Ansible is a radically simple configuration-management, deployment, task-execution, and
multinode orchestration framework.

Read the documentation and more at http://ansible.cc
Read the documentation and more at http://ansibleworks.com/

Many users run straight from the development branch (it's generally fine to do so), but you might also wish to consume a release. You can find
instructions on http://ansible.cc/docs/gettingstarted.html for a variety of platforms. If you want a tarball of the last release, go to
http://ansible.cc/releases/ and you can also install with pip (though that will bring in some optional binary dependencies you normally do not need).
instructions on http://ansibleworks.com/docs/gettingstarted.html for a variety of platforms. If you want a tarball of the last release, go to
http://ansibleworks.com/releases/ and you can also install with pip (though that will bring in some optional binary dependencies you normally do not need).

Design Principles
=================
Expand All @@ -25,7 +25,7 @@ Design Principles
Get Involved
============

* [ansible-project mailing list](http://groups.google.com/group/ansible-project)
* [ansible-project mailing list](http://groups.google.com/group/ansible-project), rss: [here](https://groups.google.com/group/ansible-project/feed/rss_v2_0_msgs.xml?num=50&pli=1)
* irc.freenode.net: #ansible

Branch Info
Expand All @@ -39,8 +39,6 @@ Branch Info
Author
======

Michael DeHaan -- michael.dehaan@gmail.com

[http://michaeldehaan.net](http://michaeldehaan.net/)

Michael DeHaan -- michael@ansibleworks.com

[AnsibleWorks](http://ansibleworks.com)
26 changes: 15 additions & 11 deletions RELEASES.txt
@@ -1,16 +1,20 @@
Ansible Releases at a Glance
============================

1.1 "Mean Street" ----- pending
1.0 "Eruption" -------- 02-01-2013
0.9 "Dreams" ---------- 11-30-2012
0.8 "Cathedral" ------- 10-19-2012
0.7 "Panama" ---------- 09-06-2012
0.6 "Cabo" ------------ 08-06-2012
0.5 "Amsterdam" ------- 07-04-2012
0.4 "Unchained" ------- 05-23-2012
0.3 "Baluchitherium" -- 04-23-2012
0.0.2 Untitled
0.0.1 Untitled
1.3 "Top of the World" ----- Release Pending
1.2.2 "Hear About It Later" -- 07-05-2013
1.2.1 "Hear About It Later" -- 07-04-2013
1.2 "Right Now" ------------ 06-10-2013
1.1 "Mean Street" ---------- 04-02-2013
1.0 "Eruption" ------------- 02-01-2013
0.9 "Dreams" --------------- 11-30-2012
0.8 "Cathedral" ------------ 10-19-2012
0.7 "Panama" --------------- 09-06-2012
0.6 "Cabo" ----------------- 08-06-2012
0.5 "Amsterdam" ------------ 07-04-2012
0.4 "Unchained" ------------ 05-23-2012
0.3 "Baluchitherium" ------- 04-23-2012
0.0.2 Untitled
0.0.1 Untitled


2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
1.1
1.3
49 changes: 30 additions & 19 deletions bin/ansible
Expand Up @@ -20,15 +20,13 @@
########################################################

import sys
import getpass

from ansible.runner import Runner
import ansible.constants as C
from ansible import utils
from ansible import errors
from ansible import callbacks
from ansible import inventory

########################################################

class Cli(object):
Expand All @@ -45,15 +43,24 @@ class Cli(object):
def parse(self):
''' create an options parser for bin/ansible '''

parser = utils.base_parser(constants=C, runas_opts=True, subset_opts=True, async_opts=True,
output_opts=True, connect_opts=True, check_opts=True, usage='%prog <host-pattern> [options]')
parser = utils.base_parser(
constants=C,
runas_opts=True,
subset_opts=True,
async_opts=True,
output_opts=True,
connect_opts=True,
check_opts=True,
diff_opts=False,
usage='%prog <host-pattern> [options]'
)

parser.add_option('-a', '--args', dest='module_args',
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
parser.add_option('-m', '--module-name', dest='module_name',
help="module name to execute (default=%s)" % C.DEFAULT_MODULE_NAME,
default=C.DEFAULT_MODULE_NAME)
parser.add_option('--list-hosts', dest='listhosts', action='store_true',
help="dump out a list of hosts matching input pattern, does not execute any modules!")

options, args = parser.parse_args()
self.callbacks.options = options

Expand All @@ -70,30 +77,29 @@ class Cli(object):
pattern = args[0]

inventory_manager = inventory.Inventory(options.inventory)
if options.subset:
inventory_manager.subset(options.subset)
hosts = inventory_manager.list_hosts(pattern)
if len(hosts) == 0:
print >>sys.stderr, "No hosts matched"
callbacks.display("No hosts matched", stderr=True)
sys.exit(1)

if options.listhosts:
for host in hosts:
print ' %s' % host
callbacks.display(' %s' % host)
sys.exit(0)

if options.module_name == 'command' and not options.module_args:
print >>sys.stderr, "No argument passed to command module"
if ((options.module_name == 'command' or options.module_name == 'shell')
and not options.module_args):
callbacks.display("No argument passed to %s module" % options.module_name, color='red', stderr=True)
sys.exit(1)

sshpass = None
sudopass = None
options.ask_pass = options.ask_pass or C.DEFAULT_ASK_PASS
if options.ask_pass:
sshpass = getpass.getpass(prompt="SSH password: ")
options.ask_sudo_pass= options.ask_sudo_pass or C.DEFAULT_ASK_SUDO_PASS
if options.ask_sudo_pass:
sudopass = getpass.getpass(prompt="sudo password: ")
options.sudo = True
if options.sudo_user:
( sshpass, sudopass ) = utils.ask_passwords(ask_pass=options.ask_pass, ask_sudo_pass=options.ask_sudo_pass)
if options.sudo_user or options.ask_sudo_pass:
options.sudo = True
options.sudo_user = options.sudo_user or C.DEFAULT_SUDO_USER
if options.tree:
Expand All @@ -110,11 +116,12 @@ class Cli(object):
callbacks=self.callbacks, sudo=options.sudo,
sudo_pass=sudopass,sudo_user=options.sudo_user,
transport=options.connection, subset=options.subset,
check=options.check
check=options.check,
diff=options.check
)

if options.seconds:
print "background launch...\n\n"
callbacks.display("background launch...\n\n", color='cyan')
results, poller = runner.run_async(options.seconds)
results = self.poll_while_needed(poller, options)
else:
Expand All @@ -137,6 +144,10 @@ class Cli(object):
########################################################

if __name__ == '__main__':
callbacks.display("", log_only=True)
callbacks.display(" ".join(sys.argv), log_only=True)
callbacks.display("", log_only=True)

cli = Cli()
(options, args) = cli.parse()
try:
Expand All @@ -148,6 +159,6 @@ if __name__ == '__main__':
sys.exit(2)
except errors.AnsibleError, e:
# Generic handler for ansible specific errors
print "ERROR: %s" % str(e)
callbacks.display("ERROR: %s" % str(e), stderr=True, color='red')
sys.exit(1)

0 comments on commit e1cf9e4

Please sign in to comment.