def test_restart_nonce_changed_changed(self):
     _db_data = {'restart_nonce': 'foobar'}
     mock_db = MagicMock()
     mock_db.get.side_effect = lambda key: _db_data.get(key)
     self.unitdata.kv.return_value = mock_db
     self.assertTrue(utils.restart_nonce_changed('soofar'))
     mock_db.set.assert_called_once_with('restart_nonce', 'soofar')
     mock_db.flush.assert_called_once_with()
 def test_restart_nonce_changed_existing(self):
     _db_data = {'restart_nonce': 'foobar'}
     mock_db = MagicMock()
     mock_db.get.side_effect = lambda key: _db_data.get(key)
     self.unitdata.kv.return_value = mock_db
     self.assertFalse(utils.restart_nonce_changed('foobar'))
     mock_db.set.assert_not_called()
     mock_db.flush.assert_not_called()
 def test_restart_nonce_changed_new(self):
     _db_data = {}
     mock_db = MagicMock()
     mock_db.get.side_effect = lambda key: _db_data.get(key)
     self.unitdata.kv.return_value = mock_db
     self.assertTrue(utils.restart_nonce_changed('foobar'))
     mock_db.set.assert_called_once_with('restart_nonce',
                                         'foobar')
     mock_db.flush.assert_called_once_with()
Ejemplo n.º 4
0
def leader_settings_changed():
    # NOTE: leader unit will only ever set leader storage
    #       data when multi-site realm, zonegroup, zone or user
    #       data has been created/changed - trigger restarts
    #       of rgw services.
    if restart_nonce_changed(leader_get('restart_nonce')):
        service_restart(service_name())
    if not is_leader():
        for r_id in relation_ids('master'):
            master_relation_joined(r_id)
 def test_restart_nonce_changed_existing(self):
     _db_data = {
         'restart_nonce': 'foobar'
     }
     mock_db = MagicMock()
     mock_db.get.side_effect = lambda key: _db_data.get(key)
     self.unitdata.kv.return_value = mock_db
     self.assertFalse(utils.restart_nonce_changed('foobar'))
     mock_db.set.assert_not_called()
     mock_db.flush.assert_not_called()
Ejemplo n.º 6
0
def leader_settings_changed():
    # NOTE: leader unit will only ever set leader storage
    #       data when multi-site realm, zonegroup, zone or user
    #       data has been created/changed - trigger restarts
    #       of rgw services.
    if restart_nonce_changed(leader_get('restart_nonce')):
        service_restart(service_name())
    if not is_leader():
        for r_id in relation_ids('master'):
            master_relation_joined(r_id)