Merge "Revert "Call undercloud install function directly""

This commit is contained in:
Jenkins 2017-06-30 21:47:56 +00:00 committed by Gerrit Code Review
commit 6646b2fc4a
3 changed files with 7 additions and 12 deletions

View File

@ -15,4 +15,3 @@ six>=1.9.0 # MIT
osc-lib>=1.5.1 # Apache-2.0
websocket-client>=0.32.0 # LGPLv2+
tripleo-common>=7.1.0 # Apache-2.0
instack-undercloud>=7.0.0 # Apache-2.0

View File

@ -35,8 +35,8 @@ class TestUndercloudInstall(TestPluginV1):
# Get the command object to test
self.cmd = undercloud.InstallUndercloud(self.app, None)
@mock.patch('instack_undercloud.undercloud.install')
def test_undercloud_install(self, mock_install):
@mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_install(self, mock_subprocess):
arglist = []
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -44,7 +44,7 @@ class TestUndercloudInstall(TestPluginV1):
# DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
mock_install.assert_called_once_with('/usr/share/instack-undercloud')
mock_subprocess.assert_called_with('instack-install-undercloud')
class TestUndercloudUpgrade(TestPluginV1):
@ -54,9 +54,8 @@ class TestUndercloudUpgrade(TestPluginV1):
# Get the command object to test
self.cmd = undercloud.UpgradeUndercloud(self.app, None)
@mock.patch('instack_undercloud.undercloud.install')
@mock.patch('subprocess.check_call', autospec=True)
def test_undercloud_upgrade(self, mock_subprocess, mock_install):
def test_undercloud_upgrade(self, mock_subprocess):
arglist = []
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@ -67,9 +66,8 @@ class TestUndercloudUpgrade(TestPluginV1):
mock_subprocess.assert_has_calls(
[
mock.call(['sudo', 'yum', 'update', '-y']),
mock.call('instack-upgrade-undercloud'),
mock.call(['sudo', 'systemctl', 'restart',
'openstack-nova-api'])
]
)
mock_install.assert_called_once_with('/usr/share/instack-undercloud',
upgrade=True)

View File

@ -18,8 +18,6 @@
import logging
import subprocess
from instack_undercloud import undercloud
from osc_lib.command import command
from tripleoclient import utils
@ -35,7 +33,7 @@ class InstallUndercloud(command.Command):
utils.ensure_run_as_normal_user()
undercloud.install('/usr/share/instack-undercloud')
subprocess.check_call("instack-install-undercloud")
class UpgradeUndercloud(command.Command):
@ -50,7 +48,7 @@ class UpgradeUndercloud(command.Command):
utils.ensure_run_as_normal_user()
subprocess.check_call(['sudo', 'yum', 'update', '-y'])
undercloud.install('/usr/share/instack-undercloud', upgrade=True)
subprocess.check_call("instack-upgrade-undercloud")
# restart nova-api https://bugzilla.redhat.com/show_bug.cgi?id=1315467
subprocess.check_call(['sudo', 'systemctl', 'restart',
'openstack-nova-api'])