migration command added, OTP creds can be read from environment variables, json output is now formated nicely

This commit is contained in:
ahmadbilalkhalid 2019-08-12 17:56:19 +05:00
commit 61d1633599
5 changed files with 59 additions and 33 deletions

View file

@ -3,7 +3,7 @@ import json
import requests
from decouple import config
from .helper import OTPCredentials
from .helper import OTPCredentials, load_dump_pretty
@click.group()
@ -17,7 +17,7 @@ def image():
def list(public, private):
if public:
r = requests.get(f"{config('UCLOUD_API_SERVER')}/image/list-public")
print(json.loads(r.content))
print(load_dump_pretty(r.content))
@image.command("create-from-file")
@ -27,4 +27,4 @@ def list(public, private):
def create_from_file(name, uuid, image_store_name):
data = {"name": name, "uuid": uuid, "image_store": image_store_name}
r = requests.post(f"{config('UCLOUD_API_SERVER')}/image/create", json=data)
print(r.content.decode("utf-8"))
print(load_dump_pretty(r.content))