14
14
# You should have received a copy of the GNU Lesser General Public License
15
15
# along with charm-helpers. If not, see <http://www.gnu.org/licenses/>.
18
19
from collections import OrderedDict
19
20
from charmhelpers.contrib.amulet.deployment import (
114
115
for service, config in six.iteritems(configs):
115
116
self.d.configure(service, config)
118
def _auto_wait_for_status(self, message=None, exclude_services=None,
120
"""Wait for all units to have a specific extended status, except
121
for any defined as excluded. Unless specified via message, any
122
status containing any case of 'ready' will be considered a match.
124
Examples of message usage:
126
Wait for all unit status to CONTAIN any case of 'ready' or 'ok':
127
message = re.compile('.*ready.*|.*ok.*', re.IGNORECASE)
129
Wait for all units to reach this status (exact match):
130
message = 'Unit is ready'
132
Wait for all units to reach any one of these (exact match):
133
message = re.compile('Unit is ready|OK|Ready')
135
Wait for at least one unit to reach this status (exact match):
138
See Amulet's sentry.wait_for_messages() for message usage detail.
139
https://github.com/juju/amulet/blob/master/amulet/sentry.py
141
:param message: Expected status match
142
:param exclude_services: List of juju service names to ignore
143
:param timeout: Maximum time in seconds to wait for status match
144
:returns: None. Raises if timeout is hit.
148
message = re.compile('.*ready.*', re.IGNORECASE)
150
if not exclude_services:
151
exclude_services = []
153
services = list(set(self.d.services.keys()) - set(exclude_services))
154
service_messages = {service: message for service in services}
155
self.d.sentry.wait_for_messages(service_messages, timeout=timeout)
117
157
def _get_openstack_release(self):
118
158
"""Get openstack release.