Avoid hardcoding version numbers in the settings

The version number can be extracted from the package's filename.

Change-Id: I0fd3cf86a3a299898027b5e6be07c6ec47e0271c
This commit is contained in:
Simon Pasquier 2016-05-12 17:11:47 +02:00
parent 11067ea33f
commit fe47baae9b
5 changed files with 27 additions and 4 deletions

View File

@ -12,11 +12,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from stacklight_tests.helpers import helpers
from stacklight_tests import settings
name = 'elasticsearch_kibana'
version = '0.9.0'
role_name = ['elasticsearch_kibana']
vip_name = 'es_vip_mgmt'
plugin_path = settings.ELASTICSEARCH_KIBANA_PLUGIN_PATH
version = helpers.get_plugin_version(plugin_path)

View File

@ -13,6 +13,7 @@
# under the License.
import os
import re
import time
import urllib2
@ -23,12 +24,30 @@ from proboscis import asserts
from stacklight_tests import settings
PACKAGE_VERSION_RE = re.compile(r'(\d+\.\d+\.\d+)')
def create_cluster(
env, name, cluster_settings=None, mode=settings.DEPLOYMENT_MODE):
return env.fuel_web.create_cluster(
name=name, settings=cluster_settings, mode=mode)
def get_plugin_version(filename):
"""Extract the plugin version from the package filename.
:param filename: the plugin's filename.
:type filename: str
:returns: the plugin's version or None if not found
:rtype: str
"""
m = PACKAGE_VERSION_RE.search(filename)
if m:
return m.group(1)
else:
return None
class PluginHelper(object):
"""Class for common help functions."""

View File

@ -12,14 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from stacklight_tests.helpers import helpers
from stacklight_tests import settings
name = 'influxdb_grafana'
version = '0.9.0'
role_name = ['influxdb_grafana']
vip_name = 'influxdb'
plugin_path = settings.INFLUXDB_GRAFANA_PLUGIN_PATH
version = helpers.get_plugin_version(plugin_path)
influxdb_db_name = "lma"
influxdb_user = 'influxdb'

View File

@ -12,14 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from stacklight_tests.helpers import helpers
from stacklight_tests import settings
name = 'lma_collector'
version = '0.9.0'
role_name = [] # NOTE(rpromyshlennikov): there is no role name
# because lma collector is installed on all nodes in cluster
plugin_path = settings.LMA_COLLECTOR_PLUGIN_PATH
version = helpers.get_plugin_version(plugin_path)
options = {
'environment_label/value': 'deploy_lma_toolchain',

View File

@ -12,13 +12,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from stacklight_tests.helpers import helpers
from stacklight_tests import settings
name = 'lma_infrastructure_alerting'
version = '0.10.0'
role_name = ['infrastructure_alerting']
vip_name = 'infrastructure_alerting_mgmt_vip'
plugin_path = settings.LMA_INFRA_ALERTING_PLUGIN_PATH
version = helpers.get_plugin_version(plugin_path)
nagios_user = 'nagiosadmin'
nagios_password = 'r00tme'