@@ -368,13 +368,31 @@ 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 , vscode . ConfigurationTarget . Global ) ;
386
+ }
387
+
371
388
static async crcSaveSettings ( event ) {
389
+ await ClusterViewLoader . clearCrcSettings ( ) ;
372
390
const cfg = vscode . workspace . getConfiguration ( 'openshiftToolkit' ) ;
373
391
await cfg . update ( 'crcBinaryLocation' , event . crcLoc , vscode . ConfigurationTarget . Global ) ;
374
392
await cfg . update ( 'crcPullSecretPath' , event . pullSecret , vscode . ConfigurationTarget . Global ) ;
375
393
await cfg . update ( 'crcCpuCores' , event . cpuSize , vscode . ConfigurationTarget . Global ) ;
376
394
await cfg . update ( 'crcMemoryAllocated' , Number . parseInt ( event . memory , 10 ) , vscode . ConfigurationTarget . Global ) ;
377
- await cfg . update ( 'crcNameserver' , event . nameserver ) ;
395
+ await cfg . update ( 'crcNameserver' , event . nameserver , vscode . ConfigurationTarget . Global ) ;
378
396
}
379
397
380
398
static async loadView ( title : string ) : Promise < vscode . WebviewPanel > {
0 commit comments