zowe / zowe-cli

Zowe CLI
Eclipse Public License 2.0
108 stars 85 forks source link

Initialize additional properties for the ConvertV1Profiles.convert function #2182

Open gejohnston opened 1 week ago

gejohnston commented 1 week ago

What It Does

Initialize additional properties within the ConvertV1Profiles class to enable Zowe Explorer (or other VSCode extensions) to successfully call the ConvertV1Profiles.convert function.

This PR is intended to address the issue https://github.com/zowe/zowe-cli/issues/2170

How to Test

Perform the conversion the same way as before (in CLI or ZE). Observe a successful conversion.

A sample of the output of the CLI command follows:

zowe config convert-profiles --delete
[2024/06/20 12:06:44.400] [WARN] [PluginManagementFacility.js:262] Your configured 'CredentialManager' setting specified a plugin named '@zowe/secure-credential-store-for-zowe-cli' that is not a known credential manager. You should only use this plugin for testing until it is added to zowe's list of known credential managers. If that plugin does not implement a credential manager override class, the built-in zowe credential manager will be used.
If you confirm the deletion of V1 profiles, they are deleted from disk after
a successful conversion. Otherwise, they remain but are no longer used.
You can also delete your V1 profiles later.

Do you want to delete your V1 profiles now [y/N]: y

Converted base profiles: base
Converted cics profiles: cics123
Converted endevor profiles: ndvrSample
Converted jclcheck profiles: jcl123
Converted tso profiles: tso_prof
Converted zosmf profiles: ca32, de20

Your new profiles have been saved to C:\Users\ej608771\.zowe\zowe.config.json. To change your configuration, update that file in your text editor.

Deleted the old profiles directory C:\Users\ej608771\.zowe\profiles-old.

Deleted obsolete secure value Zowe-Plugin/endevor_ndvrSample_user.
Deleted obsolete secure value Zowe-Plugin/base_base_user.
Deleted obsolete secure value Zowe-Plugin/jclcheck_jcl123_user.
Deleted obsolete secure value Zowe-Plugin/cics_cics123_user.
Deleted obsolete secure value Zowe-Plugin/cics_cics123_password.
Deleted obsolete secure value Zowe-Plugin/endevor_ndvrSample_password.
Deleted obsolete secure value Zowe-Plugin/jclcheck_jcl123_password.
Deleted obsolete secure value Zowe-Plugin/base_base_password.

The obsolete plug-in @zowe/secure-credential-store-for-zowe-cli will be uninstalled because the SCS is now embedded within the Zowe clients.

Successfully uninstalled plug-in @zowe/secure-credential-store-for-zowe-cli.

A sample of the result object of the ConvertV1Profiles.convert function (which would be seen by a VSCode extension) follows:

convertResult:
 {
  "msgs": [
    {
      "msgFormat": 1,
      "msgText": "Converted base profiles: base"
    },
    {
      "msgFormat": 1,
      "msgText": "Converted cics profiles: cics123"
    },
    {
      "msgFormat": 1,
      "msgText": "Converted endevor profiles: ndvrSample"
    },
    {
      "msgFormat": 1,
      "msgText": "Converted jclcheck profiles: jcl123"
    },
    {
      "msgFormat": 1,
      "msgText": "Converted tso profiles: tso_prof"
    },
    {
      "msgFormat": 1,
      "msgText": "Converted zosmf profiles: ca32, de20"
    },
    {
      "msgFormat": 5,
      "msgText": "Your new profiles have been saved to C:\\Users\\ej608771\\.zowe\\zowe.config.json. To change your configuration, update that file in your text editor."
    },
    {
      "msgFormat": 5,
      "msgText": "Deleted the old profiles directory C:\\Users\\ej608771\\.zowe\\profiles-old."
    },
    {
      "msgFormat": 5,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/endevor_ndvrSample_user."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/base_base_user."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/jclcheck_jcl123_user."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/cics_cics123_user."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/cics_cics123_password."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/endevor_ndvrSample_password."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/jclcheck_jcl123_password."
    },
    {
      "msgFormat": 1,
      "msgText": "Deleted obsolete secure value Zowe-Plugin/base_base_password."
    },
    {
      "msgFormat": 5,
      "msgText": "The obsolete plug-in @zowe/secure-credential-store-for-zowe-cli should be uninstalled because the SCS is now embedded within the Zowe clients. Zowe CLI plugins can only be uninstalled by the CLI. Use the command 'zowe plugins uninstall @zowe/secure-credential-store-for-zowe-cli'."
    }
  ],
  "v1ScsPluginName": "@zowe/secure-credential-store-for-zowe-cli",
  "credsWereMigrated": true,
  "cfgFilePathNm": "C:\\Users\\ej608771\\.zowe\\zowe.config.json",
  "numProfilesFound": 7,
  "profilesConverted": {
    "base": [
      "base"
    ],
    "cics": [
      "cics123"
    ],
    "endevor": [
      "ndvrSample"
    ],
    "jclcheck": [
      "jcl123"
    ],
    "tso": [
      "tso_prof"
    ],
    "zosmf": [
      "ca32",
      "de20"
    ]
  },
  "profilesFailed": []
}

Review Checklist I certify that I have:

Additional Comments

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 99.15966% with 1 line in your changes missing coverage. Please review.

Project coverage is 91.04%. Comparing base (abadee5) to head (10aab3c). Report is 2 commits behind head on next.

Files Patch % Lines
...ges/imperative/src/config/src/ConvertV1Profiles.ts 99.15% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## next #2182 +/- ## ========================================== - Coverage 91.18% 91.04% -0.14% ========================================== Files 628 628 Lines 17859 17909 +50 Branches 3799 3812 +13 ========================================== + Hits 16284 16306 +22 - Misses 1574 1602 +28 Partials 1 1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.