VMware Aria Automation Orchestrator

 View Only
Expand all | Collapse all

Command Object No Longer Available in Release 8.17

  • 1.  Command Object No Longer Available in Release 8.17

    Posted May 31, 2024 11:36 PM
      |   view attached

    Yesterday I tested some actions and realized that the current VMware Aria Automation Release 8.17.0 no longer contains the Command class.

    The following exception occurs when a method of the Command class is called:

    This method is disabled for security reasons. 'Command' is deprecated and will be removed in future release

    Failed action with the exception that occurs when a method of the Command class is called in VMware Aria Automation 8.17.0
    Unfortunately there is no reference to this in the current release note.
    What a pity, the Command class has served me well. There are no problems with this now, because I already have a replacement. But it would be nice to be prepared for this step and to understand the specific reasons.


    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------


  • 2.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 03, 2024 05:09 AM

    Hello Stefan, what are you using to replace the "command" method ?

    Tks 




  • 3.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 03, 2024 08:55 AM

    Hello @Thelemanu,

    a half year ago I published at my blog an action called executeCommand. The additional options of this approach with the stderr output and a time-out parameter offers significantly better options to handle calls of operating system commands. To use this action it is necessary to set the com.vmware.scripting.javascript.allow-native-object system property in the control center to true or to set the correct entries in the RhinoClassShutter file. This action can replace the Command class.

    Best regards
    Stefan



    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------



  • 4.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 03, 2024 09:21 AM

    Let me retry to post my answer...

    I have created a ZIP package with the binaries and run in a vRO container:

    See https://kuklis.github.io/cma/post/vro8-run-helm/




  • 5.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 04, 2024 09:14 AM

    Great Idea, thank you for sharing.

    👍



    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------



  • 6.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 03, 2024 12:45 PM

    Oh wow... glad I caught this before upgrading to 8.17!  This will definitely break a few critical workflows for me.




  • 7.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 07, 2024 03:26 AM

    The removal of the command object is now documented in the updated release note from yesterday, 2024-06-06.

    That leaves no question unanswered for this case - thank you Broadcom for this clarification.



    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------



  • 8.  RE: Command Object No Longer Available in Release 8.17

    Broadcom Employee
    Posted Jun 10, 2024 09:43 AM

    What did you end up doing to replace it?




  • 9.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 11, 2024 12:26 AM

    Hello @Brandon Saxe,

    I developed an action called executeCommand, which has replaced all Command object usages.

    I replace this

    var command = "ls";
    
    var stdCommand = new Command(command);
    stdCommand.execute(true);
    var output = stdCommand.output;
    System.log(output);

    with this

    var command = "ls";
    
    var output = System.getModule("de.stschnell").executeCommand(command).output;
    System.log(output);

    Best regards
    Stefan



    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------



  • 10.  RE: Command Object No Longer Available in Release 8.17

    Broadcom Employee
    Posted Jun 11, 2024 04:30 AM

    The option in replace of the Command is to have a remote VA to run commands from. You can do that through SSH plugin or GuessOperations from vCenter plugin. The other option is to run a script with Python/Node.js runtimes.




  • 11.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 12, 2024 09:29 AM

    When executing a command like "ping -c 4 10.93.185.10" the process keeps exiting with a code of 1 even though the command executed successfully:

    2024-06-12 09:25:20.185 -04:00ERROR(com.ge.vro.util/executeLocalAndLog_New) Exit value: 1
    2024-06-12 09:25:20.186 -04:00INFO(com.ge.vro.util/executeLocalAndLog_New) PING 10.93.185.10 (10.93.185.10) 56(84) bytes of data. --- 10.93.185.10 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3074ms
    Any idea why your action would cause this? 



  • 12.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 13, 2024 07:41 AM

    I went through this same thing, doing a ping check to see if it's in use before building.  Ping returns an exit code of 1 if the IP does not ping(it's a failure even though the command itself runs).  You will have to account for that special case in your code.  I'm not using his code, but in my own I just do something like this to just return the 1 without throwing a failure:

        if (result.exitCode == 1 && command == "/usr/bin/ping -c 4 ") {
            System.log('Ping test shows IP not in use');
            return result;
        }
    And then in my workflow I call the action I do this: 
       if(result.exitCode == 1) {
            System.log("Address '" + address + "' not used");
        } else {
            throw "Address '" + address + "' is in use";
        }
    hth



  • 13.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 14, 2024 12:13 PM

    Hi,

    BTW, instead of using `/usr/bin/ping` you can give a try to use `System.isHostReachable()`.

    You'll get boolean as return if host is reachable or not :)



    ------------------------------
    If you find the answer helpful, please click on the RECOMMEND button.

    Please visit my blog to get more information: https://www.clouddepth.com
    ------------------------------



  • 14.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 14, 2024 12:15 PM

    Use instead:

    System.isHostReachable(hostname)

    See work with Powershell without PShost | VMware Aria Automation Orchestrator (broadcom.com)




  • 15.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 14, 2024 01:01 PM

    hostname and IP are different and i'm doing both, since a new build I want to make sure the IP that was assigned to that hostname isn't already in use.  We unfortunately use subnets that already have IPs in use outside of infoblox(Migrations), so i can't just rely on that.




  • 16.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 13, 2024 08:51 AM

    Hello @SteskaljGE,

    thanks for your reply. The command does not executed successfully, it delivers "4 packets transmitted, 0 received, 100% packet loss". The difference is here that executeCommand delivers stdout and stderr. The Command object previously only delivered stdout. If you want to have the same behavior as with the Command object, you just have to comment out three lines of code, which adds the error stream to the output variable.

    // while ((line = bufferedProcessErrorStream.readLine()) !== null) {
    //  output += line + "\n";
    // }

    Best regards
    Stefan



    ------------------------------
    More interesting information at blog.stschnell.de
    ------------------------------



  • 17.  RE: Command Object No Longer Available in Release 8.17

    Posted Jun 14, 2024 12:13 PM

    For ping there was another thread already. Looks like ICMP packages are not allowed in the container runtime. See thread:
    work with Powershell without PShost | VMware Aria Automation Orchestrator (broadcom.com)