@@ -315,49 +315,6 @@ export class NodeCommand extends BaseCommand {
315
315
} )
316
316
}
317
317
318
- /**
319
- * Return a list of subtasks to generate gRPC TLS keys
320
- *
321
- * WARNING: These tasks should run in sequence
322
- *
323
- * @param nodeIds node ids
324
- * @param keysDir keys directory
325
- * @param curDate current date
326
- * @return return a list of subtasks
327
- * @private
328
- */
329
- // TODO move to KeyManager
330
- taskGenerateTLSKeys ( nodeIds , keysDir , curDate = new Date ( ) ) {
331
- // check if nodeIds is an array of strings
332
- if ( ! Array . isArray ( nodeIds ) || ! nodeIds . every ( ( nodeId ) => typeof nodeId === 'string' ) ) {
333
- throw new FullstackTestingError ( 'nodeIds must be an array of strings' )
334
- }
335
- const self = this
336
- const nodeKeyFiles = new Map ( )
337
- const subTasks = [ ]
338
-
339
- subTasks . push ( {
340
- title : 'Backup old files' ,
341
- task : ( ) => helpers . backupOldTlsKeys ( nodeIds , keysDir , curDate )
342
- }
343
- )
344
-
345
- for ( const nodeId of nodeIds ) {
346
- subTasks . push ( {
347
- title : `TLS key for node: ${ chalk . yellow ( nodeId ) } ` ,
348
- task : async ( ) => {
349
- const tlsKey = await self . keyManager . generateGrpcTLSKey ( nodeId )
350
- const tlsKeyFiles = await self . keyManager . storeTLSKey ( nodeId , tlsKey , keysDir )
351
- nodeKeyFiles . set ( nodeId , {
352
- tlsKeyFiles
353
- } )
354
- }
355
- } )
356
- }
357
-
358
- return subTasks
359
- }
360
-
361
318
// TODO: duplicate into network deploy
362
319
async initializeSetup ( config , k8 ) {
363
320
// compute other config parameters
@@ -662,7 +619,7 @@ export class NodeCommand extends BaseCommand {
662
619
title : 'Generate gRPC TLS keys' ,
663
620
task : async ( ctx , parentTask ) => {
664
621
const config = ctx . config
665
- const subTasks = self . taskGenerateTLSKeys ( config . nodeIds , config . keysDir , config . curDate )
622
+ const subTasks = self . keyManager . taskGenerateTLSKeys ( config . nodeIds , config . keysDir , config . curDate )
666
623
// set up the sub-tasks
667
624
return parentTask . newListr ( subTasks , {
668
625
concurrent : false ,
@@ -1038,7 +995,7 @@ export class NodeCommand extends BaseCommand {
1038
995
title : 'Generate gRPC TLS keys' ,
1039
996
task : async ( ctx , parentTask ) => {
1040
997
const config = ctx . config
1041
- const subTasks = self . taskGenerateTLSKeys ( config . nodeIds , config . keysDir , config . curDate )
998
+ const subTasks = self . keyManager . taskGenerateTLSKeys ( config . nodeIds , config . keysDir , config . curDate )
1042
999
// set up the sub-tasks
1043
1000
return parentTask . newListr ( subTasks , {
1044
1001
concurrent : true ,
@@ -1502,7 +1459,7 @@ export class NodeCommand extends BaseCommand {
1502
1459
title : 'Generate gRPC TLS key' ,
1503
1460
task : async ( ctx , parentTask ) => {
1504
1461
const config = /** @type {NodeAddConfigClass } **/ ctx . config
1505
- const subTasks = self . taskGenerateTLSKeys ( [ config . nodeId ] , config . keysDir , config . curDate )
1462
+ const subTasks = self . keyManager . taskGenerateTLSKeys ( [ config . nodeId ] , config . keysDir , config . curDate )
1506
1463
// set up the sub-tasks
1507
1464
return parentTask . newListr ( subTasks , {
1508
1465
concurrent : false ,
0 commit comments