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

Fix CICS connections breaking other ZE sessions #173

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ root = true

[*]
indent_style = space
indent_size = 4
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
Expand Down
3 changes: 3 additions & 0 deletions packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

All notable changes to the "cics-extension-for-zowe" extension will be documented in this file.

## Recent Changes

- BugFix: Opening CICS connections prevents other Zowe sessions connecting. [#159](https://github.com/zowe/cics-for-zowe-client/issues/159)

## `3.1.1`

Expand Down
10 changes: 2 additions & 8 deletions packages/vsce/src/commands/closeLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
import { CICSTree } from "../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSLocalFileTreeItem } from "../trees/treeItems/CICSLocalFileTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
Expand Down Expand Up @@ -52,8 +51,6 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await closeLocalFile(
currentNode.parentRegion.parentSession.session,
Expand All @@ -64,20 +61,17 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>
},
busyDecision
);
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error.mMessage) {
// @ts-ignore
const [_, resp2, respAlt, eibfnAlt] = splitCmciErrorMessage(error.mMessage);

window.showErrorMessage(
`Perform CLOSE on local file "${
allSelectedNodes[parseInt(index)].localFile.file
`Perform CLOSE on local file "${allSelectedNodes[parseInt(index)].localFile.file
}" failed: EXEC CICS command (${eibfnAlt}) RESP(${respAlt}) RESP2(${resp2})`
);
} else {
Expand Down Expand Up @@ -124,7 +118,7 @@ export function getCloseLocalFileCommand(tree: CICSTree, treeview: TreeView<any>

async function closeLocalFile(
session: imperative.AbstractSession,
parms: { name: string; regionName: string; cicsPlex: string },
parms: { name: string; regionName: string; cicsPlex: string; },
busyDecision: string
): Promise<ICMCIApiResponse> {
const requestBody: any = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<an
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await disableLocalFile(
currentNode.parentRegion.parentSession.session,
Expand All @@ -64,12 +62,10 @@ export function getDisableLocalFileCommand(tree: CICSTree, treeview: TreeView<an
},
busyDecision
);
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
window.showErrorMessage(
`Something went wrong when performing a DISABLE - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(
/(\\n\t|\\n|\\t)/gm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,17 @@ export function getDisableProgramCommand(tree: CICSTree, treeview: TreeView<any>
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await disableProgram(currentNode.parentRegion.parentSession.session, {
name: currentNode.program.program,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
window.showErrorMessage(
`Something went wrong when performing a disable - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,17 @@ export function getDisableTransactionCommand(tree: CICSTree, treeview: TreeView<
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await disableTransaction(currentNode.parentRegion.parentSession.session, {
name: currentNode.transaction.tranid,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error.mMessage) {
// @ts-ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,17 @@ export function getEnableLocalFileCommand(tree: CICSTree, treeview: TreeView<any
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await enableLocalFile(currentNode.parentRegion.parentSession.session, {
name: currentNode.localFile.file,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
window.showErrorMessage(
`Something went wrong when performing an ENABLE - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(
/(\\n\t|\\n|\\t)/gm,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
import { CICSTree } from "../../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { CICSProgramTreeItem } from "../../trees/treeItems/CICSProgramTreeItem";
import { findSelectedNodes } from "../../utils/commandUtils";
Expand Down Expand Up @@ -50,20 +49,16 @@ export function getEnableProgramCommand(tree: CICSTree, treeview: TreeView<any>)
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await enableProgram(currentNode.parentRegion.parentSession.session, {
name: currentNode.program.program,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
window.showErrorMessage(
`Something went wrong when performing an ENABLE - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(
/(\\n\t|\\n|\\t)/gm,
Expand Down Expand Up @@ -104,7 +99,7 @@ export function getEnableProgramCommand(tree: CICSTree, treeview: TreeView<any>)
});
}

async function enableProgram(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string }): Promise<ICMCIApiResponse> {
async function enableProgram(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../../trees/CICSRegionTree";
import { CICSTree } from "../../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../../trees/CICSRegionsContainer";
import { findSelectedNodes } from "../../utils/commandUtils";
import { CICSTransactionTreeItem } from "../../trees/treeItems/CICSTransactionTreeItem";
Expand Down Expand Up @@ -46,20 +45,17 @@ export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<a
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await enableTransaction(currentNode.parentRegion.parentSession.session, {
name: currentNode.transaction.tranid,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
window.showErrorMessage(
`Something went wrong when performing an ENABLE - ${JSON.stringify(error, Object.getOwnPropertyNames(error)).replace(
/(\\n\t|\\n|\\t)/gm,
Expand Down Expand Up @@ -99,7 +95,7 @@ export function getEnableTransactionCommand(tree: CICSTree, treeview: TreeView<a
});
}

async function enableTransaction(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string }): Promise<ICMCIApiResponse> {
async function enableTransaction(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
8 changes: 1 addition & 7 deletions packages/vsce/src/commands/newCopyCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { programNewcopy } from "@zowe/cics-for-zowe-sdk";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
import { CICSTree } from "../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSProgramTreeItem } from "../trees/treeItems/CICSProgramTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
Expand Down Expand Up @@ -49,28 +48,23 @@ export function getNewCopyCommand(tree: CICSTree, treeview: TreeView<any>) {
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await programNewcopy(currentNode.parentRegion.parentSession.session, {
name: currentNode.program.program,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
// CMCI new copy error
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error.mMessage) {
// @ts-ignore
const [_, resp2, respAlt, eibfnAlt] = splitCmciErrorMessage(error.mMessage);
window.showErrorMessage(
`Perform NEWCOPY on Program "${
allSelectedNodes[parseInt(index)].program.program
`Perform NEWCOPY on Program "${allSelectedNodes[parseInt(index)].program.program
}" failed: EXEC CICS command (${eibfnAlt}) RESP(${respAlt}) RESP2(${resp2})`
);
} else {
Expand Down
10 changes: 2 additions & 8 deletions packages/vsce/src/commands/openLocalFileCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
import { CICSTree } from "../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSLocalFileTreeItem } from "../trees/treeItems/CICSLocalFileTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
Expand Down Expand Up @@ -45,27 +44,22 @@ export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>)
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await openLocalFile(currentNode.parentRegion.parentSession.session, {
name: currentNode.localFile.file,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;
if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error.mMessage) {
// @ts-ignore
const [_, resp2, respAlt, eibfnAlt] = splitCmciErrorMessage(error.mMessage);
window.showErrorMessage(
`Perform OPEN on local file "${
allSelectedNodes[parseInt(index)].localFile.file
`Perform OPEN on local file "${allSelectedNodes[parseInt(index)].localFile.file
}" failed: EXEC CICS command (${eibfnAlt}) RESP(${respAlt}) RESP2(${resp2})`
);
} else {
Expand Down Expand Up @@ -109,7 +103,7 @@ export function getOpenLocalFileCommand(tree: CICSTree, treeview: TreeView<any>)
});
}

async function openLocalFile(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string }): Promise<ICMCIApiResponse> {
async function openLocalFile(session: imperative.AbstractSession, parms: { name: string; regionName: string; cicsPlex: string; }): Promise<ICMCIApiResponse> {
const requestBody: any = {
request: {
action: {
Expand Down
10 changes: 2 additions & 8 deletions packages/vsce/src/commands/phaseInCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { imperative } from "@zowe/zowe-explorer-api";
import { commands, ProgressLocation, TreeView, window } from "vscode";
import { CICSRegionTree } from "../trees/CICSRegionTree";
import { CICSTree } from "../trees/CICSTree";
import * as https from "https";
import { CICSRegionsContainer } from "../trees/CICSRegionsContainer";
import { CICSProgramTreeItem } from "../trees/treeItems/CICSProgramTreeItem";
import { findSelectedNodes, splitCmciErrorMessage } from "../utils/commandUtils";
Expand Down Expand Up @@ -50,28 +49,23 @@ export function getPhaseInCommand(tree: CICSTree, treeview: TreeView<any>) {
});
const currentNode = allSelectedNodes[parseInt(index)];

https.globalAgent.options.rejectUnauthorized = currentNode.parentRegion.parentSession.session.ISession.rejectUnauthorized;

try {
await performPhaseIn(currentNode.parentRegion.parentSession.session, {
name: currentNode.program.program,
regionName: currentNode.parentRegion.label,
cicsPlex: currentNode.parentRegion.parentPlex ? currentNode.parentRegion.parentPlex.getPlexName() : undefined,
});
https.globalAgent.options.rejectUnauthorized = undefined;

if (!parentRegions.includes(currentNode.parentRegion)) {
parentRegions.push(currentNode.parentRegion);
}
} catch (error) {
https.globalAgent.options.rejectUnauthorized = undefined;
// @ts-ignore
if (error.mMessage) {
// @ts-ignore
const [_, resp2, respAlt, eibfnAlt] = splitCmciErrorMessage(error.mMessage);
window.showErrorMessage(
`Perform PHASEIN on Program "${
allSelectedNodes[parseInt(index)].program.program
`Perform PHASEIN on Program "${allSelectedNodes[parseInt(index)].program.program
}" failed: EXEC CICS command (${eibfnAlt}) RESP(${respAlt}) RESP2(${resp2})`
);
} else {
Expand Down Expand Up @@ -116,7 +110,7 @@ export function getPhaseInCommand(tree: CICSTree, treeview: TreeView<any>) {
});
}

async function performPhaseIn(session: imperative.AbstractSession, parms: { cicsPlex: string | null; regionName: string; name: string }) {
async function performPhaseIn(session: imperative.AbstractSession, parms: { cicsPlex: string | null; regionName: string; name: string; }) {
const requestBody: any = {
request: {
action: {
Expand Down
Loading
Loading