Fuel version info is returned as answer to ostf-server --version
Change-Id: I5c83c1e703fc94a875dd2488db9da2ae0f3b0cf5 Closes-Bug: #1517085
This commit is contained in:
parent
e7e97a3959
commit
f02be2b6fa
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2013 Mirantis, Inc.
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@ -15,6 +15,8 @@
|
|||
import logging
|
||||
import os
|
||||
|
||||
from fuel_plugin.ostf_adapter import mixins
|
||||
|
||||
try:
|
||||
from oslo.config import cfg
|
||||
except ImportError:
|
||||
|
@ -101,4 +103,5 @@ def init_config(args=[]):
|
|||
else:
|
||||
config_files.append(path)
|
||||
|
||||
cfg.CONF(args, project='fuel_ostf', default_config_files=config_files)
|
||||
cfg.CONF(args, project='fuel_ostf', default_config_files=config_files,
|
||||
version=mixins.get_version_string())
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2013 Mirantis, Inc.
|
||||
# Copyright 2015 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
|
@ -19,6 +19,11 @@ try:
|
|||
except ImportError:
|
||||
from oslo_config import cfg
|
||||
|
||||
try:
|
||||
from oslo.serialization import jsonutils
|
||||
except ImportError:
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
import requests
|
||||
from sqlalchemy.orm import joinedload
|
||||
|
||||
|
@ -30,6 +35,8 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
TEST_REPOSITORY = []
|
||||
# TODO(ikutukov): remove hardcoded Nailgun API urls here and below
|
||||
NAILGUN_VERSION_API_URL = 'http://{0}:{1}/api/v1/version'
|
||||
|
||||
|
||||
def delete_db_data(session):
|
||||
|
@ -107,6 +114,18 @@ def discovery_check(session, cluster_id, token=None):
|
|||
session.merge(cluster_state)
|
||||
|
||||
|
||||
def get_version_string(token=None):
|
||||
requests_session = requests.Session()
|
||||
requests_session.trust_env = False
|
||||
request_url = NAILGUN_VERSION_API_URL.format(cfg.CONF.adapter.nailgun_host,
|
||||
cfg.CONF.adapter.nailgun_port)
|
||||
try:
|
||||
response = requests_session.get(request_url).json()
|
||||
return jsonutils.dumps(response)
|
||||
except (ValueError, IOError, requests.exceptions.HTTPError):
|
||||
return "Can't obtain version via Nailgun API"
|
||||
|
||||
|
||||
def _get_cluster_attrs(cluster_id, token=None):
|
||||
cluster_attrs = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue