Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/azure-cli/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Release History
===============

* Rewrite the az wrapper in python

**Compute**

* vmss create: Add --terminate-notification-time parameters to support terminate scheduled event configurability.
Expand Down
22 changes: 12 additions & 10 deletions src/azure-cli/az
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/usr/bin/env bash
#!/usr/bin/env python

SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
import sys
import os

export PYTHONPATH="${DIR}/src:${PYTHONPATH}"
dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'src')

python -m azure.cli "$@"
if os.environ.get('PYTHONPATH') == None:
os.environ['PYTHONPATH'] = dir
else:
os.environ['PYTHONPATH'] = os.pathsep.join([
dir,
os.environ.get('PYTHONPATH'),
])

os.execl(sys.executable, sys.executable , '-m', 'azure.cli', *sys.argv[1:])