2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 19:40:12 +00:00

Make missing NTP server return 404

Before it was returning 500 because of index out of range
if a client was pulling an index unconditionally.
This commit is contained in:
Jarrod Johnson 2016-08-08 09:11:59 -04:00
parent 05e642ada5
commit 1085e342fd

View File

@ -852,7 +852,12 @@ class IpmiHandler(object):
else:
idx = int(self.element[-1]) - 1
servers = self.ipmicmd.get_ntp_servers()
self.output.put(msg.NTPServer(self.node, servers[idx]))
if len(servers) > idx:
self.output.put(msg.NTPServer(self.node, servers[idx]))
else:
self.output.put(
msg.ConfluentTargetNotFound(
self.node, 'Requested NTP configuration not found'))
return
elif self.op in ('update', 'create'):
if self.element[-1] == 'all':