Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zowe plugins validate returns always RC=0 #1299

Closed
Tracked by #1545 ...
pj892031 opened this issue Feb 2, 2022 · 5 comments · Fixed by #2221
Closed
Tracked by #1545 ...

zowe plugins validate returns always RC=0 #1299

pj892031 opened this issue Feb 2, 2022 · 5 comments · Fixed by #2221
Assignees
Labels
bug Something isn't working community-upvoted good first issue Good for newcomers priority-medium Not functioning - next quarter if capacity permits

Comments

@pj892031
Copy link

pj892031 commented Feb 2, 2022

It is not possible to use the command zowe plugins validate to verify if the plugin is properly installed because the return code is always 0.

Example:

$ zowe plugins validate @zowe/zos-ftp-for-zowe-cli

_____ Validation results for plugin '@zowe/zos-ftp-for-zowe-cli' _____
This plugin was successfully validated. Enjoy the plugin.

$ echo $?
0

$ zowe plugins validate @zowe/zos-ftp-for-zowe-clix
The specified plugin '@zowe/zos-ftp-for-zowe-clix' has not been installed into your CLI application.

$ echo $?
0

@pj892031 pj892031 changed the title zowe plugins validate returns allways RC=0 zowe plugins validate returns always RC=0 Feb 2, 2022
@awharn
Copy link
Member

awharn commented Feb 2, 2022

Since CLI version 6.33.0, the zowe plugins validate command has the option --fail-on-error that, if specified on the command, will set the return code to 1 if validation fails due to an error. The same version also introduced the option --fail-on-warning, which sets the return code if plugin validation issues a warning, but the plugin commands are still available.

The --fail-on-error option will become enabled by default in V2-LTS, but as it was considered to be a potential breaking change, it remains disabled by default in V1-LTS.

@plavjanik
Copy link

The problem occurs when you install new plug-ins. Even if the validation of the plugin fails, it is considered a success. And then it fails later.

Example:

  1. Installation of a corrupted plugin is "successful"
result: {'success': True, 'exitCode': 0, 'message': '', 'stdout': "Plug-ins within the Imperative CLI Framework can legitimately gain\ncontrol of the zowe CLI application during the execution of every command.\nInstall 3rd party plug-ins at your own risk.\n\nImperative's plugin installation program handles @zowe peer dependencies.\nYou can safely ignore NPM warnings about missing @zowe peer dependencies.\n\nRegistry = https://registry.npmjs.org/\n\n_______________________________________________________________\nInstalled plugin name = '@zowe/ansible-collection-generator'\n\n_____ Validation results for plugin '@zowe/ansible-collection-generator' _____\n\n*** CmdError: Unable to load the following module for plug-in '@zowe/ansible-collection-generator' :\n/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/plugins/installed/lib/node_modules/@zowe/ansible-collection-generator/lib/imperative.js\nReason = Cannot find module '/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/plugins/installed/lib/node_modules/@zowe/ansible-collection-generator/lib/imperative.js'\nRequire stack:\n- /private/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/imperative/src/plugins/PluginManagementFacility.js\n- /private/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/imperative/src/Imperative.js\n- /private/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/imperative/index.js\n- /private/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/node_modules/@zowe/cli/node_modules/@zowe/imperative/lib/index.js\n- /private/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/node_modules/@zowe/cli/lib/main.js\n\n*** CfgError: Failed to load the plugin's configuration from:\n/var/folders/n4/j9nxgl097ksb040nsvgqk50h0000gn/T/tmpzutg1gs8/plugins/installed/lib/node_modules/@zowe/ansible-collection-generator/package.json\nReason = Cannot create property 'name' on string '{}'\n\nThis plugin has configuration errors. No component of the plugin will be available.\n\n\n", 'stderr': '', 'data': {}}
  1. Using the command fails with:
Command failed due to improper syntax
Unknown group: ...

There is a fine line between fixing bugs and breaking changes. Fixing a bug can be seen as a change in the expected behavior for someone else. In the case of the reported problem, it seems that fixing the bug is better - the script fails anyone and it is better to fail earlier. But I do not know all other cases.

The zowe plugins install does not --fail-on-error option. Such option would be useful too.

@ATorrise ATorrise added the bug Something isn't working label Sep 1, 2022
@gejohnston gejohnston added for-review To be reviewed in an Eng & Prod Mgmt meeting priority-medium Not functioning - next quarter if capacity permits labels Oct 18, 2022
@zFernand0 zFernand0 added good first issue Good for newcomers and removed for-review To be reviewed in an Eng & Prod Mgmt meeting labels Dec 21, 2022
@t1m0thyj
Copy link
Member

t1m0thyj commented Mar 8, 2023

The suggested fix here is to make --fail-on-error the default behavior in the "zowe-v1-lts" branch.

@AmandaDErrico This issue could be a good one to pick up if you're looking for a CLI issue to work on 🙂

@JTonda
Copy link

JTonda commented Apr 22, 2024

Need to test if this is already completed.

@jace-roell jace-roell self-assigned this Aug 6, 2024
@jace-roell jace-roell linked a pull request Aug 7, 2024 that will close this issue
4 tasks
@jace-roell jace-roell removed a link to a pull request Aug 7, 2024
4 tasks
@jace-roell jace-roell linked a pull request Aug 9, 2024 that will close this issue
4 tasks
@github-project-automation github-project-automation bot moved this from Medium Priority to Closed in Zowe CLI Squad Aug 26, 2024
@adam-wolfe
Copy link
Contributor

Fix implemented in V1 (@zowe/[email protected]). The zowe plugins validate command will fail on error by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community-upvoted good first issue Good for newcomers priority-medium Not functioning - next quarter if capacity permits
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

10 participants