Ensure build packages installed at runtime
As an alternative to switching this process to ansible, we can handle the installation of the required packages for the overcloud image building process in the command itself. This change adds an install for tripleo-common and the image element packages required to build the overcloud images as part of the `openstack overcloud image build` command itself. Change-Id: I32eb04c81cba0f9688ddf6e40874790f033e84e8
This commit is contained in:
parent
03da56c949
commit
b942e8db03
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
A dnf installation of tripleo-common, tripleo-ironic-python-agent-builder,
|
||||
openstack-tripleo-image-elements, openstack-tripleo-puppet-elements, and
|
||||
xfsprogs has been included as part of the `openstack overcloud image build`
|
||||
command. This allows us to drop these as always required dependencies for
|
||||
tripleoclient.
|
|
@ -31,6 +31,9 @@ class TestOvercloudImageBuild(TestPluginV1):
|
|||
def setUp(self):
|
||||
super(TestOvercloudImageBuild, self).setUp()
|
||||
|
||||
run_cmd = mock.patch('tripleoclient.utils.run_command')
|
||||
self.mock_run_command = run_cmd.start()
|
||||
self.addCleanup(run_cmd.stop)
|
||||
# Get the command object to test
|
||||
self.cmd = overcloud_image.BuildOvercloudImage(self.app, None)
|
||||
|
||||
|
@ -51,6 +54,9 @@ class TestOvercloudImageBuild(TestPluginV1):
|
|||
output_directory='.',
|
||||
skip=True,
|
||||
images=None)
|
||||
cmd = ['sudo', 'dnf', 'install', '-y'] + self.cmd.REQUIRED_PACKAGES
|
||||
self.mock_run_command.assert_called_once_with(
|
||||
cmd, name="Install required packages")
|
||||
|
||||
@mock.patch('tripleo_common.image.build.ImageBuildManager', autospec=True)
|
||||
def test_overcloud_image_build_yaml(self, mock_manager):
|
||||
|
|
|
@ -44,6 +44,13 @@ class BuildOvercloudImage(command.Command):
|
|||
IMAGE_YAML_PATH = "/usr/share/openstack-tripleo-common/image-yaml"
|
||||
DEFAULT_YAML = ['overcloud-images-python3.yaml',
|
||||
'overcloud-images-centos8.yaml']
|
||||
REQUIRED_PACKAGES = [
|
||||
'openstack-tripleo-common',
|
||||
'openstack-ironic-python-agent-builder',
|
||||
'openstack-tripleo-image-elements',
|
||||
'openstack-tripleo-puppet-elements',
|
||||
'xfsprogs'
|
||||
]
|
||||
|
||||
def get_parser(self, prog_name):
|
||||
parser = super(BuildOvercloudImage, self).get_parser(prog_name)
|
||||
|
@ -90,9 +97,17 @@ class BuildOvercloudImage(command.Command):
|
|||
)
|
||||
return parser
|
||||
|
||||
def _ensure_packages_installed(self):
|
||||
cmd = ['sudo', 'dnf', 'install', '-y'] + self.REQUIRED_PACKAGES
|
||||
output = plugin_utils.run_command(cmd,
|
||||
name="Install required packages")
|
||||
self.log.info(output)
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
self.log.debug("take_action(%s)" % parsed_args)
|
||||
|
||||
self._ensure_packages_installed()
|
||||
|
||||
if not parsed_args.config_files:
|
||||
parsed_args.config_files = [os.path.join(self.IMAGE_YAML_PATH, f)
|
||||
for f in self.DEFAULT_YAML]
|
||||
|
|
Loading…
Reference in New Issue