Tuna has asked for the wisdom of the Perl Monks concerning the following question:
My tool basically does this: Cluster 1 => Host 1 (execute task sequence) Host 2 (execute task sequence) Host 3 (execute task sequence) Host 4 (execute task sequence) Host 5 (execute task sequence) Host 6 (execute task sequence) Host 7 (execute task sequence) Cluster 2 | | | | v Cluster 5
Requirements:
Foreach cluster:
- If less than 2 hosts successfully reload, enter &rollbackSequence.
- If host 7 fails, enter &rollbackSequence.
- IMPORTANT - I need to keep tabs of each host that has been processed; in the event that I need to rollback, I need to know which hosts to rollback!
So, I'm thinking:
my $HostsPerCluster{$clusterNumber} = scalar(@clusterHosts); my $totalClusterHosts = $HostsPerCluster{$clusterNumber} my $failures = 0; my $host_7 = $clusterHosts[-1]; ### this sub is called in a looping statement &do_stuff( $host, $file); if ($totalClusterHosts - $failures < 2) { ### exit this loop and do other stuff } sub do_stuff { my $command = "/bin/true"; &sshExec('SESSION', $command); $? && ++$failures; return $success; }
So, as you can see, I'm a little stuck. I *think* that the above code might work. (can't test b/c our company ssh gateway is down). Additionally, I have no idea how to track each host, in the event that I need to rollback. Nor, do I have any idea how to proceed determining the success or failure of host 7.
I know that I've been somewhat of a leech lately, but I really do try to resolve this stuff myself, before posting here.
TIA, once again
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pass/Fail Counter
by little (Curate) on Aug 19, 2001 at 17:16 UTC |