@@ -70,11 +70,11 @@ export class BundlePusher {
70
70
// Create an SSH session
71
71
const sshSession = await this . createSshSession ( ) ;
72
72
73
- // Start a progress bar
73
+ // Start a progress bar (but only in non-verbose mode)
74
74
this . progressBar = { percentComplete : 0 ,
75
75
statusMessage : "Starting Push operation" ,
76
76
stageName : TaskStage . IN_PROGRESS } ;
77
- this . params . response . progress . startBar ( { task : this . progressBar } ) ;
77
+ this . startProgressBar ( ) ;
78
78
79
79
// Attempt to make the target bundledir
80
80
await this . makeBundleDir ( zosMFSession ) ;
@@ -103,7 +103,7 @@ export class BundlePusher {
103
103
// Run DFHDPLOY to install the bundle
104
104
await this . deployBundle ( zosMFSession , bd ) ;
105
105
106
- this . params . response . progress . endBar ( ) ;
106
+ this . endProgressBar ( ) ;
107
107
return "PUSH operation completed." ;
108
108
}
109
109
@@ -223,37 +223,36 @@ export class BundlePusher {
223
223
private async undeployExistingBundle ( zosMFSession : AbstractSession , bd : BundleDeployer ) {
224
224
// End the current progress bar so that UNDEPLOY can create its own
225
225
this . updateStatus ( "Undeploying any existing bundle from CICS" ) ;
226
- this . params . response . progress . endBar ( ) ;
226
+ this . endProgressBar ( ) ;
227
+
227
228
228
229
const targetstateLocal = this . params . arguments . targetstate ;
229
230
this . params . arguments . targetstate = "DISCARDED" ;
230
231
await bd . undeployBundle ( zosMFSession ) ;
231
232
this . params . arguments . targetstate = targetstateLocal ;
232
233
233
234
// Resume the current progress bar
234
- this . params . response . progress . endBar ( ) ;
235
+ this . endProgressBar ( ) ;
235
236
this . updateStatus ( "Undeployed existing bundle from CICS" ) ;
236
- this . params . response . progress . startBar ( { task : this . progressBar } ) ;
237
+ this . startProgressBar ( ) ;
237
238
}
238
239
239
240
private async deployBundle ( zosMFSession : AbstractSession , bd : BundleDeployer ) {
240
241
// End the current progress bar so that DEPLOY can create its own
241
242
this . updateStatus ( "Deploying the bundle to CICS" ) ;
242
- this . params . response . progress . endBar ( ) ;
243
+ this . endProgressBar ( ) ;
243
244
244
245
await bd . deployBundle ( zosMFSession ) ;
245
246
// Resume the current progress bar
246
- this . params . response . progress . endBar ( ) ;
247
+ this . endProgressBar ( ) ;
247
248
this . updateStatus ( "Deployed existing bundle to CICS" ) ;
248
- this . params . response . progress . startBar ( { task : this . progressBar } ) ;
249
+ this . startProgressBar ( ) ;
249
250
}
250
251
251
252
private sshOutput ( data : string ) {
252
253
// If verbose output is requested then log SSH output directly to the console
253
254
if ( this . params . arguments . verbose ) {
254
- this . params . response . progress . endBar ( ) ;
255
255
this . params . response . console . log ( Buffer . from ( data ) ) ;
256
- this . params . response . progress . startBar ( { task : this . progressBar } ) ;
257
256
}
258
257
this . sshOutputText += data ;
259
258
}
@@ -342,7 +341,7 @@ export class BundlePusher {
342
341
// if we've not already logged the output, log it now
343
342
if ( this . params . arguments . verbose !== true )
344
343
{
345
- this . params . response . console . log ( this . sshOutputText ) ;
344
+ this . params . response . console . log ( Buffer . from ( this . sshOutputText ) ) ;
346
345
}
347
346
throw new Error ( "The output from the remote command implied that an error occurred." ) ;
348
347
}
@@ -383,13 +382,13 @@ export class BundlePusher {
383
382
384
383
// A project specific .zosattributes has not been found, so use a default
385
384
const warningMsg = "WARNING: No .zosAttributes file found in the bundle directory, default values will be applied." ;
386
- this . params . response . progress . endBar ( ) ;
387
- this . params . response . console . log ( warningMsg ) ;
385
+ this . endProgressBar ( ) ;
386
+ this . params . response . console . log ( Buffer . from ( warningMsg ) ) ;
388
387
if ( this . params . arguments . silent === undefined ) {
389
388
const logger = Logger . getAppLogger ( ) ;
390
389
logger . warn ( warningMsg ) ;
391
390
}
392
- this . params . response . progress . startBar ( { task : this . progressBar } ) ;
391
+ this . startProgressBar ( ) ;
393
392
return new ZosFilesAttributes ( Bundle . getTemplateZosAttributesFile ( ) ) ;
394
393
}
395
394
@@ -399,12 +398,24 @@ export class BundlePusher {
399
398
this . progressBar . statusMessage = status ;
400
399
401
400
if ( this . params . arguments . verbose ) {
402
- this . params . response . console . log ( status + "\n" ) ;
401
+ this . params . response . console . log ( Buffer . from ( status + "\n" ) ) ;
403
402
}
404
403
405
404
if ( this . params . arguments . silent === undefined ) {
406
405
const logger = Logger . getAppLogger ( ) ;
407
406
logger . debug ( status ) ;
408
407
}
409
408
}
409
+
410
+ private startProgressBar ( ) {
411
+ if ( this . params . arguments . verbose !== true ) {
412
+ this . params . response . progress . startBar ( { task : this . progressBar } ) ;
413
+ }
414
+ }
415
+
416
+ private endProgressBar ( ) {
417
+ if ( this . params . arguments . verbose !== true ) {
418
+ this . params . response . progress . endBar ( ) ;
419
+ }
420
+ }
410
421
}
0 commit comments