Commit 052b8e72 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[environments] Refactor code for new WebAPI class

parent e02abb61
......@@ -36,7 +36,6 @@
import click
import logging
import six
import simplejson as json
from beat.core.dock import Host
......@@ -52,17 +51,7 @@ logger = logging.getLogger(__name__)
def get_remote_environments(ctx):
config = ctx.meta.get("config")
with common.make_webapi(config) as webapi:
status, answer = webapi.get("/api/v1/backend/environments/")
if status != six.moves.http_client.OK:
logger.error(
"failed to retrieve environment list on {}, reason: {}".format(
webapi.platform, six.moves.http_client.responses[status]
)
)
return {}
else:
return json.loads(answer)
return webapi.get("/api/v1/backend/environments/")
def get_docker_environments():
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment