I have built a test harness on the STP server, that spawns unique sessions for each test run. The problem I have now is that one of my tests requires the use of a metadata account (and my spawned sessions are running under the sassrv system account).
For info, the code snippet that spawns those sessions is below:
/**
* Execute all the backtest scripts and retain the logs
*/
options sascmd='!sascmd';
%local waitforlist;
%do x=1 %to %get_attrn(backtest_scripts,NLOBS);
signon connx&x;
%syslput LOC_BACKTEST_SCRIPTS=&LOC_BACKTEST_SCRIPTS /remote=connx&x;
%syslput TEST_RUN_NO=&TEST_RUN_NO /remote=connx&x;
%syslput TEST_ID=Test&x /remote=connx&x;
%syslput TEST_PGM=&&test&x /remote=connx&x;
%syslput LOC_TEST_RESULTS=&LOC_BACKTEST_LOGS\Test_&TEST_RUN_NO
/remote=connx&x;
%syslput LOG_LOC=&LOC_BACKTEST_LOGS\Test_&TEST_RUN_NO\&&test&x...log
/remote=connx&x;
rsubmit connx&x wait=no ;
proc printto log="&LOG_LOC"; run;
options mprint source source2;
%inc "&LOC_BACKTEST_SCRIPTS\&test_pgm..sas";
endrsubmit;
%let waitforlist=&waitforlist connx&x;
%end;
waitfor _all_ &waitforlist;
%do x=1 %to %to %get_attrn(backtest_scripts,NLOBS);
signoff connx&x;
%end;
My question - how do I now connect as a metadata user via the sassrv account? I know I could use the -metauser XXX -metapass XXX
options but I'd rather not embed passwords in my script if possible..
I know (now) that we cannot set up the sassrv account as a metadata user, as it is already in use (SAS General Servers group). I also need streaming output, so cannot use the workspace server. I tried using AUTHDOMAIN on my rsubmit
statement but keep getting:
ERROR: Retrieving login information based on AuthenticationDomain from the SAS Metadata Server failed.
So, in the end, I had to connect via an options statement with metauser / metapass (encoded) credentials. However, to avoid surfacing these in the code (or in the log) we created a network share that only the system accounts could access.. Then simply %inc'd a text file containing the credentials (with option nosource2 to be sure).
Job done!