Compare commits
2 Commits
1cf8706a52
...
d07d37d08e
Author | SHA1 | Date |
---|---|---|
Joshua Boniface | d07d37d08e | |
Joshua Boniface | 0639b16c86 |
|
@ -4,9 +4,16 @@ pushd $( git rev-parse --show-toplevel ) &>/dev/null
|
||||||
|
|
||||||
ex=0
|
ex=0
|
||||||
|
|
||||||
./prepare
|
./format check
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
echo "Aborting commit due to formatting or linting errors."
|
./format
|
||||||
|
echo "Black formatting change detected; review and recommit"
|
||||||
|
ex=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
./lint
|
||||||
|
if [[ $? -ne 0 ]]; then
|
||||||
|
echo "Linting error detected; correct and recommit"
|
||||||
ex=1
|
ex=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,8 @@ pushd $( git rev-parse --show-toplevel ) &>/dev/null
|
||||||
|
|
||||||
# Prepare code
|
# Prepare code
|
||||||
echo "Preparing code (format and lint)..."
|
echo "Preparing code (format and lint)..."
|
||||||
./prepare || exit
|
./format || exit 1
|
||||||
|
./lint || exit 1
|
||||||
|
|
||||||
# Build the packages
|
# Build the packages
|
||||||
echo -n "Building packages... "
|
echo -n "Building packages... "
|
||||||
|
|
|
@ -377,13 +377,18 @@ def vm_state(config, vm, target_state, force=False, wait=False):
|
||||||
API arguments: state={state}, wait={wait}
|
API arguments: state={state}, wait={wait}
|
||||||
API schema: {"message":"{data}"}
|
API schema: {"message":"{data}"}
|
||||||
"""
|
"""
|
||||||
|
if wait or target_state == "disable":
|
||||||
|
timeout = 300
|
||||||
|
else:
|
||||||
|
timeout = 3
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
"state": target_state,
|
"state": target_state,
|
||||||
"force": str(force).lower(),
|
"force": str(force).lower(),
|
||||||
"wait": str(wait).lower(),
|
"wait": str(wait).lower(),
|
||||||
}
|
}
|
||||||
response = call_api(
|
response = call_api(
|
||||||
config, "post", "/vm/{vm}/state".format(vm=vm), params=params, timeout=120
|
config, "post", "/vm/{vm}/state".format(vm=vm), params=params, timeout=timeout
|
||||||
)
|
)
|
||||||
|
|
||||||
if response.status_code == 200:
|
if response.status_code == 200:
|
||||||
|
|
6
format
6
format
|
@ -5,10 +5,14 @@ if ! which black &>/dev/null; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ $1 == "check" ]]; then
|
||||||
|
check="--check"
|
||||||
|
fi
|
||||||
|
|
||||||
pushd $( git rev-parse --show-toplevel ) &>/dev/null
|
pushd $( git rev-parse --show-toplevel ) &>/dev/null
|
||||||
|
|
||||||
echo "Formatting..."
|
echo "Formatting..."
|
||||||
black --safe --exclude api-daemon/migrations .
|
black --safe ${check} --exclude api-daemon/migrations .
|
||||||
ret=$?
|
ret=$?
|
||||||
if [[ $ret -eq 0 ]]; then
|
if [[ $ret -eq 0 ]]; then
|
||||||
echo "Successfully formatted project!"
|
echo "Successfully formatted project!"
|
||||||
|
|
Loading…
Reference in New Issue