Ejemplo n.º 1
0
def etcd_proxy_force_restart(relation_id=None):
    # note(cory.benfield): Mostly etcd does not require active management,
    # but occasionally it does require a full config nuking. This does not
    # play well with the standard neutron-api config management, so we
    # treat etcd like the special snowflake it insists on being.
    CONFIGS.register('/etc/init/etcd.conf', [EtcdContext()])
    CONFIGS.write('/etc/init/etcd.conf')

    if 'etcd-proxy' in CONFIGS.complete_contexts():
        force_etcd_restart()
 def test_force_etcd_restart(self, rmtree):
     self.glob.glob.return_value = [
         '/var/lib/etcd/one', '/var/lib/etcd/two'
     ]
     nutils.force_etcd_restart()
     self.service_stop.assert_called_once_with('etcd')
     self.glob.glob.assert_called_once_with('/var/lib/etcd/*')
     rmtree.assert_any_call('/var/lib/etcd/one')
     rmtree.assert_any_call('/var/lib/etcd/two')
     self.service_start.assert_called_once_with('etcd')
Ejemplo n.º 3
0
def etcd_proxy_force_restart(relation_id=None):
    # note(cory.benfield): Mostly etcd does not require active management,
    # but occasionally it does require a full config nuking. This does not
    # play well with the standard neutron-api config management, so we
    # treat etcd like the special snowflake it insists on being.
    CONFIGS.register('/etc/init/etcd.conf', [EtcdContext()])
    CONFIGS.write('/etc/init/etcd.conf')

    if 'etcd-proxy' in CONFIGS.complete_contexts():
        force_etcd_restart()
 def test_force_etcd_restart(self, rmtree):
     self.glob.glob.return_value = [
         '/var/lib/etcd/one', '/var/lib/etcd/two'
     ]
     nutils.force_etcd_restart()
     self.service_stop.assert_called_once_with('etcd')
     self.glob.glob.assert_called_once_with('/var/lib/etcd/*')
     rmtree.assert_any_call('/var/lib/etcd/one')
     rmtree.assert_any_call('/var/lib/etcd/two')
     self.service_start.assert_called_once_with('etcd')
Ejemplo n.º 5
0
def etcd_proxy_force_restart(relation_id=None):
    # note(cory.benfield): Mostly etcd does not require active management,
    # but occasionally it does require a full config nuking. This does not
    # play well with the standard neutron-api config management, so we
    # treat etcd like the special snowflake it insists on being.
    etcd_context = EtcdContext()
    CONFIGS.register('/etc/init/etcd.conf', [etcd_context])
    CONFIGS.register('/etc/default/etcd', [etcd_context])
    ready_contexts = CONFIGS.complete_contexts()
    log('Ready contexts %s' % ready_contexts)

    if ('etcd-proxy' in ready_contexts):
        log('Force etcd restart')
        CONFIGS.write('/etc/init/etcd.conf')
        CONFIGS.write('/etc/default/etcd')
        force_etcd_restart()