Skip to content

configmgr validate: move JSON debug message to trace level > 0#553

Open
Martin-Zeithaml wants to merge 21 commits into
v3.x/stagingfrom
v3.x/feature/validateDebug
Open

configmgr validate: move JSON debug message to trace level > 0#553
Martin-Zeithaml wants to merge 21 commits into
v3.x/stagingfrom
v3.x/feature/validateDebug

Conversation

@Martin-Zeithaml

@Martin-Zeithaml Martin-Zeithaml commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

No trace, no debug info (#551)

  • Test script placed in zowe-common-c/bin expecting binary configmgr
  • zowe.yaml defined with zowe.setup.dataset.prefix='1HELLO.WORLD'
#!/bin/sh

schemas="../tests/configmgr/validate/schema/zowe-yaml-schema.json:../tests/configmgr/validate/schema/server-common.json"

for t in 0 1; do
    _CEE_RUNOPTS="XPLINK(ON)" ./configmgr -t "${t}" -s "${schemas}" -p "FILE(zowe.yaml)" validate
    echo "\n===========================================================\n"
done
validate status = 4
Validity Exceptions:
Validity Exceptions(s) with object at
  Validity Exceptions(s) with object at /zowe
    Validity Exceptions(s) with object at /zowe/setup
      Validity Exceptions(s) with object at /zowe/setup/dataset
        Schema at '/zowe/setup/dataset/prefix' invalid
          not oneOf schemas at '/zowe/setup/dataset/prefix' are valid, 0 are
            Validity Exceptions(s) with string at /zowe/setup/dataset/prefix
              string pattern match fail s='1HELLO.WORLD', pat='^([A-Z\$\#\@]){1}([A-Z0-9\$\#\@\-]){0,7}(\.([A-Z\$\#\@]){1}([A-Z0-9\$\#\@\-]){0,7}){0,11}$', at /zowe/setup/dataset/prefix
            Validity Exceptions(s) with string at /zowe/setup/dataset/prefix
              string too long (len=12) '1HELLO.WORLD' 12 > MAX=0 at /zowe/setup/dataset/prefix

===========================================================

ConfigMgr tracelevel set to 1
before file info
before jsonParseFile info
{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://zowe.org/schemas/v2/server-base",
  "title": "Zowe configuration file",
  "description": "Configuration file for Zowe (zowe.org) version 2.",

...

                        summing validity all=VC, any=VC, one=IS, not=VC simple=VC -> combined=IS
                  summing validity all=VC, any=VC, one=VC, not=VC simple=IS -> combined=IS
            summing validity all=VC, any=VC, one=VC, not=VC simple=IS -> combined=IS
      summing validity all=VC, any=VC, one=VC, not=VC simple=IS -> combined=IS
summing validity all=VC, any=VC, one=VC, not=VC simple=IS -> combined=IS
validate status = 4
Validity Exceptions:
Validity Exceptions(s) with object at
  Validity Exceptions(s) with object at /zowe
    Validity Exceptions(s) with object at /zowe/setup
      Validity Exceptions(s) with object at /zowe/setup/dataset
        Schema at '/zowe/setup/dataset/prefix' invalid
          not oneOf schemas at '/zowe/setup/dataset/prefix' are valid, 0 are
            Validity Exceptions(s) with string at /zowe/setup/dataset/prefix
              string pattern match fail s='1HELLO.WORLD', pat='^([A-Z\$\#\@]){1}([A-Z0-9\$\#\@\-]){0,7}(\.([A-Z\$\#\@]){1}([A-Z0-9\$\#\@\-]){0,7}){0,11}$', at /zowe/setup/dataset/prefix
            Validity Exceptions(s) with string at /zowe/setup/dataset/prefix
              string too long (len=12) '1HELLO.WORLD' 12 > MAX=0 at /zowe/setup/dataset/prefix

ABEND (#552)

  • getStringOption returns NULL if string is empty
  • getStringOption replaced with with getSwitch in two cases
  • addPathElement and cfgLoadSchemas prints error if input file name is empty
  • Simple test added to zowe-common-c/tests/configmgr/validate/index.sh to test basic functionality:
    • Test 1-5 - missing parameters or empty or invalid input files
      • No Abend
    • Test 6+ - basic test
*** configmgr -s() -p() validate
  OK, got and expected 5

*** configmgr -s() -p(Config) validate
  OK, got and expected 5

*** configmgr -s(Schema) -p() validate
  OK, got and expected 4

*** configmgr -s(./schema/empty.json) -p(./yaml/empty.yaml) validate
  OK, got and expected 5

*** configmgr -s(./schema/invalid.json) -p(./yaml/valid.0.yaml) validate
  OK, got and expected 5

*** configmgr -s(./schema/zowe-yaml-schema.json:./schema/server-common.json) -p(./yaml/empty.7.yaml) validate
  OK, got and expected 7

*** configmgr -s(./schema/zowe-yaml-schema.json:./schema/server-common.json) -p(./yaml/invalid_ds_prefix.99.yaml) validate
  OK, got and expected 99

*** configmgr -s(./schema/zowe-yaml-schema.json:./schema/server-common.json) -p(./yaml/valid.0.yaml) validate
  OK, got and expected 0

Note

The argument reader has a room for improvement, for example the same parameters are silently treated as "the last is the winner":

# Validates zowe.yaml
./configmgr -s "${schemas}" -p "C:\Users\WillyWonka\Desktop\SecretChocolateRecipe.yaml" 
                            -p "FILE(zowe.yaml)" validate

Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Martin-Zeithaml and others added 5 commits September 8, 2025 13:18
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
Signed-off-by: Martin Zeithaml <Martin.Zeithaml@broadcom.com>
@Martin-Zeithaml
Martin-Zeithaml marked this pull request as ready for review September 10, 2025 09:13
JoeNemo
JoeNemo previously approved these changes Sep 10, 2025

@JoeNemo JoeNemo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@github-actions github-actions Bot added the stale-reopen-if-needed An issue closed due to inactivity. No indication of completion or validity. label Mar 9, 2026
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@github-actions github-actions Bot removed the stale-reopen-if-needed An issue closed due to inactivity. No indication of completion or validity. label Mar 11, 2026
Signed-off-by: Martin Zeithaml <66114686+Martin-Zeithaml@users.noreply.github.com>
Signed-off-by: Martin Zeithaml <66114686+Martin-Zeithaml@users.noreply.github.com>
JoeNemo
JoeNemo previously approved these changes Jun 17, 2026

@JoeNemo JoeNemo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants