Add option to setup centos master node in get_ready_setup method

1) Need to use fuel-devops >=3.0.0
2) Need to use centos_master.yaml devops template
3) export CENTOS_MASTER=True environment variable
4) provide path to CENTOS_CLOUD_IMAGE_PATH, FUEL_RELEASE_PATH and
EXTRA_DEB_REPOS

Change-Id: I1542c2238abc364713f02e4bca6ec7646883bf78
Closes-Bug: #1592419
This commit is contained in:
Artem Grechanichenko 2016-06-14 12:49:27 +03:00
parent b5049d4306
commit 60246f9cd9
5 changed files with 100 additions and 34 deletions

View File

@ -51,6 +51,11 @@ Fuel Actions
.. automodule:: fuelweb_test.helpers.fuel_actions
:members:
Fuel Release Hacks
------------------
.. automodule:: fuelweb_test.helpers.fuel_release_hacks
:members:
Granular Deployment Checkers
----------------------------
.. automodule:: fuelweb_test.helpers.granular_deployment_checkers

View File

@ -17,14 +17,19 @@
from six.moves import xrange
# pylint: enable=redefined-builtin
from devops.helpers.helpers import wait
from fuelweb_test import logger
from fuelweb_test import settings
from fuelweb_test.helpers.fuel_release_hacks import install_mos_repos
from fuelweb_test.helpers.decorators import create_diagnostic_snapshot
from fuelweb_test.helpers.utils import TimeStat
from fuelweb_test.tests.base_test_case import TestBasic as Basic
from system_test.core.discover import load_yaml
from gates_tests.helpers import exceptions
class Manager(Basic):
"""Manager class for tests."""
@ -189,21 +194,48 @@ class Manager(Basic):
if 'devops_settings' in config['template']:
self._devops_config = config
def get_ready_setup(self):
"""Create virtual environment and install Fuel master node."""
def get_ready_setup(self, centos=settings.CENTOS_MASTER_NODE):
"""Create virtual environment and install Fuel master node.
"""
logger.info("Getting ready setup")
if self.check_run("empty"):
self.env.revert_snapshot("empty")
return True
else:
with TimeStat("setup_environment", is_uniq=True):
self.env.setup_environment()
self.fuel_post_install_actions()
if centos:
""" Need to export CENTOS_CLOUD_IMAGE_PATH,
FUEL_RELEASE_PATH and EXTRA_DEB_REPOS environment variables"""
if not settings.EXTRA_DEB_REPOS:
raise exceptions.FuelQAVariableNotSet(
settings.EXTRA_DEB_REPOS,
"deb mos repo for building cluster")
self.env.make_snapshot("empty", is_make=True)
self.env.resume_environment()
return True
with TimeStat("centos_setup_environment", is_uniq=True):
admin = self.env.d_env.nodes().admin
self.env.d_env.start([admin])
logger.info("Waiting for Centos node to start up")
wait(lambda: admin.driver.node_active(admin), 60)
logger.info("Waiting for Centos node ssh ready")
self.env.wait_for_provisioning()
hostname = ''.join((settings.FUEL_MASTER_HOSTNAME,
settings.DNS_SUFFIX))
install_mos_repos()
self.centos_setup_fuel(hostname)
self.fuel_post_install_actions(
force_ssl=settings.FORCE_HTTPS_MASTER_NODE)
self.env.make_snapshot("empty", is_make=True)
self.env.resume_environment()
return True
else:
with TimeStat("setup_environment", is_uniq=True):
self.env.setup_environment()
self.fuel_post_install_actions()
self.env.make_snapshot("empty", is_make=True)
self.env.resume_environment()
return True
def get_ready_release(self):
"""Make changes in release configuration."""

View File

@ -0,0 +1,52 @@
# Copyright 2016 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
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
from fuelweb_test import logger
from fuelweb_test import settings
from fuelweb_test.helpers.ssh_manager import SSHManager
from gates_tests.helpers import exceptions
def install_mos_repos():
"""
Upload and install fuel-release packet with mos-repo description
and install necessary packets for packetary Fuel installation
:return: nothing
"""
logger.info("upload fuel-release packet")
if not settings.FUEL_RELEASE_PATH:
raise exceptions.FuelQAVariableNotSet('FUEL_RELEASE_PATH', '/path')
try:
ssh = SSHManager()
pack_path = '/tmp/'
full_pack_path = os.path.join(pack_path,
'fuel-release*.noarch.rpm')
ssh.upload_to_remote(
ip=ssh.admin_ip,
source=settings.FUEL_RELEASE_PATH.rstrip('/'),
target=pack_path)
except Exception:
logger.exception("Could not upload package")
raise
logger.debug("setup MOS repositories")
cmd = "rpm -ivh {}".format(full_pack_path)
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
cmd = "yum install -y fuel-setup"
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)

View File

@ -710,3 +710,5 @@ FUEL_RELEASE_PATH = os.environ.get("FUEL_RELEASE_PATH")
S3_API_CLIENT = os.environ.get("S3_API_CLIENT", "s3cmd")
MASTER_NODE_EXTRA_PACKAGES = os.environ.get("MASTER_NODE_EXTRA_PACKAGES", "")
CENTOS_MASTER_NODE = os.environ.get("CENTOS_MASTER")

View File

@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
import time
from proboscis import TestProgram
@ -35,8 +34,6 @@ from fuelweb_test.settings import REPLACE_DEFAULT_REPOS_ONLY_ONCE
from fuelweb_test.settings import SEPARATE_SERVICE_HAPROXY_PLUGIN_PATH
from fuelweb_test.settings import USE_HAPROXY_TEMPLATE
from gates_tests.helpers import exceptions
class TestBasic(object):
"""Basic test case class for all system tests.
@ -272,22 +269,7 @@ class TestBasic(object):
self.fuel_post_install_actions()
def centos_setup_fuel(self, hostname):
logger.info("upload fuel-release packet")
if not settings.FUEL_RELEASE_PATH:
raise exceptions.FuelQAVariableNotSet('FUEL_RELEASE_PATH', '/path')
try:
ssh = SSHManager()
pack_path = '/tmp/'
full_pack_path = os.path.join(pack_path,
'fuel-release*.noarch.rpm')
ssh.upload_to_remote(
ip=ssh.admin_ip,
source=settings.FUEL_RELEASE_PATH.rstrip('/'),
target=pack_path)
except Exception:
logger.exception("Could not upload package")
ssh = SSHManager()
logger.debug("Update host information")
cmd = "echo HOSTNAME={} >> /etc/sysconfig/network".format(hostname)
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
@ -302,13 +284,6 @@ class TestBasic(object):
cmd = "hostname {}".format(hostname)
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
logger.debug("setup MOS repositories")
cmd = "rpm -ivh {}".format(full_pack_path)
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
cmd = "yum install -y fuel-setup"
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)
cmd = "yum install -y screen"
ssh.execute_on_remote(ssh.admin_ip, cmd=cmd)