Skip to content
Permalink
Browse files

updates

  • Loading branch information...
Jeremy Schulman
Jeremy Schulman committed Mar 17, 2014
1 parent 93e5530 commit ce6dfd181189632750f33b7b9333066ff3c79746
Showing with 27 additions and 4 deletions.
  1. +18 −1 env-setup.sh
  2. +9 −3 lib/jnpr/junos/utils/config.py
19 env-setup.sh 100644 → 100755
@@ -1 +1,18 @@
export PYTHONPATH=`pwd`/lib:$PYTHONPATH
#!/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_LIB="$FULL_PATH/lib"

[[ $PYTHONPATH != ${PRJ_LIB}* ]] && export PYTHONPATH=$PRJ_LIB:$PYTHONPATH
@@ -276,8 +276,11 @@ def lock(self):
try:
self.rpc.lock_configuration()
except Exception as err:
# :err: is from ncclient
raise LockError(rsp = JXML.remove_namespaces(err.xml))
if isinstance(err, RpcError):
raise LockError(rsp=err.rsp)
else:
# :err: is from ncclient
raise LockError(rsp = JXML.remove_namespaces(err.xml))

return True

@@ -292,8 +295,11 @@ def unlock( self ):
try:
self.rpc.unlock_configuration()
except Exception as err:
if isinstance(err, RpcError):
raise LockError(rsp=err.rsp)
else:
# :err: is from ncclient
raise UnlockError(rsp = JXML.remove_namespaces(err.xml))
raise UnlockError(rsp = JXML.remove_namespaces(err.xml))

return True

0 comments on commit ce6dfd1

Please sign in to comment.
You can’t perform that action at this time.