I am having troubles. Here is what I want to accomplish.
I have a controller script that I pass a couple things to from the command line:
-script to run
-temp results location
-options file location
The idea for the options file (in my mind) was that depending on the script that I am going to launch I will have to pass a different number of parameters to the script. So, if I just stuck all of my ‘parameters’ into the script then the controller script doesn’t have to know a head of time how many are going to be passed in. And then the test script itself and go about pulling the information from the file to get the data it needs to complete the test case.
This worked fine if I put 1 value in the file. And I assumed that it was going to work fine with more than 1. However, I tried more than 1 value today and it chokes. So at this point I’m stuck.
Here is the code basically of what I’m trying to accomplish:
** First here is the ‘parameters’ file that I generate (outside of eggplant)
** The path of this file is /tmp/opts-1234 and that value gets passed to the controller script as the 3rd parameter (i.e. inOptionDictionary)
******** file contents******
{
testDomain: “a.domain”
testContainer: “ou=test,dc=a,dc=domain”
}
********** end file contents********
*** Here is the controller script snippet in question:
params scriptName, copyToName, inOptionDictionary
put the value of file inOptionDictionary into optionDictionary
RunWithNewResults scriptName,optionDictionary
*** Here is the test script snippet that will actually try to get the data
params optionDictionary
put optionDictionary.testDomain into domain
put optionDictionary.testContainer into container
It chokes in the controller script on this line:
“put the value of file inOptionDictionary into optionDictionary”
It displays this error:
“Syntax Error at line 1: Syntax Error - can’t understand “testContainer” at or near character 22”
If I take out one of the values in the file, i.e. take out the testContainer: line then it does not complain.
So, what am I doing wrong? What is the correct way to pass an unknown number of parameters to the controller script that can then be read by the test script?