def cluster_joined():
    install_ceilometer_ocf()

    # If this node is the elected leader then share our secret with other nodes
    if is_elected_leader('grp_ceilometer_vips'):
        peer_store('shared_secret', get_shared_secret())

    CONFIGS.write_all()
def cluster_changed():
    shared_secret = peer_retrieve('shared_secret')
    if shared_secret is None or shared_secret.strip() == '':
        log('waiting for shared secret to be provided by leader')
    elif not shared_secret == get_shared_secret():
        set_shared_secret(shared_secret)

    CONFIGS.write_all()
def cluster_changed():
    shared_secret = peer_retrieve('shared_secret')
    if shared_secret is None or shared_secret.strip() == '':
        log('waiting for shared secret to be provided by leader')
    elif not shared_secret == get_shared_secret():
        set_shared_secret(shared_secret)

    CONFIGS.write_all()
    def __call__(self):
        # Lazy-import to avoid a circular dependency in the imports
        from ceilometer_utils import get_shared_secret

        ctxt = {
            'api_workers': config('api-workers'),
            'port': CEILOMETER_PORT,
            'metering_secret': get_shared_secret()
        }
        return ctxt
Beispiel #5
0
    def __call__(self):
        # Lazy-import to avoid a circular dependency in the imports
        from ceilometer_utils import get_shared_secret

        # Make sure to cast the time-to-live events to integer values.
        # For large enough numbers, Juju returns the value in scientific
        # notation which causes python to treat the number as a float
        # value, which in turn causes ceilometer to fail to start.
        # See LP#1651645 for more details.
        ctxt = {
            'port': CEILOMETER_PORT,
            'metering_secret': get_shared_secret(),
            'metering_time_to_live': int(config('metering-time-to-live')),
            'event_time_to_live': int(config('event-time-to-live')),
        }
        return ctxt
    def __call__(self):
        # Lazy-import to avoid a circular dependency in the imports
        from ceilometer_utils import get_shared_secret

        # Make sure to cast the time-to-live events to integer values.
        # For large enough numbers, Juju returns the value in scientific
        # notation which causes python to treat the number as a float
        # value, which in turn causes ceilometer to fail to start.
        # See LP#1651645 for more details.
        ctxt = {
            'port': CEILOMETER_PORT,
            'metering_secret': get_shared_secret(),
            'metering_time_to_live': int(config('metering-time-to-live')),
            'event_time_to_live': int(config('event-time-to-live')),
            'polling_interval': int(config('polling-interval')),
            'enable_all_pollsters': config('enable-all-pollsters'),
        }
        return ctxt
def cluster_joined(relation_id=None):
    # If this node is the elected leader then share our secret with other nodes
    if is_elected_leader('grp_ceilometer_vips'):
        peer_store('shared_secret', get_shared_secret())

    CONFIGS.write_all()

    settings = {}

    for addr_type in ADDRESS_TYPES:
        address = get_relation_ip(addr_type,
                                  cidr_network=config(
                                      'os-{}-network'.format(addr_type)))
        if address:
            settings['{}-address'.format(addr_type)] = address

    settings['private-address'] = get_relation_ip('cluster')

    relation_set(relation_id=relation_id, relation_settings=settings)
Beispiel #8
0
 def test_get_shared_secret_new(self, exists, uuid4):
     exists.return_value = False
     uuid4.return_value = 'newsecret'
     with patch('__builtin__.open'):
         self.assertEqual(utils.get_shared_secret(), 'newsecret')
Beispiel #9
0
 def test_get_shared_secret_existing(self, exists):
     exists.return_value = True
     with mock_open(utils.SHARED_SECRET, u'mysecret'):
         self.assertEqual(utils.get_shared_secret(), 'mysecret')
 def test_get_shared_secret_new(self, exists, uuid4):
     exists.return_value = False
     uuid4.return_value = 'newsecret'
     with patch('__builtin__.open'):
         self.assertEquals(utils.get_shared_secret(),
                           'newsecret')
 def test_get_shared_secret_existing(self, exists):
     exists.return_value = True
     with mock_open(utils.SHARED_SECRET, u'mysecret'):
         self.assertEquals(utils.get_shared_secret(),
                           'mysecret')