Skip to content

Commit 2d3c63e

Browse files
authored
Merge pull request #64 from matthewpwilson/slashfix
Strip out any extra slashes from bundledir
2 parents db93e0b + 99f8831 commit 2d3c63e

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ results/
66
__results__/
77
__tests__/__results__/
88
/__tests__/__resources__/properties/**
9-
!/__tests__/__resources__/properties/example_properties.yaml
9+
!/__tests__/__resources__/properties/example_properties.yaml
10+
package-lock.json

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ describe("BundleDeployer01", () => {
307307
expect(err.message).toMatchSnapshot();
308308
});
309309
it("should support long bundledir", async () => {
310-
311310
let parms: IHandlerParameters;
312311
parms = DEFAULT_PARAMTERS;
313312
setCommonParmsForDeployTests(parms);
@@ -319,6 +318,13 @@ describe("BundleDeployer01", () => {
319318
"1234567890123456789012345678901234567890123456789012345";
320319
await testDeployJCL(parms);
321320
});
321+
it("should tolerate bundledir with extra slasshes", async () => {
322+
let parms: IHandlerParameters;
323+
parms = DEFAULT_PARAMTERS;
324+
setCommonParmsForDeployTests(parms);
325+
parms.arguments.bundledir = "//bundledir/with/extra//slashes";
326+
await testDeployJCL(parms);
327+
});
322328
it("should generate deploy JCL for AVAILABLE", async () => {
323329

324330
let parms: IHandlerParameters;

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,24 @@ UNDEPLOY BUNDLE(12345678)
540540
"
541541
`;
542542

543+
exports[`BundleDeployer01 should tolerate bundledir with extra slasshes 1`] = `
544+
"//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT
545+
//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M
546+
//STEPLIB DD DISP=SHR,DSN=12345678901234567890123456789012345.SDFHLOAD
547+
// DD DISP=SHR,DSN=abcde12345abcde12345abcde12345abcde.SEYUAUTH
548+
//SYSTSPRT DD SYSOUT=*
549+
//SYSIN DD *
550+
*
551+
SET CICSPLEX(12345678);
552+
*
553+
DEPLOY BUNDLE(12345678)
554+
BUNDLEDIR(/bundledir/with/extra/slashes)
555+
SCOPE(12345678)
556+
STATE(ENABLED)
557+
/*
558+
"
559+
`;
560+
543561
exports[`BundleDeployer01 should tolerate empty output from DFHDPLOY 1`] = `"DFHDPLOY did not generate any output. Most recent status update: 'Submitting DFHDPLOY JCL'."`;
544562

545563
exports[`BundleDeployer01 should undeploy successfully 1`] = `"Bundle undeployment successful."`;

src/api/BundleDeploy/BundleDeployer.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { IHandlerParameters, Logger, ImperativeError, AbstractSession, ITaskWith
1515
TaskStage , TaskProgress} from "@zowe/imperative";
1616
import { ZosmfSession, SubmitJobs, List } from "@zowe/cli";
1717
import { ParmValidator } from "./ParmValidator";
18+
import * as path from "path";
1819

1920
/**
2021
* Class to represent a CICS Bundle Deployer.
@@ -134,9 +135,12 @@ export class BundleDeployer {
134135
* @memberof BundleDeployer
135136
*/
136137
private getDeployJCL(): string {
138+
// Get rid of any extra slashes which may be needed on git-bash to avoid path munging
139+
const bundledir = path.posix.normalize(this.params.arguments.bundledir);
140+
137141
const jcl = this.generateCommonJCLHeader() +
138142
this.wrapLongLineForJCL("DEPLOY BUNDLE(" + this.params.arguments.name + ")\n") +
139-
this.wrapLongLineForJCL(" BUNDLEDIR(" + this.params.arguments.bundledir + ")\n") +
143+
this.wrapLongLineForJCL(" BUNDLEDIR(" + bundledir + ")\n") +
140144
this.generateCommonJCLFooter();
141145

142146
return jcl;

0 commit comments

Comments
 (0)