Apache Whirr (retired)
  1. Apache Whirr (retired)
  2. WHIRR-173

Add ClusterAction for generic script execution

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.5.0
    • Component/s: None
    • Labels:
      None

      Description

      The usecase is that once a cluster is launched, it is useful to be able to execute named scripts against predicate-matched nodes in the cluster.

      Tom indicated that this Action is likely to look almost exactly like ConfigureClusterAction: in fact, it may just be renaming ConfigureClusterAction.

      1. WHIRR-173.patch
        7 kB
        Andrei Savu
      2. WHIRR-173.patch
        15 kB
        Andrei Savu

        Issue Links

          Activity

          Hide
          Adrian Cole (Inactive) added a comment -

          this should be quite easy to implement, with the only concern being what to do with the aggregated shell script responses. currently, jclouds' ComputeService.runScriptOnNodesMatching() function returns a Map<? extends NodeMetadata, ExecResponse> where the exec response may have an unsuccessful error code inside.

          Show
          Adrian Cole (Inactive) added a comment - this should be quite easy to implement, with the only concern being what to do with the aggregated shell script responses. currently, jclouds' ComputeService.runScriptOnNodesMatching() function returns a Map<? extends NodeMetadata, ExecResponse> where the exec response may have an unsuccessful error code inside.
          Hide
          Adrian Cole (Inactive) added a comment -

          I have a compute example called exec for this. you may want to add a flag as to whether the command is long-running or not. For example, executing "uptime" doesn't need to be run init style, so you'd want to set wrapInInitScript(false).

          https://github.com/jclouds/jclouds-examples/blob/master/compute-basics/src/main/java/org/jclouds/examples/compute/basics/MainApp.java

          Show
          Adrian Cole (Inactive) added a comment - I have a compute example called exec for this. you may want to add a flag as to whether the command is long-running or not. For example, executing "uptime" doesn't need to be run init style, so you'd want to set wrapInInitScript(false). https://github.com/jclouds/jclouds-examples/blob/master/compute-basics/src/main/java/org/jclouds/examples/compute/basics/MainApp.java
          Hide
          Andrei Savu added a comment -

          A bit ugly but working patch. I will refactor the code soon. Let me know what you think.

          The code is only tested on AWS but it should work anywhere thanks to jclouds.

          Show
          Andrei Savu added a comment - A bit ugly but working patch. I will refactor the code soon. Let me know what you think. The code is only tested on AWS but it should work anywhere thanks to jclouds.
          Hide
          Andrei Savu added a comment -

          I believe that for now it's safe to assume that all scripts executed with this command are short-running.

          Show
          Andrei Savu added a comment - I believe that for now it's safe to assume that all scripts executed with this command are short-running.
          Hide
          Tom White added a comment -

          Looks good. Needs a unit test like the other commands. Should we print out stdout and stderr, regardless of exit code?

          Nit: Rather than saying "script.sh" in the usage string say "<script>" so it's less literal.

          Show
          Tom White added a comment - Looks good. Needs a unit test like the other commands. Should we print out stdout and stderr, regardless of exit code? Nit: Rather than saying "script.sh" in the usage string say "<script>" so it's less literal.
          Hide
          Andrei Savu added a comment -

          I've updated the patch and added some tests. I'm moving to WHIRR-246.

          Show
          Andrei Savu added a comment - I've updated the patch and added some tests. I'm moving to WHIRR-246 .
          Hide
          Andrei Savu added a comment -

          Good to go in?

          Show
          Andrei Savu added a comment - Good to go in?
          Hide
          Tom White added a comment -

          Sorry, missed the update. +1

          Show
          Tom White added a comment - Sorry, missed the update. +1
          Hide
          Andrei Savu added a comment -

          I've just committed this.

          Show
          Andrei Savu added a comment - I've just committed this.

            People

            • Assignee:
              Andrei Savu
              Reporter:
              Stu Hood
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development