@@ -368,13 +368,32 @@ export default class ClusterViewLoader {
368
368
}
369
369
}
370
370
371
+ /**
372
+ * Cleans up the CRC configuration settings.
373
+ *
374
+ * This is a workarount to https://github.com/redhat-developer/vscode-openshift-tools/issues/4411
375
+ * After the CRC setting values are removed, if the 'openshiftToolkit' object exists in 'settings.json',
376
+ * containing the same settings as the CRC ones, the new values will be written AFTER the mensioned object,
377
+ * so their values will override the ones defined in the object.
378
+ */
379
+ static async clearCrcSettings ( ) {
380
+ const cfg = vscode . workspace . getConfiguration ( 'openshiftToolkit' ) ;
381
+ await cfg . update ( 'crcBinaryLocation' , undefined , vscode . ConfigurationTarget . Global ) ;
382
+ await cfg . update ( 'crcPullSecretPath' , undefined , vscode . ConfigurationTarget . Global ) ;
383
+ await cfg . update ( 'crcCpuCores' , undefined , vscode . ConfigurationTarget . Global ) ;
384
+ await cfg . update ( 'crcMemoryAllocated' , undefined , vscode . ConfigurationTarget . Global ) ;
385
+ await cfg . update ( 'crcNameserver' , undefined ) ; // Previously it was saved as `Workspace`
386
+ await cfg . update ( 'crcNameserver' , undefined , vscode . ConfigurationTarget . Global ) ;
387
+ }
388
+
371
389
static async crcSaveSettings ( event ) {
390
+ await ClusterViewLoader . clearCrcSettings ( ) ;
372
391
const cfg = vscode . workspace . getConfiguration ( 'openshiftToolkit' ) ;
373
392
await cfg . update ( 'crcBinaryLocation' , event . crcLoc , vscode . ConfigurationTarget . Global ) ;
374
393
await cfg . update ( 'crcPullSecretPath' , event . pullSecret , vscode . ConfigurationTarget . Global ) ;
375
394
await cfg . update ( 'crcCpuCores' , event . cpuSize , vscode . ConfigurationTarget . Global ) ;
376
395
await cfg . update ( 'crcMemoryAllocated' , Number . parseInt ( event . memory , 10 ) , vscode . ConfigurationTarget . Global ) ;
377
- await cfg . update ( 'crcNameserver' , event . nameserver ) ;
396
+ await cfg . update ( 'crcNameserver' , event . nameserver , vscode . ConfigurationTarget . Global ) ;
378
397
}
379
398
380
399
static async loadView ( title : string ) : Promise < vscode . WebviewPanel > {
0 commit comments