~hopem/charms/trusty/nova-cloud-controller/lp1519035

« back to all changes in this revision

Viewing changes to tests/charmhelpers/contrib/openstack/amulet/utils.py

  • Committer: Corey Bryant
  • Date: 2016-01-04 21:29:34 UTC
  • Revision ID: corey.bryant@canonical.com-20160104212934-cfxuxvx1fq1jmage
[corey.bryant,r=trivial] Sync charm-helpers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import json
19
19
import logging
20
20
import os
 
21
import re
21
22
import six
22
23
import time
23
24
import urllib
604
605
                           '{}'.format(sample_type, samples))
605
606
            return None
606
607
 
607
 
# rabbitmq/amqp specific helpers:
 
608
    # rabbitmq/amqp specific helpers:
 
609
 
 
610
    def rmq_wait_for_cluster(self, deployment, init_sleep=15, timeout=1200):
 
611
        """Wait for rmq units extended status to show cluster readiness,
 
612
        after an optional initial sleep period.  Initial sleep is likely
 
613
        necessary to be effective following a config change, as status
 
614
        message may not instantly update to non-ready."""
 
615
 
 
616
        if init_sleep:
 
617
            time.sleep(init_sleep)
 
618
 
 
619
        message = re.compile('^Unit is ready and clustered$')
 
620
        deployment._auto_wait_for_status(message=message,
 
621
                                         timeout=timeout,
 
622
                                         include_only=['rabbitmq-server'])
 
623
 
608
624
    def add_rmq_test_user(self, sentry_units,
609
625
                          username="testuser1", password="changeme"):
610
626
        """Add a test user via the first rmq juju unit, check connection as
805
821
        if port:
806
822
            config['ssl_port'] = port
807
823
 
808
 
        deployment.configure('rabbitmq-server', config)
 
824
        deployment.d.configure('rabbitmq-server', config)
 
825
 
 
826
        # Wait for unit status
 
827
        self.rmq_wait_for_cluster(deployment)
809
828
 
810
829
        # Confirm
811
830
        tries = 0
832
851
 
833
852
        # Disable RMQ SSL
834
853
        config = {'ssl': 'off'}
835
 
        deployment.configure('rabbitmq-server', config)
 
854
        deployment.d.configure('rabbitmq-server', config)
 
855
 
 
856
        # Wait for unit status
 
857
        self.rmq_wait_for_cluster(deployment)
836
858
 
837
859
        # Confirm
838
860
        tries = 0