This change makes the assess_status() method to be deferred until the
end of the hook execution. This is to ensure that the (expensive)
assess_status() functionality is only run once, even though it may be
called multiple times from reactive handlers that need to update the
status on the charm.
This uses the hookenv.atexit() function to queue an function that calls
_assess_status() on the charm singleton after all the reactive handlers
have run. If no handler calls the assess_status() method then the
_assess_status() 'real' method won't be called for that hook invocation.
Change-Id: I5d405446761a646585dfa1c446009e4374c01000
This patchset adds a new method to the OpenStackCharm() class called
'update_api_ports()' which, by default, uses the api_ports static member
of the same class to expose the ports using the Juju 'open_port' and
'close-port' commands. This method will open any ports that aren't
already open and close any ports that shouldn't be open according to the
Juju 'opened-ports' command.
The 'api_ports' static member can be overriden by providing a simple
list (or other iterable) to the method call.
By default, the default 'install' method on the OpenStackCharm() class
now calls update_api_ports() after it has installed the packages. This
is normally what a charm would want to do: install the software, which
usually results in it starting, and then expose its ports. In order to
disable the default behaviour, it is necessary to completely override
the default install() method. This is intentional, as the charm should
normally expose its api_ports.
Also, the update_api_ports() is called from the (new) update_charm()
method which can be accessed using a defaults 'update-charm'. This is
so that ports can be changed when a charm is upgraded.
Change-Id: I4c61179cc6217f4407340a9205619c04b35661a9
Closes-Bug: 1646089
An OpenStack principle charm has an 'openstack-origin' configruation option.
This is used to setup the package source for a charm. If a user updates this
option to point at a package repository then the charm can be configured to
automatically upgrade. This patch adds support for this upgrade scenario.
Change-Id: I3a967b8a8f27e9fd1dd5ab0e5e9e110132308d42
All unit and linting is run pre-commit in OpenStack git/gerrit;
drop travis CI configuration and associate build status message
in README.
Add .gitreview file for OpenStack gerrit.
Change-Id: I4be4e268e2781aafa0caab73cb130f25ef307c50
This provides a summary/description of how to use the charms_openstack
module and the classes therein. In particular it highlights the use of
the key features and how to incorporate them into the derived charm
class.