1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +00:00

Rest framework (#24)

* Add rest framework for API: First Commit

* modify some shell scripts to make variable references safer; modify some python scripts to reduce the code complexity and cyclomatic complexity of functions.

* Add REST API for some webvirtcloud functions. Instance list/delete/create, compute list/delete/create, storages-network list/retrieve. Add swagger and redoc for API interface

* update requirements

Co-authored-by: herengui <herengui@uniontech.com>
This commit is contained in:
catborise 2022-08-22 15:12:33 +03:00 committed by GitHub
parent 92254401dc
commit cfce71ec2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 1170 additions and 348 deletions

View file

@ -45,7 +45,7 @@ echowarn() {
# DESCRIPTION: Echo debug information to stdout.
#-------------------------------------------------------------------------------
echodebug() {
if [ $_ECHO_DEBUG -eq $BS_TRUE ]; then
if [ "${_ECHO_DEBUG}" -eq "${BS_TRUE}" ]; then
printf "${BC} * DEBUG${EC}: %s\n" "$@";
fi
}
@ -154,8 +154,7 @@ __gather_linux_system_info() {
DISTRO_VERSION=""
# Let's test if the lsb_release binary is available
rv=$(lsb_release >/dev/null 2>&1)
if [ $? -eq 0 ]; then
if lsb_release >/dev/null 2>&1; then
DISTRO_NAME=$(lsb_release -si)
if [ "x$(echo "$DISTRO_NAME" | grep RedHat)" != "x" ]; then
# Let's convert CamelCase to Camel Case
@ -208,7 +207,7 @@ __gather_linux_system_info() {
;;
arch ) n="Arch Linux" ;;
centos ) n="CentOS" ;;
almalinux ) n="AlmaLinux" ;;
almalinux ) n="AlmaLinux" ;;
debian ) n="Debian" ;;
ubuntu ) n="Ubuntu" ;;
fedora ) n="Fedora" ;;
@ -248,7 +247,7 @@ __gather_linux_system_info() {
;;
esac
;;
* ) n="${n}" ;
* ) ;;
esac
DISTRO_NAME=$n
DISTRO_VERSION=$v
@ -779,8 +778,7 @@ if [ "$INSTALL_FUNC" = "null" ]; then
exit 1
else
echoinfo "Running ${INSTALL_FUNC}()"
$INSTALL_FUNC
if [ $? -ne 0 ]; then
if ! $INSTALL_FUNC; then
echoerror "Failed to run ${INSTALL_FUNC}()!!!"
exit 1
fi
@ -803,8 +801,7 @@ if [ "$POST_INSTALL_FUNC" = "null" ]; then
exit 1
else
echoinfo "Running ${POST_INSTALL_FUNC}()"
$POST_INSTALL_FUNC
if [ $? -ne 0 ]; then
if ! $POST_INSTALL_FUNC; then
echoerror "Failed to run ${POST_INSTALL_FUNC}()!!!"
exit 1
fi
@ -827,8 +824,7 @@ if [ "$DAEMONS_RUNNING_FUNC" = "null" ]; then
exit 1
else
echoinfo "Running ${DAEMONS_RUNNING_FUNC}()"
$DAEMONS_RUNNING_FUNC
if [ $? -ne 0 ]; then
if ! $DAEMONS_RUNNING_FUNC; then
echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!"
exit 1
fi

View file

@ -1,7 +1,7 @@
-r ../conf/requirements.txt
coverage==6.2
django-debug-toolbar==3.2.4
pycodestyle==2.8.0
pyflakes==2.4.0
pylint==2.13.9
coverage==6.4.4
django-debug-toolbar==3.6.0
pycodestyle==2.9.1
pyflakes==2.5.0
pylint==2.14.5
yapf==0.32.0