-
Notifications
You must be signed in to change notification settings - Fork 54
Add "zwe validate port bind" and "zwe validate config" #4447
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
Open
1000TurquoisePogs
wants to merge
19
commits into
v3.x/staging
Choose a base branch
from
feature/v3/validate-bind
base: v3.x/staging
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
87768c8
Add zwe validate config and zwe validate bind commands, and use zwe v…
1000TurquoisePogs d2d7eaa
Cleanup startup and add opt-out
1000TurquoisePogs fd915e1
Compile fixes and example fixes
1000TurquoisePogs 988ce12
fix compilation errors, fix schema errors, tiny test for alias
MarkAckert 962241b
restore lost `additionalProperties`
MarkAckert fbd95c3
Fix CLI path and add print of component quantity
1000TurquoisePogs 4427e27
Merge branch 'v3.x/staging' into feature/v3/validate-bind
1000TurquoisePogs 26e3fda
use bind-test pr
1000TurquoisePogs 9b0f87d
Merge branch 'v3.x/staging' into feature/v3/validate-bind
1000TurquoisePogs d1bfa9d
return manifest.json.template to normal branches
1000TurquoisePogs d2e3b3a
Merge branch 'v3.x/staging' into feature/v3/validate-bind
1000TurquoisePogs 0380b15
Merge branch 'v3.x/staging' into feature/v3/validate-bind
MarkAckert d5ccb72
Merge branch 'v3.x/staging' into feature/v3/validate-bind
MarkAckert 0e859af
Change bind-test output to debug, unless error seen. Add debug messag…
1000TurquoisePogs 9111188
Added more debug info. Changed validator schema to have 3 options: do…
1000TurquoisePogs e274fd7
Add check on how to disable if needed
1000TurquoisePogs 406489b
COrrected property name
1000TurquoisePogs 0b014aa
Merge branch 'v3.x/staging' into feature/v3/validate-bind
MarkAckert 729232a
update startupChecks field names, update logic for reading startupChe…
MarkAckert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| Runs schema validation upon given zowe yaml configuration files. | ||
| This command can be used to prove that the zowe configuration is good before starting zowe. | ||
| It requires that zowe.useConfigmgr=true or --configmgr are set. | ||
| This command can optionally validate enabled components or all components, but otherwise would only validate the zowe core configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| ZWEL0141E|141|User %s does not have write permission on %s. | ||
| ZWEL0302W||You are running the Zowe process under user id IZUSVR. This is not recommended and may impact your z/OS MF server negatively. | ||
| ZWEL0317E||Component %s commands.configure ended with rc=%s. | ||
| ZWEL0317E||Component %s commands.configure ended with rc=%s. | ||
| ZWEL0323E||Certificate validation failed. Fix errors listed before starting Zowe. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| zwe validate config -c /path/to/zowe.yaml | ||
| zwe validate config -c FILE(/customizations/zowe.yaml):FILE(/defaults/zowe.yaml) --all | ||
| zwe validate config -c 'FILE(/path/to/zowe.yaml):PARMLIB(ZOWE.PARMLIB(YAML))' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Runs schema validation upon given zowe yaml configuration files. | ||
| This command can be used to prove that the zowe configuration is good before starting zowe. | ||
| This command can optionally validate enabled components or all components, but otherwise would only validate the zowe core configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| components||boolean|||||Turns on validation for enabled components. | ||
| all||boolean|||||Turns on validation for all components, even disabled ones. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| This program and the accompanying materials are made available | ||
| under the terms of the Eclipse Public License v2.0 which | ||
| accompanies this distribution, and is available at | ||
| https://www.eclipse.org/legal/epl-v20.html | ||
|
|
||
| SPDX-License-Identifier: EPL-2.0 | ||
|
|
||
| Copyright Contributors to the Zowe Project. | ||
| */ | ||
| import * as std from 'cm_std'; | ||
| import * as index from '../../config/validate/index'; | ||
| import * as configmgr from '../../../libs/configmgr'; | ||
|
|
||
| index.execute(std.getenv('ZWE_CLI_PARAMETER_CONFIG'), std.getenv('ZWE_CLI_PARAMETER_COMPONENTS')=='true', std.getenv('ZWE_CLI_PARAMETER_ALL')!='true'); | ||
|
|
||
| configmgr.cleanupTempDir(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/sh | ||
|
|
||
| ####################################################################### | ||
| # This program and the accompanying materials are made available | ||
| # under the terms of the Eclipse Public License v2.0 which | ||
| # accompanies this distribution, and is available at | ||
| # https://www.eclipse.org/legal/epl-v20.html | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 | ||
| # | ||
| # Copyright Contributors to the Zowe Project. | ||
| ####################################################################### | ||
|
|
||
| if [ -z "${ZWE_PRIVATE_TMP_MERGED_YAML_DIR}" ]; then | ||
| # user-facing command, use tmpdir to not mess up workspace permissions | ||
| export ZWE_PRIVATE_TMP_MERGED_YAML_DIR=1 | ||
| fi | ||
| _CEE_RUNOPTS="XPLINK(ON),HEAPPOOLS(OFF),HEAPPOOLS64(OFF)" ${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr -script "${ZWE_zowe_runtimeDirectory}/bin/commands/validate/config/cli.js" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| zwe validate port bind -c /path/to/zowe.yaml | ||
| zwe validate port bind -c FILE(/customizations/zowe.yaml):FILE(/defaults/zowe.yaml) -o componentName | ||
| zwe validate port bind -c 'FILE(/path/to/zowe.yaml):PARMLIB(ZOWE.PARMLIB(YAML))' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Checks to see if the network ports requested for use by enabled Zowe components are already occupied. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| component-name,component|o|string|||||Component name to be checked. If not provided, all enabled components are checked. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| /* | ||
| This program and the accompanying materials are made available | ||
| under the terms of the Eclipse Public License v2.0 which | ||
| accompanies this distribution, and is available at | ||
| https://www.eclipse.org/legal/epl-v20.html | ||
|
|
||
| SPDX-License-Identifier: EPL-2.0 | ||
|
|
||
| Copyright Contributors to the Zowe Project. | ||
| */ | ||
| import * as std from 'cm_std'; | ||
| import * as index from './index'; | ||
| import * as configmgr from '../../../../libs/configmgr'; | ||
|
|
||
| index.execute(std.getenv("ZWE_CLI_PARAMETER_COMPONENT_NAME")); | ||
|
|
||
| configmgr.cleanupTempDir(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/sh | ||
|
|
||
| ####################################################################### | ||
| # This program and the accompanying materials are made available | ||
| # under the terms of the Eclipse Public License v2.0 which | ||
| # accompanies this distribution, and is available at | ||
| # https://www.eclipse.org/legal/epl-v20.html | ||
| # | ||
| # SPDX-License-Identifier: EPL-2.0 | ||
| # | ||
| # Copyright Contributors to the Zowe Project. | ||
| ####################################################################### | ||
|
|
||
| if [ -z "${ZWE_PRIVATE_TMP_MERGED_YAML_DIR}" ]; then | ||
| # user-facing command, use tmpdir to not mess up workspace permissions | ||
| export ZWE_PRIVATE_TMP_MERGED_YAML_DIR=1 | ||
| fi | ||
| _CEE_RUNOPTS="XPLINK(ON),HEAPPOOLS(OFF),HEAPPOOLS64(OFF)" ${ZWE_zowe_runtimeDirectory}/bin/utils/configmgr -script "${ZWE_zowe_runtimeDirectory}/bin/commands/validate/port/available/cli.js" | ||
1000TurquoisePogs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| This program and the accompanying materials are made available | ||
| under the terms of the Eclipse Public License v2.0 which | ||
| accompanies this distribution, and is available at | ||
| https://www.eclipse.org/legal/epl-v20.html | ||
|
|
||
| SPDX-License-Identifier: EPL-2.0 | ||
|
|
||
| Copyright Contributors to the Zowe Project. | ||
| */ | ||
|
|
||
| import * as std from 'cm_std'; | ||
| import * as common from '../../../../libs/common'; | ||
| import * as config from '../../../../libs/config'; | ||
| import * as component from '../../../../libs/component'; | ||
| import * as shell from '../../../../libs/shell'; | ||
|
|
||
| export function execute(quitOnError?: boolean, componentName?: string) { | ||
| let enabledComponents = componentName ? [componentName] : component.getEnabledComponents(); | ||
| let hasErrors = false; | ||
| const ZOWE_CONFIG=config.getZoweConfig(); | ||
| let bindUtilPath = ZOWE_CONFIG.zowe.runtimeDirectory; | ||
| if (!bindUtilPath.endsWith('/')) { | ||
| bindUtilPath+='/'; | ||
| } | ||
| bindUtilPath+='bin/utils/bind-test'; | ||
|
|
||
| let myJobname = std.getenv('_BPX_JOBNAME'); | ||
|
|
||
|
|
||
| for (let i = 0; i < enabledComponents.length; i++) { | ||
| let componentName = enabledComponents[i]; | ||
| let port = ZOWE_CONFIG.components[componentName].port; | ||
| if (isComponentInAPIMLModulith(componentName)) { | ||
| if (componentName == 'gateway' && !port) { | ||
| port = ZOWE_CONFIG.components.apiml.port; | ||
| } else if (compopnentName != 'discovery') { | ||
| continue; | ||
| } | ||
| } | ||
|
|
||
| if (port) { | ||
| let componentManifest: any; | ||
| const componentDir = component.findComponentDirectory(componentName); | ||
| if (componentDir) { | ||
| componentManifest = component.getManifest(componentDir); | ||
| } | ||
| let jobname = component.getJobnameForComponent(componentName, componentManifest); | ||
|
|
||
|
|
||
|
|
||
| let listenAddress = '0.0.0.0'; | ||
| if (ZOWE_CONFIG.components[componentName].zowe?.network?.server?.listenAddresses) { | ||
| listenAddress = ZOWE_CONFIG.components[componentName].zowe.network.server.listenAddresses[0]; | ||
| } else if (ZOWE_CONFIG.zowe?.network?.server?.listenAddresses) { | ||
| listenAddress = ZOWE_CONFIG.zowe.network.server.listenAddresses[0]; | ||
| } | ||
|
|
||
| //TODO this only works on z/OS, but configmgr also only works on z/OS, so at this time the limitation has not been exposed. | ||
| if (jobname) { | ||
| std.setenv('_BPX_JOBNAME', jobname); | ||
| } | ||
| let result = shell.execSync(bindUtilPath, '--host', listenAddress, '--port', port); | ||
| if (jobname) { | ||
| //restore | ||
| std.setenv('_BPX_JOBNAME', myJobname); | ||
| } | ||
| if (result.rc) { | ||
| common.printFormattedError(`ZWELS`, `zwe-validate-port-available`, `${componentName} port ${port} not available or command failed.`); | ||
| hasErrors = true; | ||
| } | ||
|
|
||
| } | ||
| } | ||
| if (!hasErrors) { | ||
| common.printFormattedInfo(`ZWELS`, `zwe-validate-port-available`, `Zowe port bind validation passed.`); | ||
| } else if (!quitOnError) { | ||
| common.printFormattedError(`ZWELS`, `zwe-validate-port-available`, `Zowe port bind validation failed, review output for action items before running Zowe.`); | ||
| } else { | ||
| common.printErrorAndExit(`Zowe port bind validation failed, review output for action items before running Zowe.`, null, 8); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.