zowe / zowe-install-packaging

Packaging repository for the Zowe install scripts and files
Eclipse Public License 2.0
27 stars 52 forks source link

zwe config validate fails with garbled output #3554

Open johnottogood opened 1 year ago

johnottogood commented 1 year ago

Describe the bug When I run zwe config validate, I (usually) get mixed text and unprintable characters.

To Reproduce When using Zowe zwe, I usually source a node environment file as well as zowe environment file, show below

/u/jgood> cat /etc/profile.node
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="$_CEE_RUNOPTS FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
export _TAG_REDIR_IN=txt
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_OUT=txt
export PATH="/shared/node/node-v16.13.2-os390-s390x-202202071007/bin:$PATH"
export npm_config_nodedir="/shared/node/node-v16.13.2-os390-s390x-202202071007"
export npm_config_zoslib_include_dir="/shared/node/node-v16.13.2-os390-s390x-202202071007/include/node/zoslib"

/u/jgood> cat /etc/profile.zowe
# profile for running zowe located under /shared/zowe and config under /global/zowe
export ZWE_CLI_PARAMETER_CONFIG=/global/zowe/zowe.yaml
export PATH=$PATH:/shared/zowe/bin
/u/jgood> echo $SHELL
/bin/sh

Expected behavior Expect an indication of offending configuration item(s) or an indication that the configuration is valid.

Screenshots Running zwe config validate produces the issue:

/u/jgood> zwe config validate
WARNING, yaml read failed, errorBuffer='YAML scanner error: _/▒▒▒>ŀ▒/%▒▒ˀ/▒▒>?Ȁ/%%?▒▒▒▒>▒▒▒▒ˀ▒?>▒▒▒▒ at line 37, column 16'
WARNING, yaml read failed, errorBuffer='▒▒▒▒@▒▒▒▒▒
▒@
▒▒▒▒z@mapping values are not allowed in this context@▒▒@▒▒▒
@▒▒k@▒▒▒▒▒▒@▒▒'
top json is not an object
Error: Could not load config for FILE(/global/zowe/zowe.yaml), status=2

Desktop (please complete the following information): Software: z/OS 2.4 SHELL is /bin/sh (have also tried bash 4.2.53) Node v16.13.2 Zowe 2.9 and Zowe 2.10

Additional context To see how bash behaves, I've started bash, sourced the node and profile env files, and then started a 2nd bash (Rocket folks suggest this is required to get proper autocvt support in bash) and run zwe config validate. Same issue

/u/jgood> bash
/u/jgood> . /etc/profile.node
/u/jgood> . /etc/profile.zowe
/u/jgood> bash
/u/jgood> zwe config validate
WARNING, yaml read failed, errorBuffer='YAML scanner error: _/▒▒▒>ŀ▒/%▒▒ˀ/▒▒>?Ȁ/%%?▒▒▒▒>▒▒▒▒ˀ▒?>▒▒▒▒ at line 37, column 16'
WARNING, yaml read failed, errorBuffer='▒▒▒▒@▒▒▒▒▒
▒@
▒▒▒▒z@mapping values are not allowed in this context@▒▒@▒▒▒
@▒▒k@▒▒▒▒▒▒@▒▒'
top json is not an object
Error: Could not load config for FILE(/global/zowe/zowe.yaml), status=2

Trying to verify proper node behavior. Under a clean ssh session using plain /bin/sh, I've also setup a simple node express "Hello world example" in ebcdic. I copied it to an ascii file (tagging the file as ISO8859-1 (text)

I can run node against the two version of the test application and both the EBCDIC and ASCII versions work, so it (seems) that node is handling code page tagging correctly.

I've only been able to get zwe config validate to work once for me. When it did, I also captured the output of "set" and "env" Their contents is the same as the output of "set" and "env" when the problem occurs.

Don't know what the issue could be.

johnottogood commented 1 year ago

I realized that I get garbled output when there is an error in the configuration file being validated.

Looking at just the top of a test yaml file, this would validated OK

zowe:

  setup:
    dataset:
      prefix: ZOWE200
      proclib: SYS1.PROCLIB
      parmlib: ZOWE200.CUST.PARMLIB

However if I add two leading spaces to "proclib: SY1.PROCLIB', zwe config validate generates the warning with garbled output.

zowe:

  setup:
    dataset:
      prefix: ZOWE200
        proclib: SYS1.PROCLIB
      parmlib: ZOWE200.CUST.PARMLIB
JoeNemo commented 1 year ago

@jordanfilteau1995 - I think you are working on a fix for this, right?

jordanfilteau1995 commented 1 year ago

Please see: https://github.com/zowe/zowe-common-c/pull/393. Hoping to merge soon. Reviewing with @ifakhrutdinov

jordanfilteau1995 commented 1 year ago

@johnottogood PR for this issue has been merged into staging. You will instead see something like this:

` ZWEL0318E - Couldn't parse file '/u/ts5873/git/sand/zss/deps/zowe-common-c/bin/test.yaml': while parsing a flow node at line 4, column 1, did not find expected node content at line 4, column 1.

ZWEL0319E - Failed to load configuration, element may be bad, or less likely a bad merge. `

johnottogood commented 1 year ago

Trying understand what the indicated new error message it telling me. Are empty lines stripped out of the parsed file, and which point its indicating there was a problem parsing line "prefix: ZOWE200" ?

JoeNemo commented 1 year ago

@johnottogood Do you have a build that is believed to fix the problem? Can you add what the output is now for comparison purposes?

johnottogood commented 1 year ago

No. I need to leave the current system at V2.9 as we will be using it it for hands-on labs.

FYI I saw this issue with 2.10 as well.