The Arrival. stackstorm-hpecfm

Sub title: Stackstorm actions….how do I?
Github repository

TL;DR
Since the last time we spoke we have successfully released the stackstorm pack on HPE’s external github. Funny, I thought there would be cake involved. We have had an issue submitted and worked through a couple pull requests. We’re using github to truly collaborate. I just wanted to share something interesting and valuable for you seekers just starting out. Actions and how to authorize them.


Stackstorm actions can use API calls to get information from a remote system. The first question I had was how do these actions authenticate to the host? Have you ever heard the old saying, “A little knowledge is a dangerous thing”? Well, it’s true. I had been reading the documentation up to the part I learned about st2’s datastore. The light bulb went off and I thought, “Why not just add the username and password in the st2kv.system and pass them as variables to the action (see previous post)? After running the action manually, everything worked as designed.


So I asked this question on the stackstorm-community slack channel (highly recommended) and was pointed to how Fortinet, and just about every other vendor, created their own st2 “base” action. It is a python class that gets called by every action. The idea is to only have to write the authentication once. Have I mentioned I’m learning a lot lately?
Let’s have a look at the action I worte: action.py

We start by importing the python binding for the HPE Composable Fabric Controller, followed by the base action from stackstorm. We create a python class that will become our own base action. During initialization, we look for a file with configuration parameters and we use variables defined in that file to get a token.
Let’s take a look at the YAML files.
yourpackname.yaml.example

This is just an example for the st2 user. It demonstrates what information is required for the action. The config file is the config.schema.yaml and it looks like this:

Leave a Reply

Your email address will not be published. Required fields are marked *