Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make nagnet do smart things with the dateranges it is given.

  • Loading branch information...
commit 85cf2c20eb5758a0129653cce51980a89c6cc53a 1 parent cb03a26
Mike Cooper authored
View
6 python/nagcat/nagios_api.py
@@ -525,6 +525,12 @@ def xmlrpc_scheduleDowntime(self, expr, start, stop, user, comment):
raise xmlrpc.Fault(1, "start/stop must be integers")
now = int(time.time())
+
+ if start < now:
+ start = now
+ if end < now:
+ raise xmlrpc.Fault(1, "stop must be in the future")
+
key = base64.urlsafe_b64encode(struct.pack('ib',
now, random.randint(-127,127))).strip('=')
comment += ' key:%s expr:%s' % (key, expr.strip())
View
9 railroad/static/js/configurator.js
@@ -170,20 +170,11 @@ $(document).ready(function() {
var from = $('#downtime-from').datepicker('getDate');
var to = $('#downtime-to').datepicker('getDate');
- var about_now = new Date().add({minutes: 5});
- if (from < about_now) {
- from = about_now;
- }
if (!(from && to)) {
makeDowntimeError("Invalid dates!");
$('#downtimeLoading').remove();
return;
}
- if (to < about_now) {
- makeDowntimeError("Can't schedule downtimes in the past.");
- $('#downtimeLoading').remove();
- return;
- }
// Correct for time zones, since the datetimepicker doesn't store the
// time zone. *glare*

0 comments on commit 85cf2c2

Please sign in to comment.
Something went wrong with that request. Please try again.