Six Million Ways To…
  • About
Orchestrator

vRO: Setting constants for workflows

by Axel March 15, 2019 No Comments

Hi guys,

This new post aims at describing one of my favourites stuff about vRO : The use of constants that I can call in all my workflows.

Just imagine that you defined some variables (like a folder to store log files, result files etc…) in several workflows and you have to change them. What a pity, you have to remind all the workflows that you set those variables in 🙁

Even if you know all your workflows, you won’t be motivated by the idea of modifying them, one by one

Constants are the solution 🙂

So let’s go

Let’s say that you want to run serveral statistics workflows and want to save the results into specifics files in a particular folder.

This folder must be unique and the files must be easy to identifty.

What I suggest is to create a set of constants for this specific need.

How ? By creating a configuration element, as described below :

  • Open your vRO client
  • Switch to the Design view
  • Right-click to create a folder to store your constants
  • Another right-click on your new folder to create, this time, an element
  • Name it, for example, LogFoldersAndFiles
  • In the “Attributes” tab, you create one or a set of variables (understand constants) :
    • An attribute logFolderPath, as value, give it the path of the folder you will save your files in
    • An attribute RequestsStatisticsLogFileName, as value, enter the name of a log file that will be used to store your statistics
    • etc…

At this step, you’ve just saved a set of constants. Let’see how to use them in a workflow.

  • Create a new workflow
  • Create a new attribute :
    • Name : hmmm… loggingProperties
    • Type : ConfigurationElement
    • Value : Click on “Not set” to define it and look for the name of the configurationElement
      LogFoldersAndFiles
  • Create a scriptable task
  • Edit it and :
    • Add as input variable your attribute loggingProperties
    • Write the following code and run you workflow 🙂
var vroFolderPath = LogFoldersAndFiles.getAttributeWithKey("logFolderPath").value
var logFileName = LogFoldersAndFiles.getAttributeWithKey("RequestsStatisticsLogFileName").value

System.log("Your folder: " + vroFolderPath)
System.log("Your file: " + logFileName )

That’s it. In a next post, we’ll see how to work with files 🙂

VRO

  • Previous VM : Quickly delete one or more VM3 years ago
  • Next vRA : API : Submit a request3 years ago

Leave a Reply Cancel reply

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

Menu

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Recent Posts

  • vRA : API : Submit a request
  • vRO: Setting constants for workflows
  • VM : Quickly delete one or more VM
  • vRO: Using vRA REST API to get all vCAC VMs
  • vRO : Workflow to Get Restarted VMs by HA

Archives

  • October 2019
  • March 2019
  • March 2018
  • September 2017

Categories

  • CLI (2)
  • ESXi (1)
  • Orchestrator (4)
  • Scripts (3)
    • Powercli (3)
  • vRA (2)
  • vSphere (1)

Tags

API (1) CLI (1) HA (1) Nutanix (1) PowerCLI (1) Reminder (1) REST (1) REST API (1) vCenter (3) VRA (2) VRO (3) vSphere (4)
2022 Six Million Ways To…. Donna Theme powered by WordPress