Skip to content

Commit 68e5daa

Browse files
committed
Remove dependency on jp.py
It's an extra thing for users to have to install. Moved the jmespath query from jp.py to awscli
1 parent 8167e1e commit 68e5daa

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,8 @@ These functions make extensive use of the incredibly powerful AWSCLI.
1717

1818
## Prerequisites
1919

20-
* bash
2120
* [awscli](http://aws.amazon.com/cli/)
22-
* jp (installed automatically if you used python-pip to install awscli)
21+
* [bash](https://www.gnu.org/software/bash/)
2322
* [jq-1.4](http://stedolan.github.io/jq/download/) or later (for stack-diff)
2423

2524

lib/stack-functions

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,14 @@ stack-parameters() {
245245
local stack=$(__bma_read_resources ${inputs} | head -1)
246246
[[ -z ${stack} ]] && __bma_usage "stack" && return 1
247247

248-
local query='
249-
Stacks[].Parameters[]
250-
'
248+
local query='sort_by(Stacks[].Parameters[], &ParameterKey)'
251249
local output=$(__bma_read_switches $inputs | grep ^--output | cut -d\ -f2-)
252250

253251
aws cloudformation describe-stacks \
254252
--stack-name ${stack} \
255253
--query "${query}" \
256-
--output ${output:-json}
254+
--output ${output:-json} \
255+
jq --sort-keys
257256
}
258257

259258
stack-status() {
@@ -404,7 +403,7 @@ _stack_diff_params() {
404403
else
405404
local DIFF_CMD=diff
406405
fi
407-
$DIFF_CMD -u --label params <(aws cloudformation describe-stacks --query "Stacks[].Parameters[]" --stack-name $stack | jq --sort-keys . | jp.py 'sort_by(@,&ParameterKey)') --label $params <(jq --sort-keys . $params | jp.py 'sort_by(@,&ParameterKey)' );
406+
$DIFF_CMD -u --label params <(aws cloudformation describe-stacks --query "Stacks[].Parameters[]" --stack-name $stack | jq --sort-keys 'sort_by(.ParameterKey)') --label $params <(jq --sort-keys 'sort_by(.ParameterKey)' $params);
408407
if [ $? -eq 0 ]; then
409408
echo "params for stack ($stack) and contents of file ($params) are the same" >&2
410409
fi

0 commit comments

Comments
 (0)