IBM / zowe-cli-cics-deploy-plugin

Provides the cics-deploy plug-in for Zowe CLI https://github.com/zowe/zowe-cli to deploy Node.js and other applications from a workstation to IBM CICS Transaction Server within a CICS bundle. Documentation is available at https://ibm.github.io/zowe-cli-cics-deploy-plugin/
Eclipse Public License 2.0
13 stars 12 forks source link

cics-deploy command with missing parameters shows profile error instead of help #56

Closed markcocker closed 5 years ago

markcocker commented 5 years ago

zowe zos-files list data-set shows extensive help about all the missing and optional parameters:

zowe zos-files list data-set

Syntax Error:
Missing Positional Argument: dataSetName
Argument Description: The name or pattern of the data set that you want to list

Syntax Error:
Missing Required Option:
--host (-H)

Option Description:
The z/OSMF server host name.

Syntax Error:
Missing Required Option:
--user (-u)

Option Description:
Mainframe (z/OSMF) user name, which can be the same as your TSO login.

Syntax Error:
Missing Required Option:
--password (--pass,--pw)

Option Description:
Mainframe (z/OSMF) password, which can be the same as your TSO password.

Example:

 - Show the data set "ibmuser.asm":

      $ bright zos-files list data-set "ibmuser.asm"

Use "bright zos-files list data-set --help" to view command description, usage, and options.

It would be useful if zowe cics-deploy deploy bundle showed similar help, rather than an error for a missing profile:


zowe cics-deploy deploy bundle
Command Preparation Failed:
No default profile set for type "zosmf".```
pcoop commented 5 years ago

We only have a certain amount of influence over Imperative's error messages. There's an argument to be made for removing most of the command line validation from Zowe and instead validating the constraints within our code, that allows us to offer better error messages; but it would seem wrong to do that. Zowe/Imperative clearly intend for us to use their built in validation, Imperative gets to decide the relative priority of the different error messages that it issues.

In this instance the --help switch was omitted, so Imperative isn't expecting to have to issue any help text; you also omitted both the mandatory parameters and also the mandatory profile. Imperative decided to complain about the profile. It could have complained about the parameters too, or the parameters first, but it didn't; we could raise an issue against them requesting that they change this.

We could decide that the zOSMF profile isn't mandatory, and instead mark it as optional. But if we do that we either need to add all the zOSMF parameters to our externals (so that they can be set individually on the command line), or implement a hard requirement on the profile even though the generated command line help will clearly state that it's optional. Neither option is perfect.

Incidentally, the command line help in the OP isn't "extensive help about all the missing and optional parameters", it's only reporting the required parameters that are missing. If you want the full command line help then you'll have to set --help on that command too... it'll offer a lot more information.

pcoop commented 5 years ago

If we consider the push bundle scenario then it's unlikely that we can do anything about this. Push requires three profiles: cics-deploy, SSH and zOSMF; we may add a 4th for CMCI. Many of those profiles have overlapping attributes, in some cases the content has to be different for each context, notably the --port parameter. If we make the profiles optional then we'll have a clash as only one --port can be set on the command line. We have to make the profiles mandatory, that way we can get the correct port for each context.

Many of the command line parameters for Zowe commands are not actually entered on the command line, they're instead derived from the profiles; Imperative has to read the profiles before it can know whether the mandatory parameters are set or not... so it really does have to issue error messages about missing required profiles before it issues them for missing parameters.

I don't think it's possible to do what this Issue is asking. We have to make the profiles mandatory, and Imperative has to issue errors about them before it can do detect any other errors.

The user can of course issue --help at any time to get the full command line help.

markcocker commented 5 years ago

Based on the above, I'm happy to close this.