forked from NetRadiator/backup-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython
More file actions
executable file
·24 lines (20 loc) · 754 Bytes
/
python
File metadata and controls
executable file
·24 lines (20 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# Usage: python -c '...'
# Fake python command stub for tests. Python is used on the remote side
# only to parse JSON data retreived from the maintenance status API and produce
# a number of active writing processes. Verify that python code passes syntax
# checks and fake a 0 process count.
set -e
# make sure we have a -c arg
if [ "$1" != '-c' ]; then
echo "unexpected invocation: python -c '...' expected." 1>&2
exit 1
fi
# read in fake data from stdin
cat >/dev/null
# verify the python compiles at least. if this fails then the python code passed
# to -c failed basic syntax checks.
echo "$2" |
/usr/bin/python -c "import sys; __import__('compiler').parse(sys.stdin.read())"
# pretend we found zero processes.
echo 0