Quantcast
Channel: VMware Communities : Discussion List - vRealize Orchestrator
Viewing all articles
Browse latest Browse all 6251

do I use the right methode of using configuration elements as this way doing a search does not tell me which workflow uses them

$
0
0

I am using configurations elements to help me to facilitate searches during VM Deployment

but in the way I use it. If I do a search of elements using thoses configuration elements "find elements that use this element" I have no answer

I am affraid that after a while it will be complicated to update thoses elements as I will not be able to find the workflows using them

here is the way I use those elements perhaps the wrong way

the workflow works this way but I want to be sure I use the right methode to use the configuration elements

 

under the configuration elements category  "createVM/vcenter" I have 2 elements with attributes as showed bellow

 

 

vcenter1    name              type                          value    env               string                          prod    disktype          string                         thin    elementref        vc:sdkconnection               https://xxxxxxxxx    reseau            array/string                   standard,dmz    typeinfra         array/string                   preprod,prod,integration, ...

 

in my workflow I use an attribute and 2 inputs

 

 

attribute name           type                          value listevcenters  configurationelementcategory  createVM/vcenter inputs name        type     value reseau      string   dmz typeinfra   string   prod

 

 

here is the code in the workflow

 

function Contient(valeur, contenant)
{  if (contenant instanceof Array) {  //System.log('value is Array!');  return (contenant.indexOf(valeur) > -1);  } else {  //System.log('Not an array');  return (contenant === valeur);  }
}


var returnReseau = new Array;
var returntypeInfra = new Array;
var elements = listevCenters.configurationElements;
for each (element in elements){
  //System.log(element.name);  if (Contient(reseau,element.getAttributeWithKey("reseau").value)){  returnReseau.push(element.getAttributeWithKey("elementRef").value);  }  if (Contient(typeInfra,element.getAttributeWithKey("typeInfra").value)){  returntypeInfra.push(element.getAttributeWithKey("elementRef").value);  }
}


if(returnReseau.length == 1){
  vcenter = returnReseau[0];  }
else if (returntypeInfra.length == 1) {  vcenter = returntypeInfra[0];  }
else {throw "Trop de choix dans le vCenter"}
System.log(typeInfra +" " + reseau +" " +vcenter.name.split("/")[2])

Viewing all articles
Browse latest Browse all 6251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>