sub user { $_[0]->config->user }
sub sudo_user { $_[0]->config->sudo_user }
+#TODO if a connection fails the host will be tried
+#again on the next gather cycle if there is more
+#than one group - the unconnectable host should
+#be removed from the configured host list if this
+#happens because it makes the console output a
+#bit messy
sub gather {
my ($self, @groups) = @_;
log_debug { "Starting to gather results" };
push @waiting, $to_fetch;
}
log_debug { sprintf("There are %i hosts in the waiting list", scalar(@waiting)) };
- for my $wait (@waiting) {
+
+ while(defined(my $wait = shift(@waiting))) {
my ($host, @futures) = @$wait;
my $report;
} split m{::}, $class;
my $fh = $storage->open('>:utf8', $file, mkpath => 1);
my $full_path = $storage->file($file);
- log_trace { "Collecting probe data for '$class' from '$host'" };
- my $data = $gathered->get_probe_data($class);
log_debug { "Generated file name for storage: '$file'; Writing state to '$full_path'" };
print $fh encode_json($gathered->get_probe_data($class));
push @files, $full_path;
unless ($ok) {
log_error { "Rolling back snapshot because of: " . $@ || 'unknown error' };
- $storage->reset;
+ eval { $storage->reset };
+
+ if ($@) {
+ log_error { "Could not roll back snapshot: $@" };
+ }
+
return 0;
}
return 1;