No Coding Required, Unless You Want To Get Groovy

  • Posted on: 1 June 2015
  • By: David La Motta


What cool new thing do we have here today?  Integra 1.1 is getting its final touches, and in anticipation I'd like to share something new that we added to the release: the ability to execute Groovy straight as an Integra action. 

WOOT!

That is right, mis amigos.  We have long maintained Integra's motto of "No Coding Required", and that remains true.  However, having the ability to inject and execute Groovy code dynamically opens the doors to a whole new world of possibilities.  You can keep things as simple as you are used to or you can execute elaborate scripts right from an Integra workflow--the choice is yours.  We have some really great things coming in this release, and this one definitely fits the bill for being one of my favorites.  Lets see some of the things that you can do with this new feature.

Filters

With the new Logic action you can now filter any field of any output of any Integra action.   You can now create interesting conditional statements, manipulate Strings, and as long as the block of code you wrote evaluates to True, the object being inspected will be available to the next workflow action.  The image below shows what a conditional Filter looks like.



That right there is all you need to filter out VMs with a name other than 'dd-wrt'.  If you wanted to do a check based on a number, say, memory, the expression could be:



The {parent.child} nomenclature tells Integra to replace those values at runtime before the script is executed.  This means that anything that gets piped into the new Logic action can get extracted and / or inspected.  You have full access to all of the inputs piped in, and you can use them to build conditionals, evaluate expressions and even alter values as you will see below.

GoTo

Let Integra's GoTo be your friend.  If your initial knee-jerk reaction is "spaghetti code", fear not because this is not what you think it is.  Basically, we are giving you the ability to skip ahead workflow steps.  For the non-programmers out there, we have your back.  Always remember Integra's other motto:  Simple.  We are bending backwards to make things as simple as possible for you, yet give you as much control and power as you deserve. 

Take a look at this GoTo operation.



I couldn't make this stuff up even if I tried.  That's it!  During workflow execution and after this step is run, the next step to be executed will be step 3.  Granted, this is the absolute most simple example for a GoTo.  Just like we employed conditionals in the filter example, you can start getting really creative when it comes to GoTo operations.  As long as the expression evaluates to a number, it will be used as the next step in the workflow.

Advanced

Now that we have the ability to interact with objects piped into this new action via the {parent.child} construct, let me share how we can actually write values back from Groovy straight into your Integra execution stream.  Pictures are always worth a thousand words, so take a look below.  We are going to look for a VM named 'dd-wrt' and when we find it, we are going to increase its memory by 5000 MB.  It should be noted that this manipulation is strictly in-memory; if you wanted to add 5000 MB to that VM you could pipe the outputs of this action into the Reconfigure VM action.  Problem solved.



Of course, Advanced means you are free to do anything you'd like in that block of code.  You can throw an Exception at runtime to stop a workflow in its tracks, like so:



Is REST the only thing your datacenter vendor has to offer for operating on its platform?  Well, now you have a very simple way of doing REST requests without having to come up for air every 2 minutes.  You can manipulate the result (JSON, XML, etc) straight from your Groovy script, or you can pass that on to another action, or you can simply do nothing.  The point is that your IT katana just got 10 times more deadly and we hope that you use it to solve your worst automation bottlenecks.



Conclusion

Executing arbitrary Groovy code directly from an Integra action is a wild, wild thing.  There is absolutely nothing stopping you from crafting the craziest of operations at this point.  And this is just the beginning.  You have access to the Microsoft world via PowerShell with Integra's PS Provider, you can now execute any Groovy you'd like and manipulate input piped in as you see fit, you have remote access to other systems via SSH, and you can also execute local commands at the operating system level with our Execute Command action.  What does this mean?

You have it all.  You have full range of control over the things you can do with Integra.  There is no other tool in the market today that gives you what Integra does, simple like that.

If you have seen my examples in this blog series, you know that I think Groovy is awesome.  But we are not here to cram Groovy down your throat.  To the contrary, we expect to have support for Ruby, Python and Javascript so if you prefer one of those languages over Groovy, drop us a line and let us know which language you'd like to see supported in Integra next.

The GA date for 1.1 is getting closer.  Watch this space for news and announcements.  Until then...

Happy Groovying!

--