I'm in the home stretch with this cluster tool that I am writing. I've encountered a puzzling problem. I'll try to visualize it for you.

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


In reply to Pass/Fail Counter by Tuna

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.