From eee2d1afd06039d3ae7ff85ac7bdfa13a96ddb41 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 16 Aug 2012 21:34:55 -0400 Subject: [PATCH] If ANSIBLE_KEEP_REMOTE_FILES=1 is set as an environment file, remote files will not be deleted, which is useful only for development debugging purposes. --- CHANGELOG.md | 2 ++ Makefile | 2 -- lib/ansible/runner/__init__.py | 4 ++++ setup.py | 14 +++++++++----- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f42daeb6296..a69ca058b9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,8 @@ Ansible Changes By Release * -u and user: defaults to current user, rather than root, override as before * new module boilerplate code to check for mutually required arguments, arguments required together, exclusive args * /etc/ansible/ansible.cfg and ~/ansible.cfg now available to set default values and other things +* --list-hosts to show what hosts are included in each play of a playbook +* ANSIBLE_KEEP_REMOTE_FILES=1 can be used in debugging (envrionment variable) 0.6 "Cabo" -- August 6, 2012 diff --git a/Makefile b/Makefile index 5aab771cdc7..38c8e4493d6 100644 --- a/Makefile +++ b/Makefile @@ -101,8 +101,6 @@ python: python setup.py build install: - mkdir -p /usr/share/ansible - cp ./library/* /usr/share/ansible/ python setup.py install sdist: clean diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index f3e67653aef..27ad7829d8f 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -172,6 +172,10 @@ class Runner(object): def _delete_remote_files(self, conn, files): ''' deletes one or more remote files ''' + if os.getenv("ANSIBLE_KEEP_REMOTE_FILES","0") == "1": + # ability to turn off temp file deletion for debug purposes + return + if type(files) == str: files = [ files ] for filename in files: diff --git a/setup.py b/setup.py index 3c5ab6bb536..98c404906e4 100644 --- a/setup.py +++ b/setup.py @@ -1,16 +1,19 @@ #!/usr/bin/env python -# NOTE: setup.py does NOT install the contents of the library dir -# for you, you should go through "make install" or "make RPMs" -# for that, or manually copy modules over. - import os import sys +from glob import glob sys.path.insert(0, os.path.abspath('lib')) from ansible import __version__, __author__ from distutils.core import setup +# find library modules +from ansible.constants import DEFAULT_MODULE_PATH +data_files = [ (DEFAULT_MODULE_PATH, glob('./library/*')) ] + +print "DATA FILES=%s" % data_files + setup(name='ansible', version=__version__, description='Minimal SSH command and control', @@ -31,5 +34,6 @@ setup(name='ansible', 'bin/ansible', 'bin/ansible-playbook', 'bin/ansible-pull' - ] + ], + data_files=data_files )