Fix some bugs with secondary/primary states
This commit is contained in:
parent
6ba831d1bc
commit
bbe03a2fec
|
@ -41,7 +41,7 @@ class RouterInstance():
|
||||||
self.this_router = this_router
|
self.this_router = this_router
|
||||||
self.name = name
|
self.name = name
|
||||||
self.daemon_state = 'stop'
|
self.daemon_state = 'stop'
|
||||||
self.network_state = 'primary'
|
self.network_state = 'secondary'
|
||||||
self.t_router = t_router
|
self.t_router = t_router
|
||||||
self.primary_router_list = []
|
self.primary_router_list = []
|
||||||
self.secondary_router_list = []
|
self.secondary_router_list = []
|
||||||
|
@ -77,6 +77,7 @@ class RouterInstance():
|
||||||
if router.getname() != self.name:
|
if router.getname() != self.name:
|
||||||
router.set_secondary()
|
router.set_secondary()
|
||||||
|
|
||||||
|
|
||||||
# Get value functions
|
# Get value functions
|
||||||
def getname(self):
|
def getname(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -190,6 +191,10 @@ class RouterInstance():
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Try to set ourself primary if there is no primary
|
||||||
|
if not self.primary_router_list:
|
||||||
|
self.set_primary()
|
||||||
|
|
||||||
# Display cluster information to the terminal
|
# Display cluster information to the terminal
|
||||||
ansiiprint.echo('{}Cluster status{}'.format(ansiiprint.purple(), ansiiprint.end()), '', 't')
|
ansiiprint.echo('{}Cluster status{}'.format(ansiiprint.purple(), ansiiprint.end()), '', 't')
|
||||||
ansiiprint.echo('{}Primary router:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.primary_router_list)), '', 'c')
|
ansiiprint.echo('{}Primary router:{} {}'.format(ansiiprint.bold(), ansiiprint.end(), ' '.join(self.primary_router_list)), '', 'c')
|
||||||
|
|
Loading…
Reference in New Issue