From bd4c092156c00fcf650fdaafc22b44161f32fce7 Mon Sep 17 00:00:00 2001 From: Jeremy Schulman Date: Mon, 24 Feb 2014 08:06:02 -0500 Subject: [PATCH] updates --- env-setup | 19 ++++++++++++++++++- library/junos_install_os | 3 ++- 2 files changed, 20 insertions(+), 2 deletions(-) mode change 100644 => 100755 env-setup diff --git a/env-setup b/env-setup old mode 100644 new mode 100755 index 6bb68217..e966a0f5 --- a/env-setup +++ b/env-setup @@ -1 +1,18 @@ -export ANSIBLE_LIBRARY=$ANSIBLE_LIBRARY:`pwd`/library +#!/bin/bash +# usage: source env-setup + +# When run using source as directed, $0 gets set to bash, so we must use $BASH_SOURCE +if [ -n "$BASH_SOURCE" ] ; then + HACKING_DIR=`dirname $BASH_SOURCE` +elif [ $(basename $0) = "env-setup" ]; then + HACKING_DIR=`dirname $0` +else + HACKING_DIR="$PWD" +fi + +# The below is an alternative to readlink -fn which doesn't exist on OS X +# Source: http://stackoverflow.com/a/1678636 +FULL_PATH=`python -c "import os; print(os.path.realpath('$HACKING_DIR'))"` +PRJ_LIBRARY="$FULL_PATH/library" + +[[ $ANSIBLE_LIBRARY != ${PRJ_LIBRARY}* ]] && export ANSIBLE_LIBRARY=$PRJ_LIBRARY:$ANSIBLE_LIBRARY diff --git a/library/junos_install_os b/library/junos_install_os index bdb5e2ca..333b05e0 100644 --- a/library/junos_install_os +++ b/library/junos_install_os @@ -116,7 +116,8 @@ def main(): dev.open() results = junos_install_os(module, dev) - + results['check_mode'] = module.check_mode + dev.close() module.exit_json(**results)