Upgrade Openstack release if available
If there is a new release of the aodh packages available due to the user changing the 'openstack-origin' option then upgrade the packages. Change-Id: Ib3add07c19768a88ec074e0e485e7b77f7a2f87d Closes-Bug: 1632760
This commit is contained in:
parent
2eab39672c
commit
7d4d259117
@ -12,6 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
import os
|
||||
import subprocess
|
||||
|
||||
@ -95,6 +96,15 @@ class AodhCharm(charms_openstack.charm.HAOpenStackCharm):
|
||||
# NOTE: review this seems odd as not doing anything off piste here
|
||||
adapters_class = AodhAdapters
|
||||
|
||||
release_pkg = 'aodh-common'
|
||||
package_codenames = {
|
||||
'aodh-common': collections.OrderedDict([
|
||||
('2', 'mitaka'),
|
||||
('3', 'newton'),
|
||||
('4', 'ocata'),
|
||||
]),
|
||||
}
|
||||
|
||||
def __init__(self, release=None, **kwargs):
|
||||
"""Custom initialiser for class
|
||||
If no release is passed, then the charm determines the release from the
|
||||
@ -171,6 +181,15 @@ def configure_ssl():
|
||||
AodhCharm.singleton.configure_ssl()
|
||||
|
||||
|
||||
def upgrade_if_available(interfaces_list):
|
||||
"""Just call the AodhCharm.singleton.upgrade_if_available() command to
|
||||
update OpenStack package if upgrade is available
|
||||
|
||||
@returns: None
|
||||
"""
|
||||
AodhCharm.singleton.upgrade_if_available(interfaces_list)
|
||||
|
||||
|
||||
# TODO: drop once charm switches to apache+mod_wsgi
|
||||
def reload_and_restart():
|
||||
"""Reload systemd and restart aodh-api when override file changes
|
||||
|
@ -71,6 +71,7 @@ def render(*args):
|
||||
@reactive.when_not('cluster.available')
|
||||
@reactive.when(*MINIMAL_INTERFACES)
|
||||
def render_unclustered(*args):
|
||||
aodh.upgrade_if_available(args)
|
||||
aodh.configure_ssl()
|
||||
render(*args)
|
||||
|
||||
@ -79,6 +80,7 @@ def render_unclustered(*args):
|
||||
@reactive.when('cluster.available',
|
||||
*MINIMAL_INTERFACES)
|
||||
def render_clustered(*args):
|
||||
aodh.upgrade_if_available(args)
|
||||
render(*args)
|
||||
|
||||
|
||||
|
@ -168,7 +168,9 @@ class TestAodhHandlers(unittest.TestCase):
|
||||
self.patch(handlers.aodh, 'render_configs')
|
||||
self.patch(handlers.aodh, 'assess_status')
|
||||
self.patch(handlers.aodh, 'configure_ssl')
|
||||
self.patch(handlers.aodh, 'upgrade_if_available')
|
||||
handlers.render_unclustered('arg1', 'arg2')
|
||||
self.render_configs.assert_called_once_with(('arg1', 'arg2', ))
|
||||
self.assess_status.assert_called_once()
|
||||
self.configure_ssl.assert_called_once()
|
||||
self.upgrade_if_available.assert_called_once_with(('arg1', 'arg2', ))
|
||||
|
Loading…
x
Reference in New Issue
Block a user