Fix packaging issue by devolving it to principal

This patchset fixes the referenced bug by making use a new feature
in the openstack-dashboard charm to allow this plugin to indicate
which packages need installing and which conflict.

The two depends-on are the openstack-dashboard patch to add the
packaging feature and the charm-interface-dashboard-plugin patch
that adds the package details to the reactive interface code.

Also remove disco test and add eoan-train test due to disco EOL.

Depends-On: I962ec558b8dd1f765c6104d5ae61edd41c03affe
Depends-On: Ib3fc0b0525dabf70f45fd050af2ed05ba31129b9
Change-Id: I8582a4cf62749240919d0fe4dd5d72577d288397
Closes-Bug: #1853851
This commit is contained in:
Alex Kavanagh
2020-01-28 14:48:45 +00:00
parent 628804f04d
commit 8110298bb4
7 changed files with 28 additions and 57 deletions

View File

@@ -15,8 +15,6 @@
import charms_openstack.adapters
import charms_openstack.charm
import charmhelpers.fetch as ch_fetch
class OctaviaDashboardCharm(charms_openstack.charm.OpenStackCharm):
release = 'rocky'
@@ -26,15 +24,3 @@ class OctaviaDashboardCharm(charms_openstack.charm.OpenStackCharm):
python_version = 3
adapters_class = charms_openstack.adapters.OpenStackRelationAdapters
required_relations = ['dashboard']
def install(self):
# NOTE(fnordahl) purge_packages is only honoured by charms.openstack
# on OpenStack upgrade, not first install.
installed_purge_packages = list(
set(self.purge_packages) -
set(ch_fetch.filter_installed_packages(self.purge_packages))
)
if installed_purge_packages:
ch_fetch.apt_purge(packages=installed_purge_packages,
fatal=True)
super().install()

View File

@@ -8,7 +8,7 @@ tags:
series:
- bionic
- cosmic
- disco
- eoan
subordinate: true
requires:
dashboard:

View File

@@ -31,6 +31,10 @@ charm.use_defaults(
def dashboard_available():
"""Relation to OpenStack Dashboard principal charm complete.
"""
# config and restart is handled by package install, just update our status
with charm.provide_charm_instance() as octavia_dashboard_charm:
dashboard_relation = reactive.endpoint_from_flag('dashboard.available')
dashboard_relation.publish_plugin_info(
"", None,
conflicting_packages=octavia_dashboard_charm.purge_packages,
install_packages=octavia_dashboard_charm.packages)
octavia_dashboard_charm.assess_status()

View File

@@ -1,4 +1,4 @@
series: disco
series: eoan
relations:
- - mysql:shared-db
- keystone:shared-db
@@ -28,6 +28,8 @@ applications:
keystone:
charm: cs:~openstack-charmers-next/keystone
num_units: 1
options:
openstack-origin: cloud:eoan-train
mysql:
constraints: mem=3072M
charm: cs:~openstack-charmers-next/percona-cluster
@@ -36,18 +38,26 @@ applications:
charm: cs:~openstack-charmers-next/neutron-api
num_units: 1
options:
openstack-origin: cloud:eoan-train
neutron-security-groups: True
neutron-openvswitch:
series: eoan
charm: cs:~openstack-charmers-next/neutron-openvswitch
num_units: 0
octavia:
series: eoan
charm: cs:~openstack-charmers-next/octavia
num_units: 1
options:
openstack-origin: cloud:eoan-train
openstack-dashboard:
series: eoan
charm: cs:~openstack-charmers-next/openstack-dashboard
num_units: 1
options:
openstack-origin: cloud:eoan-train
octavia-dashboard:
series: disco
series: eoan
charm: ../../../octavia-dashboard
rabbitmq-server:
charm: cs:~openstack-charmers-next/rabbitmq-server

View File

@@ -1,11 +1,12 @@
charm_name: octavia-dashboard
gate_bundles:
- bionic-train
- disco-stein
- bionic-stein
- bionic-rocky
smoke_bundles:
- bionic-train
dev_bundles:
- eoan-train
comment: |
Disable ``cosmic-rocky`` bundle pending SRU of ``octavia-dashboard`` package.
target_deploy_status:

View File

@@ -1,38 +0,0 @@
# Copyright 2016 Canonical Ltd
#
# 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.
from __future__ import absolute_import
from __future__ import print_function
import charms_openstack.test_utils as test_utils
import charm.openstack.octavia_dashboard as octavia_dashboard
class TestOctaviaDashboardHandlers(test_utils.PatchHelper):
def test_install(self):
# we do not care about the internals of the function we are overriding
# and expanding so mock out the call to super()
self.patch_object(octavia_dashboard, 'ch_fetch')
self.patch('builtins.super', 'super')
c = octavia_dashboard.OctaviaDashboardCharm()
c.install()
self.ch_fetch.filter_installed_packages.return_value = []
self.ch_fetch.filter_installed_packages.assert_called_with(
c.purge_packages)
self.ch_fetch.apt_purge.assert_called_with(
fatal=True,
packages=c.purge_packages)
self.super.assert_called()

View File

@@ -51,7 +51,15 @@ class TestOctaviaDashboardHandlers(test_utils.PatchHelper):
self.provide_charm_instance().__enter__.return_value = \
self.octavia_dashboard_charm
self.provide_charm_instance().__exit__.return_value = None
self.patch('charms.reactive.endpoint_from_flag')
def test_dashboard_available(self):
mock_flag = mock.Mock()
self.endpoint_from_flag.return_value = mock_flag
self.octavia_dashboard_charm.purge_packages = ['n1']
self.octavia_dashboard_charm.packages = ['p1', 'p2']
handlers.dashboard_available()
self.octavia_dashboard_charm.assess_status.assert_called_once_with()
mock_flag.publish_plugin_info.assert_called_once_with(
"", None, conflicting_packages=['n1'],
install_packages=['p1', 'p2'])