Merge "Remove Pike-only migration step"

This commit is contained in:
Zuul 2017-10-25 02:54:27 +00:00 committed by Gerrit Code Review
commit 031fa7ea3e
2 changed files with 4 additions and 40 deletions

View File

@ -1154,10 +1154,9 @@ class TestPostConfig(base.BaseTestCase):
@mock.patch('os.listdir')
@mock.patch('instack_undercloud.undercloud._create_mistral_config_'
'environment')
@mock.patch('instack_undercloud.undercloud._migrate_plans')
@mock.patch('instack_undercloud.undercloud._create_default_plan')
def test_post_config_mistral(self, mock_create, mock_migrate, mock_cmce,
mock_listdir, mock_isfile):
def test_post_config_mistral(self, mock_create, mock_cmce, mock_listdir,
mock_isfile):
instack_env = {}
mock_mistral = mock.Mock()
mock_swift = mock.Mock()
@ -1195,19 +1194,15 @@ class TestPostConfig(base.BaseTestCase):
'/bar.yaml')],
mock_mistral.workbooks.create.mock_calls)
mock_cmce.assert_called_once_with(instack_env, mock_mistral)
mock_migrate.assert_called_once_with(mock_mistral, mock_swift,
['hut8'])
mock_create.assert_called_once_with(mock_mistral, ['hut8'])
@mock.patch('os.path.isfile', return_value=True)
@mock.patch('os.listdir')
@mock.patch('instack_undercloud.undercloud._create_mistral_config_'
'environment')
@mock.patch('instack_undercloud.undercloud._migrate_plans')
@mock.patch('instack_undercloud.undercloud._create_default_plan')
def test_post_config_mistral_with_tags(self, mock_create, mock_migrate,
mock_cmce, mock_listdir,
mock_isfile):
def test_post_config_mistral_with_tags(self, mock_create, mock_cmce,
mock_listdir, mock_isfile):
instack_env = {}
mock_mistral = mock.Mock()
mock_swift = mock.Mock()
@ -1244,8 +1239,6 @@ class TestPostConfig(base.BaseTestCase):
'/bar.yaml')],
mock_mistral.workbooks.create.mock_calls)
mock_cmce.assert_called_once_with(instack_env, mock_mistral)
mock_migrate.assert_called_once_with(mock_mistral, mock_swift,
['hut8'])
mock_create.assert_called_once_with(mock_mistral, ['hut8'])

View File

@ -29,14 +29,12 @@ import sys
import tempfile
import time
import uuid
import yaml
from ironicclient import client as ir_client
from keystoneauth1 import session
from keystoneauth1 import exceptions as ks_exceptions
from keystoneclient import discover
import keystoneauth1.identity.generic as ks_auth
from mistralclient.api import base as mistralclient_base
from mistralclient.api import client as mistralclient
from novaclient import client as novaclient
from novaclient import exceptions
@ -1495,32 +1493,6 @@ def _create_mistral_config_environment(instack_env, mistral):
}))
def _migrate_plans(mistral, swift, plans):
"""Migrate plan environments from Mistral to Swift."""
plan_env_filename = 'plan-environment.yaml'
for plan in plans:
headers, objects = swift.get_container(plan)
if headers.get('x-container-meta-usage-tripleo') != 'plan':
continue
try:
swift.get_object(plan, plan_env_filename)
except swiftclient.ClientException:
LOG.info('Migrating environment for plan %s to Swift.' % plan)
try:
env = mistral.environments.get(plan).variables
except (mistralclient_base.APIException,
ks_exceptions.http.NotFound):
LOG.warning('Could not find plan "%s" environment in Mistral '
'- nothing to migrate.' % plan)
else:
yaml_string = yaml.safe_dump(env, default_flow_style=False)
swift.put_object(plan, plan_env_filename, yaml_string)
mistral.environments.delete(plan)
def _wait_for_mistral_execution(timeout_at, mistral, execution, message='',
fail_on_error=False):
while time.time() < timeout_at:
@ -1668,7 +1640,6 @@ def _post_config_mistral(instack_env, mistral, swift):
plans = [container["name"] for container in swift.get_account()[1]]
_create_mistral_config_environment(instack_env, mistral)
_migrate_plans(mistral, swift, plans)
_create_default_plan(mistral, plans)
_create_logging_cron(mistral)