Efforts to make ucloud a python package
This commit is contained in:
parent
bbe09667a6
commit
1e7300b56e
71 changed files with 241 additions and 1043 deletions
33
ucloud/sanity_checks.py
Normal file
33
ucloud/sanity_checks.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import sys
|
||||
import subprocess as sp
|
||||
|
||||
from os.path import isdir
|
||||
from ucloud.config import env_vars
|
||||
|
||||
|
||||
def check():
|
||||
#########################
|
||||
# ucloud-image-scanner #
|
||||
#########################
|
||||
if env_vars.get('STORAGE_BACKEND') == 'filesystem' and not isdir(env_vars.get('IMAGE_DIR')):
|
||||
print("You have set STORAGE_BACKEND to filesystem. So,"
|
||||
"the {} must exists. But, it don't".format(env_vars.get('IMAGE_DIR')))
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
sp.check_output(['which', 'qemu-img'])
|
||||
except Exception:
|
||||
print("qemu-img missing")
|
||||
sys.exit(1)
|
||||
|
||||
###############
|
||||
# ucloud-host #
|
||||
###############
|
||||
|
||||
if env_vars.get('STORAGE_BACKEND') == 'filesystem' and not isdir(env_vars.get('VM_DIR')):
|
||||
print("You have set STORAGE_BACKEND to filesystem. So, the vm directory mentioned"
|
||||
" in .env file must exists. But, it don't.")
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
check()
|
||||
Loading…
Add table
Add a link
Reference in a new issue