Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.cmdline
Commits
052b8e72
Commit
052b8e72
authored
Oct 14, 2019
by
Samuel GAIST
Browse files
[environments] Refactor code for new WebAPI class
parent
e02abb61
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/cmdline/environments.py
View file @
052b8e72
...
...
@@ -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
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment