Permalink
Browse files

Reload support

  • Loading branch information...
1 parent fb1491a commit acd9d1a35caf72f0f01960c604d477a11908efc7 @miquelruiz committed Jan 12, 2012
Showing with 50 additions and 0 deletions.
  1. +25 −0 lib/Opsview/REST.pm
  2. +25 −0 t/04-reload.t
View
@@ -80,6 +80,17 @@ sub delete_downtime {
return $self->delete($self->_downtime(@_));
}
+# Reload
+sub reload {
+ my $self = shift;
+ return $self->post('/reload');
+}
+
+sub reload_info {
+ my $self = shift;
+ return $self->get('/reload');
+}
+
__PACKAGE__->meta->make_immutable;
1;
@@ -170,6 +181,20 @@ Downtime related methods.
More info: L<http://docs.opsview.com/doku.php?id=opsview-community:restapi:downtimes>
+=head2 reload
+
+Initiates a synchronous reload. Be careful: if your opsview reload takes more
+than 60 seconds to run, this call will time out. The returned data contains
+the info of the reload.
+
+More info: L<http://docs.opsview.com/doku.php?id=opsview-community:restapi#initiating_an_opsview_reload>
+
+=head2 reload_info
+
+Get status of reload.
+
+More info: L<http://docs.opsview.com/doku.php?id=opsview-community:restapi#initiating_an_opsview_reload>
+
=head1 SEE ALSO
=over 4
View
@@ -0,0 +1,25 @@
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Opsview::REST::TestUtils;
+
+use Test::More tests => 4;
+
+SKIP: {
+ skip 'No $ENV{OPSVIEW_REST_TEST} defined', 4
+ if (not defined $ENV{OPSVIEW_REST_TEST});
+
+ my $ops = get_opsview();
+
+ my $info = $ops->reload_info();
+ is($info->{server_status}, 0, 'Server running');
+ is($info->{configuration_status}, 'uptodate', 'Conf. up to date');
+
+ $info = $ops->reload();
+ is($info->{server_status}, 0, 'Server reloaded');
+ is($info->{configuration_status}, 'uptodate', 'Conf. up to date');
+};
+

0 comments on commit acd9d1a

Please sign in to comment.