Skip to content

Commit 8b5a320

Browse files
committed
DEPLOY shouldn't auto undeploy
1 parent 0191da3 commit 8b5a320

File tree

2 files changed

+21
-80
lines changed

2 files changed

+21
-80
lines changed

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

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,6 @@ exports[`BundleDeployer01 should generate deploy JCL for csdgroup 2`] = `
4444
*
4545
SET CICSPLEX(12345678);
4646
*
47-
UNDEPLOY BUNDLE(12345678)
48-
SCOPE(12345678)
49-
STATE(DISCARDED)
50-
CSDGROUP(12345678);
51-
*
5247
DEPLOY BUNDLE(12345678)
5348
BUNDLEDIR(1234567890)
5449
SCOPE(12345678)
@@ -70,12 +65,6 @@ exports[`BundleDeployer01 should generate deploy JCL for csdgroup with timeout 2
7065
*
7166
SET CICSPLEX(12345678);
7267
*
73-
UNDEPLOY BUNDLE(12345678)
74-
SCOPE(12345678)
75-
STATE(DISCARDED)
76-
TIMEOUT(1500)
77-
CSDGROUP(12345678);
78-
*
7968
DEPLOY BUNDLE(12345678)
8069
BUNDLEDIR(1234567890)
8170
SCOPE(12345678)
@@ -98,11 +87,6 @@ exports[`BundleDeployer01 should generate deploy JCL for resgroup 2`] = `
9887
*
9988
SET CICSPLEX(12345678);
10089
*
101-
UNDEPLOY BUNDLE(12345678)
102-
SCOPE(12345678)
103-
STATE(DISCARDED)
104-
RESGROUP(12345678);
105-
*
10690
DEPLOY BUNDLE(12345678)
10791
BUNDLEDIR(1234567890)
10892
SCOPE(12345678)
@@ -124,12 +108,6 @@ exports[`BundleDeployer01 should generate deploy JCL for resgroup with timeout 2
124108
*
125109
SET CICSPLEX(12345678);
126110
*
127-
UNDEPLOY BUNDLE(12345678)
128-
SCOPE(12345678)
129-
STATE(DISCARDED)
130-
TIMEOUT(1500)
131-
RESGROUP(12345678);
132-
*
133111
DEPLOY BUNDLE(12345678)
134112
BUNDLEDIR(1234567890)
135113
SCOPE(12345678)
@@ -236,11 +214,6 @@ exports[`BundleDeployer01 should support long bundledir 2`] = `
236214
*
237215
SET CICSPLEX(12345678);
238216
*
239-
UNDEPLOY BUNDLE(12345678)
240-
SCOPE(12345678)
241-
STATE(DISCARDED)
242-
RESGROUP(12345678);
243-
*
244217
DEPLOY BUNDLE(12345678)
245218
BUNDLEDIR(123456789012345678901234567890123456789012345678901234
246219
567890123456789012345678901234567890123456789012345678901234567
@@ -267,11 +240,6 @@ exports[`BundleDeployer01 should support long line jobcard 2`] = `
267240
*
268241
SET CICSPLEX(12345678);
269242
*
270-
UNDEPLOY BUNDLE(12345678)
271-
SCOPE(12345678)
272-
STATE(DISCARDED)
273-
RESGROUP(12345678);
274-
*
275243
DEPLOY BUNDLE(12345678)
276244
BUNDLEDIR(1234567890)
277245
SCOPE(12345678)
@@ -294,11 +262,6 @@ exports[`BundleDeployer01 should support multi-line jobcard 2`] = `
294262
*
295263
SET CICSPLEX(12345678);
296264
*
297-
UNDEPLOY BUNDLE(12345678)
298-
SCOPE(12345678)
299-
STATE(DISCARDED)
300-
RESGROUP(12345678);
301-
*
302265
DEPLOY BUNDLE(12345678)
303266
BUNDLEDIR(1234567890)
304267
SCOPE(12345678)
@@ -323,11 +286,6 @@ exports[`BundleDeployer01 should support really long line jobcard 2`] = `
323286
*
324287
SET CICSPLEX(12345678);
325288
*
326-
UNDEPLOY BUNDLE(12345678)
327-
SCOPE(12345678)
328-
STATE(DISCARDED)
329-
RESGROUP(12345678);
330-
*
331289
DEPLOY BUNDLE(12345678)
332290
BUNDLEDIR(1234567890)
333291
SCOPE(12345678)

src/api/BundleDeploy/BundleDeployer.ts

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -106,31 +106,10 @@ export class BundleDeployer {
106106
* @memberof BundleDeployer
107107
*/
108108
private getDeployJCL(): string {
109-
// Deploy actions begin by first undeploying any former version of the
110-
// Bundle that may still be installed, so generate an undeploy statement
111-
// first.
112-
let jcl = this.generateUndeployJCLWithoutTerminator();
113-
114-
jcl = jcl + "*\n";
115-
116-
// Now generate the deploy statement.
117-
jcl = jcl + this.wrapLongLineForJCL("DEPLOY BUNDLE(" + this.params.arguments.name + ")\n") +
118-
this.wrapLongLineForJCL(" BUNDLEDIR(" + this.params.arguments.bundledir + ")\n") +
119-
this.wrapLongLineForJCL(" SCOPE(" + this.params.arguments.scope + ")\n") +
120-
this.wrapLongLineForJCL(" STATE(AVAILABLE)\n");
121-
122-
if (this.params.arguments.timeout !== undefined) {
123-
jcl = jcl + this.wrapLongLineForJCL(" TIMEOUT(" + this.params.arguments.timeout + ")\n");
124-
}
125-
if (this.params.arguments.csdgroup !== undefined) {
126-
jcl = jcl + this.wrapLongLineForJCL(" CSDGROUP(" + this.params.arguments.csdgroup + ");\n");
127-
}
128-
if (this.params.arguments.resgroup !== undefined) {
129-
jcl = jcl + this.wrapLongLineForJCL(" RESGROUP(" + this.params.arguments.resgroup + ");\n");
130-
}
131-
132-
// finally add a terminator
133-
jcl = jcl + "/*\n";
109+
const jcl = this.generateCommonJCLHeader() +
110+
this.wrapLongLineForJCL("DEPLOY BUNDLE(" + this.params.arguments.name + ")\n") +
111+
this.wrapLongLineForJCL(" BUNDLEDIR(" + this.params.arguments.bundledir + ")\n") +
112+
this.generateCommonJCLFooter("AVAILABLE");
134113

135114
return jcl;
136115
}
@@ -142,29 +121,31 @@ export class BundleDeployer {
142121
* @memberof BundleDeployer
143122
*/
144123
private getUndeployJCL(): string {
145-
// Get the basicundeploy JCL
146-
let jcl = this.generateUndeployJCLWithoutTerminator();
147-
148-
// finally add a terminator
149-
jcl = jcl + "/*\n";
124+
const jcl = this.generateCommonJCLHeader() +
125+
this.wrapLongLineForJCL("UNDEPLOY BUNDLE(" + this.params.arguments.name + ")\n") +
126+
this.generateCommonJCLFooter("DISCARDED");
150127

151128
return jcl;
152129
}
153130

154-
// Generate the JCL for undeploy, but without terminating the stream
155-
private generateUndeployJCLWithoutTerminator(): string {
156-
let jcl = this.params.arguments.jobcard + "\n" +
131+
private generateCommonJCLHeader(): string {
132+
const jcl = this.params.arguments.jobcard + "\n" +
157133
"//DFHDPLOY EXEC PGM=DFHDPLOY,REGION=100M\n" +
158134
"//STEPLIB DD DISP=SHR,DSN=" + this.params.arguments.cicshlq + ".SDFHLOAD\n" +
159135
"// DD DISP=SHR,DSN=" + this.params.arguments.cpsmhlq + ".SEYUAUTH\n" +
160136
"//SYSTSPRT DD SYSOUT=*\n" +
161137
"//SYSIN DD *\n" +
162138
"*\n" +
163139
this.wrapLongLineForJCL("SET CICSPLEX(" + this.params.arguments.cicsplex + ");\n") +
164-
this.wrapLongLineForJCL("*\n") +
165-
this.wrapLongLineForJCL("UNDEPLOY BUNDLE(" + this.params.arguments.name + ")\n") +
166-
this.wrapLongLineForJCL(" SCOPE(" + this.params.arguments.scope + ")\n") +
167-
this.wrapLongLineForJCL(" STATE(DISCARDED)\n");
140+
this.wrapLongLineForJCL("*\n");
141+
142+
return jcl;
143+
}
144+
145+
private generateCommonJCLFooter(targetState: string): string {
146+
let jcl =
147+
this.wrapLongLineForJCL(" SCOPE(" + this.params.arguments.scope + ")\n") +
148+
this.wrapLongLineForJCL(" STATE(" + targetState + ")\n");
168149

169150
if (this.params.arguments.timeout !== undefined) {
170151
jcl = jcl + this.wrapLongLineForJCL(" TIMEOUT(" + this.params.arguments.timeout + ")\n");
@@ -176,10 +157,12 @@ export class BundleDeployer {
176157
jcl = jcl + this.wrapLongLineForJCL(" RESGROUP(" + this.params.arguments.resgroup + ");\n");
177158
}
178159

160+
// finally add a terminator
161+
jcl = jcl + "/*\n";
162+
179163
return jcl;
180164
}
181165

182-
183166
private async createZosMFSession(): Promise<any> {
184167
// Create a zosMF session
185168
const zosmfProfile = this.params.profiles.get("zosmf");

0 commit comments

Comments
 (0)