Skip to content

Commit 16984cb

Browse files
committed
tolerate quotes around jobcard
Signed-off-by: Paul Cooper <[email protected]>
1 parent 27cb5c6 commit 16984cb

File tree

3 files changed

+172
-0
lines changed

3 files changed

+172
-0
lines changed

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,60 @@ describe("BundleDeployer01", () => {
337337
expect(err).toBeDefined();
338338
expect(err.message).toMatchSnapshot();
339339
});
340+
it("tolerate embedded quote", async () => {
341+
342+
let parms: IHandlerParameters;
343+
parms = DEFAULT_PARAMTERS;
344+
setCommonParmsForDeployTests(parms);
345+
parms.arguments.resgroup = "12345678";
346+
parms.arguments.jobcard = '//DFHDPLOY JOB DFHDPLOY,"some text",CLASS=A,MSGCLASS=X,TIME=NOLIMIT';
347+
await testDeployJCL(parms);
348+
});
349+
it("tolerate embedded single quote", async () => {
350+
351+
let parms: IHandlerParameters;
352+
parms = DEFAULT_PARAMTERS;
353+
setCommonParmsForDeployTests(parms);
354+
parms.arguments.resgroup = "12345678";
355+
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,'some text',CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
356+
await testDeployJCL(parms);
357+
});
358+
it("tolerate quotes around jobcard", async () => {
359+
360+
let parms: IHandlerParameters;
361+
parms = DEFAULT_PARAMTERS;
362+
setCommonParmsForDeployTests(parms);
363+
parms.arguments.resgroup = "12345678";
364+
parms.arguments.jobcard = '"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT"';
365+
await testDeployJCL(parms);
366+
});
367+
it("tolerate single quotes around jobcard", async () => {
368+
369+
let parms: IHandlerParameters;
370+
parms = DEFAULT_PARAMTERS;
371+
setCommonParmsForDeployTests(parms);
372+
parms.arguments.resgroup = "12345678";
373+
parms.arguments.jobcard = "'//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT'";
374+
await testDeployJCL(parms);
375+
});
376+
it("tolerate quotes around jobcard with embedded quote", async () => {
377+
378+
let parms: IHandlerParameters;
379+
parms = DEFAULT_PARAMTERS;
380+
setCommonParmsForDeployTests(parms);
381+
parms.arguments.resgroup = "12345678";
382+
parms.arguments.jobcard = '"//DFHDPLOY JOB DFHDPLOY,"some text",CLASS=A,MSGCLASS=X,TIME=NOLIMIT"';
383+
await testDeployJCL(parms);
384+
});
385+
it("tolerate single quotes around jobcard with embedded single quote", async () => {
386+
387+
let parms: IHandlerParameters;
388+
parms = DEFAULT_PARAMTERS;
389+
setCommonParmsForDeployTests(parms);
390+
parms.arguments.resgroup = "12345678";
391+
parms.arguments.jobcard = "'//DFHDPLOY JOB DFHDPLOY,'some text',CLASS=A,MSGCLASS=X,TIME=NOLIMIT'";
392+
await testDeployJCL(parms);
393+
});
340394
it("should support long bundledir", async () => {
341395
let parms: IHandlerParameters;
342396
parms = DEFAULT_PARAMTERS;

__tests__/api/BundleDeploy/__snapshots__/BundleDeployer.test.ts.snap

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,117 @@ exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 1`] = `"DFH
601601
exports[`BundleDeployer01 should undeploy successfully 1`] = `"Bundle undeployment successful."`;
602602

603603
exports[`BundleDeployer01 should update the progress bar 1`] = `"spoolOutput is not iterable"`;
604+
605+
exports[`BundleDeployer01 tolerate embedded quote 1`] = `
606+
"//DFHDPLOY JOB DFHDPLOY,\\"some text\\",CLASS=A,MSGCLASS=X,TIME=NOLIMIT
607+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
608+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
609+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
610+
//SYSTSPRT DD SYSOUT=*
611+
//SYSIN DD *
612+
*
613+
SET CICSPLEX(12345678);
614+
*
615+
DEPLOY BUNDLE(12345678)
616+
BUNDLEDIR(1234567890)
617+
SCOPE(12345678)
618+
STATE(ENABLED)
619+
RESGROUP(12345678);
620+
/*
621+
"
622+
`;
623+
624+
exports[`BundleDeployer01 tolerate embedded single quote 1`] = `
625+
"//DFHDPLOY JOB DFHDPLOY,'some text',CLASS=A,MSGCLASS=X,TIME=NOLIMIT
626+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
627+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
628+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
629+
//SYSTSPRT DD SYSOUT=*
630+
//SYSIN DD *
631+
*
632+
SET CICSPLEX(12345678);
633+
*
634+
DEPLOY BUNDLE(12345678)
635+
BUNDLEDIR(1234567890)
636+
SCOPE(12345678)
637+
STATE(ENABLED)
638+
RESGROUP(12345678);
639+
/*
640+
"
641+
`;
642+
643+
exports[`BundleDeployer01 tolerate quotes around jobcard 1`] = `
644+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
645+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
646+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
647+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
648+
//SYSTSPRT DD SYSOUT=*
649+
//SYSIN DD *
650+
*
651+
SET CICSPLEX(12345678);
652+
*
653+
DEPLOY BUNDLE(12345678)
654+
BUNDLEDIR(1234567890)
655+
SCOPE(12345678)
656+
STATE(ENABLED)
657+
RESGROUP(12345678);
658+
/*
659+
"
660+
`;
661+
662+
exports[`BundleDeployer01 tolerate quotes around jobcard with embedded quote 1`] = `
663+
"//DFHDPLOY JOB DFHDPLOY,\\"some text\\",CLASS=A,MSGCLASS=X,TIME=NOLIMIT
664+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
665+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
666+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
667+
//SYSTSPRT DD SYSOUT=*
668+
//SYSIN DD *
669+
*
670+
SET CICSPLEX(12345678);
671+
*
672+
DEPLOY BUNDLE(12345678)
673+
BUNDLEDIR(1234567890)
674+
SCOPE(12345678)
675+
STATE(ENABLED)
676+
RESGROUP(12345678);
677+
/*
678+
"
679+
`;
680+
681+
exports[`BundleDeployer01 tolerate single quotes around jobcard 1`] = `
682+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
683+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
684+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
685+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
686+
//SYSTSPRT DD SYSOUT=*
687+
//SYSIN DD *
688+
*
689+
SET CICSPLEX(12345678);
690+
*
691+
DEPLOY BUNDLE(12345678)
692+
BUNDLEDIR(1234567890)
693+
SCOPE(12345678)
694+
STATE(ENABLED)
695+
RESGROUP(12345678);
696+
/*
697+
"
698+
`;
699+
700+
exports[`BundleDeployer01 tolerate single quotes around jobcard with embedded single quote 1`] = `
701+
"//DFHDPLOY JOB DFHDPLOY,'some text',CLASS=A,MSGCLASS=X,TIME=NOLIMIT
702+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
703+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
704+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
705+
//SYSTSPRT DD SYSOUT=*
706+
//SYSIN DD *
707+
*
708+
SET CICSPLEX(12345678);
709+
*
710+
DEPLOY BUNDLE(12345678)
711+
BUNDLEDIR(1234567890)
712+
SCOPE(12345678)
713+
STATE(ENABLED)
714+
RESGROUP(12345678);
715+
/*
716+
"
717+
`;

src/api/BundleDeploy/ParmValidator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,10 @@ export class ParmValidator {
303303
// handle long jobcards
304304
ParmValidator.wrapJobcard(params);
305305

306+
// Strip leading and trailing quotes, if they're there
307+
params.arguments.jobcard = params.arguments.jobcard.replace(/^"(.*)"$/, "$1");
308+
params.arguments.jobcard = params.arguments.jobcard.replace(/^'(.*)'$/, "$1");
309+
306310
// split the jobcard into a comma separated list
307311
const jobcardParts = params.arguments.jobcard.split(",");
308312
const firstPart = jobcardParts[0].trim();

0 commit comments

Comments
 (0)