profInfo.updateProperty(propOpts) updates the default profile instead of the system profile in VSCode Extension #1864
Labels
bug
Something isn't working
priority-medium
Not functioning - next quarter if capacity permits
severity-medium
Bug where workaround exists or that doesn't prevent the usage of Zowe. Just makes it more complex.
@t1m0thyj @gejohnston
In my zowe.config.json, I have a default base profile and a couple of system profiles.
One of the system profiles specifies secure[user, password]
I have nothing currently saved in the secure credentials vault.
When I run zowe config secure --gc - I noticed that it always leaves the Default base profile to be prompted last.
In my VSCode Explorer, I prompt and update in a different order, I update the Default Base profile first, then update the System profile.
I am using profInfo.updateProperty as you can see below. There is nothing in propOpts that should affect the update sequence.
await profInfo.updateProperty(propOpts); // update the vault
whilst running the VSCode extension in debug mode, I check the vault after each update.
First is the userid, then second is the password for the default - all good so far.
Then I update the system profile - again userid first , then password.
I then check the vault and I am seeing that the default base user and password have been overwritten by the userid and password of the system values but there is no vault entry for the system profile.
So I then added this line to my code:
promptResults = promptResults.reverse();
to flip my array so that the default is now second (last).
I then delete the vault entry in order to rerun my test.
Now when I run it, the update is first done for the system profile - userid and password and then I check the vault and the system profile entries are present for the userid and password.
Then I proceed and let the update now take place for the second entry in my array which is the default base profile entry and it correctly then adds the userid and password for the default.
So basically, when running profInfo.updateProperty, the default profile update must be the last to be updated.
I only fathomed this out simply by watching the running order for zowe.config update --gc so I flipped my array and behold it then worked correctly.
I think this is a bug to be honest as running profinfo.updateProperty should simply take in the 5 parameters - where it specifically calls out the profile type and name.
profileType: profile.type,
profileName: profile.name,
property: arg.argName,
value: arg.value,
setSecure: true,
The order of the profInfo.updateProperty calls should not come into play at that point.
The text was updated successfully, but these errors were encountered: