Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-06-16 17:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.