fixed issue causing service configuration loop
This commit is contained in:
parent
fe08481763
commit
964fdd6793
1 changed files with 11 additions and 5 deletions
|
@ -495,6 +495,8 @@ class CoreServices(ConfigurableManager):
|
||||||
session_id = config_data.session
|
session_id = config_data.session
|
||||||
opaque = config_data.opaque
|
opaque = config_data.opaque
|
||||||
|
|
||||||
|
logger.info("configuration request: node(%s) session(%s) opaque(%s)", node_id, session_id, opaque)
|
||||||
|
|
||||||
# send back a list of available services
|
# send back a list of available services
|
||||||
if opaque is None:
|
if opaque is None:
|
||||||
type_flag = ConfigFlags.NONE.value
|
type_flag = ConfigFlags.NONE.value
|
||||||
|
@ -512,29 +514,33 @@ class CoreServices(ConfigurableManager):
|
||||||
else:
|
else:
|
||||||
if node_id is None:
|
if node_id is None:
|
||||||
return None
|
return None
|
||||||
n = self.session.get_object(node_id)
|
node = self.session.get_object(node_id)
|
||||||
if n is None:
|
if node is None:
|
||||||
logger.warn("Request to configure service for unknown node %s", node_id)
|
logger.warn("Request to configure service for unknown node %s", node_id)
|
||||||
return None
|
return None
|
||||||
servicesstring = opaque.split(':')
|
servicesstring = opaque.split(':')
|
||||||
services, unknown = self.servicesfromopaque(opaque, n.objid)
|
services, unknown = self.servicesfromopaque(opaque, node.objid)
|
||||||
for u in unknown:
|
for u in unknown:
|
||||||
logger.warn("Request for unknown service '%s'" % u)
|
logger.warn("Request for unknown service '%s'" % u)
|
||||||
|
|
||||||
if len(services) < 1:
|
if len(services) < 1:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if len(servicesstring) == 3:
|
if len(servicesstring) == 3:
|
||||||
# a file request: e.g. "service:zebra:quagga.conf"
|
# a file request: e.g. "service:zebra:quagga.conf"
|
||||||
file_data = self.getservicefile(services, n, servicesstring[2])
|
file_data = self.getservicefile(services, node, servicesstring[2])
|
||||||
self.session.broadcast_file(file_data)
|
self.session.broadcast_file(file_data)
|
||||||
|
|
||||||
|
# short circuit this request early to avoid returning response below
|
||||||
|
return None
|
||||||
|
|
||||||
# the first service in the list is the one being configured
|
# the first service in the list is the one being configured
|
||||||
svc = services[0]
|
svc = services[0]
|
||||||
# send back:
|
# send back:
|
||||||
# dirs, configs, startindex, startup, shutdown, metadata, config
|
# dirs, configs, startindex, startup, shutdown, metadata, config
|
||||||
type_flag = ConfigFlags.UPDATE.value
|
type_flag = ConfigFlags.UPDATE.value
|
||||||
data_types = tuple(repeat(ConfigDataTypes.STRING.value, len(svc.keys)))
|
data_types = tuple(repeat(ConfigDataTypes.STRING.value, len(svc.keys)))
|
||||||
values = svc.tovaluelist(n, services)
|
values = svc.tovaluelist(node, services)
|
||||||
captions = None
|
captions = None
|
||||||
possible_values = None
|
possible_values = None
|
||||||
groups = None
|
groups = None
|
||||||
|
|
Loading…
Reference in a new issue