Hello,
I have a weird situation where I am passing a variable into a module that is not getting interpreted correctly. When the variable is passed into the module, I receive an error. When the variable is embedded into the module, works as expected.
Orchestrator 7.0.1.17606 build 3571217
Code:
//var re = /(([^\-]*)\-(\d{2})(\d{2})(\d{2})(.)\-(GE|SR))/; var re = datastoreFilterRegEx; System.debug("DEBUG_LOG_Module=FindDatastore: var re= " + re); var m; var targetDatastore = []; var len = datastores.length; for (i = 0; i < len; i++) { var str = datastores[i].name; //Debug if (debugOutput == true) { System.debug("DEBUG_LOG_Module=FindDatastore: var str = " + str); } if ((m = re.exec(str)) !== null) { //Debug if (debugOutput == true) { System.debug("DEBUG_LOG_Module=FindDatastore: var m = " + m); } var volumeName = m[0]; var sanName = m[2]; var arrayType = m[3]; var diskType = m[4]; var diskRaid = m[5]; var volumeUse = m[6]; var volumeAccess = m[7]; //Debug if (debugOutput == true) { System.debug("DEBUG_LOG_Module=FindDatastore: volumeName: " + volumeName); System.debug("DEBUG_LOG_Module=FindDatastore: sanName: " + sanName); System.debug("DEBUG_LOG_Module=FindDatastore: arrayType: " + arrayType); System.debug("DEBUG_LOG_Module=FindDatastore: diskType: " + diskType); System.debug("DEBUG_LOG_Module=FindDatastore: diskRaid: " + diskRaid); System.debug("DEBUG_LOG_Module=FindDatastore: volumeUse: " + volumeUse); System.debug("DEBUG_LOG_Module=FindDatastore: volumeAccess: " + volumeAccess); } if (volumeAccess === "SR") { //Debug if (debugOutput == true) { System.debug("DEBUG_LOG_Module=FindDatastore: Datastore is not suitable: " + datastores[i].name); } re.lastIndex++; } if (volumeAccess === "GE") { System.log("This datastore is a possibility: " + datastores[i].name); targetDatastore.push(datastores[i]); } } }
Log output:
[2016-08-23 13:45:01.045] [D] DEBUG_LOG_Module=FindDatastore: var re= /(([^\-]*)\-(\d{2})(\d{2})(\d{2})(.)\-(GE|SR))/
[2016-08-23 13:45:01.045] [D] DEBUG_LOG_Module=FindDatastore: var str = Datastore01
[2016-08-23 13:45:01.070] [E] Workfow execution stack:
***
item: 'TEMP_regExDeployVmSetup_v5/item2', state: 'failed', business state: 'null', exception: 'TypeError: Cannot find function exec in object /(([^\-]*)\-(\d{2})(\d{2})(\d{2})(.)\-(GE|SR))/. (Workflow:TEMP_regExDeployVmSetup_v5 / FindDatastore_Initial (item10)#27)'
workflow: 'TEMP_regExDeployVmSetup_v5' (6d64f977-589d-4203-8fcf-8c2deadc9a64)
| 'attribute': name=vm type=VC:VirtualMachine value=dunes://service.dunes.ch/CustomSDKObject?id='vcenter.thenewsgroup.com/vm-164091'&dunesName='VC:VirtualMachine'
| 'attribute': name=errorCode type=string value=TypeError: Cannot find function exec in object /(([^\-]*)\-(\d{2})(\d{2})(\d{2})(.)\-(GE|SR))/. (Workflow:TEMP_regExDeployVmSetup_v5 / FindDatastore_Initial (item10)#27)
Problem:
- Line 01 has the variable as if it was embedded. If I uncomment that line and comment out line 02, the module completes fine.
- The log shows the variable as the same (text wise) as the embedded variable but it does not like it.
- It is being interpreted as a function but cannot figure out why
Thanks
B