Implement undercloud install

Change-Id: I7383a278105f76f85f1077e7216345506f094609
This commit is contained in:
Brad P. Crochet 2015-03-17 09:34:29 -04:00
parent 68cf7181b5
commit 26c6730ed7
4 changed files with 59 additions and 7 deletions

View File

@ -0,0 +1,57 @@
# Copyright 2015 Red Hat, 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 sys
from rdomanager_oscplugin.tests import base
from rdomanager_oscplugin.tests import fakes
from rdomanager_oscplugin.tests.v1.test_plugin import TestPluginV1
from rdomanager_oscplugin.v1.plugin import undercloud
# Load the plugin init module for the plugin list and show commands
import rdomanager_oscplugin.plugin
plugin_name = 'rdomanager_oscplugin'
plugin_client = 'rdomanager_oscplugin.plugin'
class FakePluginV1Client(object):
def __init__(self, **kwargs):
self.auth_token = kwargs['token']
self.management_url = kwargs['endpoint']
class TestUndercloudInstall(TestPluginV1):
def setUp(self):
super(TestUndercloudInstall, self).setUp()
self.app.ext_modules = [
sys.modules[plugin_client],
]
# Get the command object to test
self.cmd = plugin.undercloud.InstallPlugin(self.app, None)
@mock.patch('subprocess.call')
def test_undercloud_install(self, mock_subprocess):
arglist = []
verifylist = []
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
# DisplayCommandBase.take_action() returns two tuples
self.cmd.take_action(parsed_args)
mock_subprocess.assert_called_with('instack-install-undercloud')

View File

@ -27,8 +27,6 @@ plugin_client = 'rdomanager_oscplugin.plugin'
class FakePluginV1Client(object):
def __init__(self, **kwargs):
#self.servers = mock.Mock()
#self.servers.resource_class = fakes.FakeResource(None, {})
self.auth_token = kwargs['token']
self.management_url = kwargs['endpoint']
@ -41,7 +39,3 @@ class TestPluginV1(base.TestCommand):
endpoint=fakes.AUTH_URL,
token=fakes.AUTH_TOKEN,
)
# Get a shortcut to the Service Catalog Mock
#self.catalog_mock = self.app.client_manager.identity.service_catalog
#self.catalog_mock.reset_mock()

View File

@ -17,6 +17,7 @@
import logging
import six
import subprocess
import sys
from cliff import command
@ -35,6 +36,6 @@ class InstallPlugin(command.Command):
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
self.log.debug("To be implemented")
subprocess.call("instack-install-undercloud")
return