Skip to content

Commit 4495157

Browse files
Merge pull request #290 from pcoop/branch1
Tolerate single slash for jobcard
2 parents 660a661 + 1176f0e commit 4495157

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,14 @@ describe("BundleDeployer01", () => {
391391
parms.arguments.jobcard = "'//DFHDPLOY JOB DFHDPLOY,'some text',CLASS=A,MSGCLASS=X,TIME=NOLIMIT'";
392392
await testDeployJCL(parms);
393393
});
394+
it("should tolerate a single leading slash for jobcard", async () => {
395+
396+
let parms: IHandlerParameters;
397+
parms = DEFAULT_PARAMTERS;
398+
setCommonParmsForDeployTests(parms);
399+
parms.arguments.jobcard = "/DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
400+
await testDeployJCL(parms);
401+
});
394402
it("should support long bundledir", async () => {
395403
let parms: IHandlerParameters;
396404
parms = DEFAULT_PARAMTERS;

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,24 @@ UNDEPLOY BUNDLE(12345678)
578578
"
579579
`;
580580

581+
exports[`BundleDeployer01 should tolerate a single leading slash for jobcard 1`] = `
582+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
583+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
584+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
585+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
586+
//SYSTSPRT DD SYSOUT=*
587+
//SYSIN DD *
588+
*
589+
SET CICSPLEX(12345678);
590+
*
591+
DEPLOY BUNDLE(12345678)
592+
BUNDLEDIR(1234567890)
593+
SCOPE(12345678)
594+
STATE(ENABLED)
595+
/*
596+
"
597+
`;
598+
581599
exports[`BundleDeployer01 should tolerate bundledir with extra slasshes 1`] = `
582600
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
583601
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M

src/api/BundleDeploy/ParmValidator.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,19 @@ export class ParmValidator {
309309

310310
// split the jobcard into a comma separated list
311311
const jobcardParts = params.arguments.jobcard.split(",");
312-
const firstPart = jobcardParts[0].trim();
312+
let firstPart = jobcardParts[0].trim();
313313

314314
// check that it starts with '//'
315315
if (firstPart.indexOf("//") !== 0) {
316-
throw new Error("--jobcard parameter does not start with //");
316+
317+
// gitbash can swallow a '/' character. If we only have one then add another.
318+
if (firstPart.startsWith("/")) {
319+
params.arguments.jobcard = "/" + params.arguments.jobcard;
320+
firstPart = "/" + firstPart;
321+
}
322+
else {
323+
throw new Error("--jobcard parameter does not start with //");
324+
}
317325
}
318326

319327
// split the first section of the jobcard into chunks

0 commit comments

Comments
 (0)