Skip to content

Commit 0e0acbc

Browse files
Merge pull request #251 from pcoop/branch1
Add zosmf cmd overrides for deploy/undeploy
2 parents bf1be19 + 1f3be4e commit 0e0acbc

File tree

8 files changed

+86
-16
lines changed

8 files changed

+86
-16
lines changed

__tests__/api/BundleDeploy/BundleDeployer.test.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const DEFAULT_PARAMTERS: IHandlerParameters = {
2323
},
2424
profiles: {
2525
get: (type: string) => {
26-
return {};
26+
return { host: "testname", user: "testuser", password: "testpwd" };
2727
}
2828
} as any,
2929
response: {
@@ -604,6 +604,12 @@ function setCommonParmsForUndeployTests(parms: IHandlerParameters) {
604604
parms.arguments.jobcard = "//DFHDPLOY JOB DFHDPLOY,CLASS=A,MSGCLASS=X,TIME=NOLIMIT";
605605
parms.arguments.targetstate = "DISCARDED";
606606
parms.arguments.description = undefined;
607+
parms.arguments.zh = undefined;
608+
parms.arguments.zp = undefined;
609+
parms.arguments.zu = undefined;
610+
parms.arguments.zpw = undefined;
611+
parms.arguments.zru = undefined;
612+
parms.arguments.zbp = undefined;
607613
}
608614

609615
async function testDeployJCL(parms: IHandlerParameters) {

__tests__/cli/deploy/bundle/DeployBundle.handler.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ describe("bundle Handler", () => {
424424
} catch (e) {
425425
err = e;
426426
}
427-
expectImperativeErrorWithMessage(err, "No zosmf profile found");
427+
expectImperativeErrorWithMessage(err, "Required parameter --zosmf-host is not set.");
428428
});
429429
});
430430

docs/pages/cdp/CLIReadme.md

Lines changed: 62 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,16 +102,44 @@ the target group of CICS regions\.
102102

103103
* Enable or suppress verbose output from the DFHDPLOY tool\.
104104

105-
#### Profile Options
105+
#### Zosmf Connection Options
106106

107-
* `--zosmf-profile` | `--zosmf-p` *(string)*
107+
* `--zosmf-host` | `--zh` *(string)*
108108

109-
* The name of a (zosmf) profile to load for this command execution\.
109+
* The z/OSMF server host name\.
110+
111+
* `--zosmf-port` | `--zp` *(number)*
112+
113+
* The z/OSMF server port\.
114+
115+
* `--zosmf-user` | `--zu` *(string)*
116+
117+
* Mainframe (z/OSMF) user name, which can be the same as your TSO login\.
118+
119+
* `--zosmf-password` | `--zpw` *(string)*
120+
121+
* Mainframe (z/OSMF) password, which can be the same as your TSO password\.
122+
123+
* `--zosmf-reject-unauthorized` | `--zru` *(boolean)*
124+
125+
* Reject self\-signed certificates\.
126+
127+
* `--zosmf-base-path` | `--zbp` *(string)*
128+
129+
* The base path for your API mediation layer instance\. Specify this option to
130+
prepend the base path to all z/OSMF resources when making REST requests\. Do not
131+
specify this option if you are not using an API mediation layer\.
132+
133+
#### Profile Options
110134

111135
* `--cics-deploy-profile` | `--cics-deploy-p` *(string)*
112136

113137
* The name of a (cics\-deploy) profile to load for this command execution\.
114138

139+
* `--zosmf-profile` | `--zosmf-p` *(string)*
140+
141+
* The name of a (zosmf) profile to load for this command execution\.
142+
115143
### Examples
116144

117145
* Deploy a CICS bundle with a specific name and location to a
@@ -509,16 +537,44 @@ target group of CICS regions\.
509537

510538
* Enable or suppress verbose output from the DFHDPLOY tool\.
511539

512-
#### Profile Options
540+
#### Zosmf Connection Options
513541

514-
* `--zosmf-profile` | `--zosmf-p` *(string)*
542+
* `--zosmf-host` | `--zh` *(string)*
515543

516-
* The name of a (zosmf) profile to load for this command execution\.
544+
* The z/OSMF server host name\.
545+
546+
* `--zosmf-port` | `--zp` *(number)*
547+
548+
* The z/OSMF server port\.
549+
550+
* `--zosmf-user` | `--zu` *(string)*
551+
552+
* Mainframe (z/OSMF) user name, which can be the same as your TSO login\.
553+
554+
* `--zosmf-password` | `--zpw` *(string)*
555+
556+
* Mainframe (z/OSMF) password, which can be the same as your TSO password\.
557+
558+
* `--zosmf-reject-unauthorized` | `--zru` *(boolean)*
559+
560+
* Reject self\-signed certificates\.
561+
562+
* `--zosmf-base-path` | `--zbp` *(string)*
563+
564+
* The base path for your API mediation layer instance\. Specify this option to
565+
prepend the base path to all z/OSMF resources when making REST requests\. Do not
566+
specify this option if you are not using an API mediation layer\.
567+
568+
#### Profile Options
517569

518570
* `--cics-deploy-profile` | `--cics-deploy-p` *(string)*
519571

520572
* The name of a (cics\-deploy) profile to load for this command execution\.
521573

574+
* `--zosmf-profile` | `--zosmf-p` *(string)*
575+
576+
* The name of a (zosmf) profile to load for this command execution\.
577+
522578
### Examples
523579

524580
* Undeploy a CICS bundle by using the default cics-deploy

src/api/BundleDeploy/BundleDeployer.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import { IHandlerParameters, Logger, ImperativeError, AbstractSession, ITaskWith
1616
import { ZosmfSession, SubmitJobs, List } from "@zowe/cli";
1717
import { ParmValidator } from "./ParmValidator";
1818
import * as path from "path";
19+
import { ZosmfConfig } from "../BundlePush/ZosmfConfig";
1920

2021
/**
2122
* Class to represent a CICS Bundle Deployer.
@@ -224,11 +225,14 @@ export class BundleDeployer {
224225

225226
private async createZosMFSession(): Promise<AbstractSession> {
226227
// Create a zosMF session
227-
const zosmfProfile = this.params.profiles.get("zosmf");
228+
let zosmfProfile = this.params.profiles.get("zosmf");
228229

229230
if (zosmfProfile === undefined) {
230-
throw new Error("No zosmf profile found");
231+
zosmfProfile = {};
231232
}
233+
234+
ZosmfConfig.mergeProfile(zosmfProfile, this.params);
235+
232236
return ZosmfSession.createBasicZosmfSession(zosmfProfile);
233237
}
234238

src/cli/deploy/bundle/DeployBundle.definition.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { TimeoutOption } from "../../shared/Timeout.option";
2323
import { TargetStateOption } from "./options/TargetState.option";
2424
import { VerboseOption } from "../../shared/Verbose.option";
2525
import { DescriptionOption } from "./options/Description.option";
26+
import { ZosmfOptions } from "../../shared/ZosmfOptions";
2627

2728

2829
/**
@@ -39,8 +40,9 @@ export const DeployBundleDefinition: ICommandDefinition = {
3940
type: "command",
4041
handler: __dirname + "/DeployBundle.handler",
4142
options: [ NameOption, BundledirOption, CicsplexOption, ScopeOption, CsdgroupOption , ResgroupOption,
42-
CicshlqOption, CpsmhlqOption, DescriptionOption, JobcardOption, TimeoutOption, TargetStateOption, VerboseOption],
43-
profile: { required: ["zosmf"], optional: ["cics-deploy"] },
43+
CicshlqOption, CpsmhlqOption, DescriptionOption, JobcardOption, TimeoutOption, TargetStateOption, VerboseOption]
44+
.concat(ZosmfOptions.CICS_DEPLOY_ZOSMF_CONNECTION_OPTIONS),
45+
profile: { optional: ["cics-deploy", "zosmf"] },
4446
examples: [
4547
{
4648
description: "Deploy a CICS bundle with a specific name and location to a default set of target regions",

src/cli/push/bundle/PushBundle.definition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { TargetStateOption } from "../../deploy/bundle/options/TargetState.optio
2424
import { DescriptionOption } from "../../deploy/bundle/options/Description.option";
2525
import { VerboseOption } from "../../shared/Verbose.option";
2626
import { OverwriteOption } from "./options/Overwrite.option";
27-
import { ZosmfOptions } from "./options/ZosmfOptions";
27+
import { ZosmfOptions } from "../../shared/ZosmfOptions";
2828
import { SshOptions } from "./options/SshOptions";
2929
import { CmciOptions } from "./options/CmciOptions";
3030

src/cli/undeploy/bundle/UndeployBundle.definition.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import { JobcardOption } from "../../shared/Jobcard.option";
2121
import { TimeoutOption } from "../../shared/Timeout.option";
2222
import { TargetStateOption } from "./options/TargetState.option";
2323
import { VerboseOption } from "../../shared/Verbose.option";
24+
import { ZosmfOptions } from "../../shared/ZosmfOptions";
2425

2526
/**
2627
* Imperative command for the Bundle sub-option of Deploy.
@@ -37,11 +38,12 @@ export const UndeployBundleDefinition: ICommandDefinition = {
3738
handler: __dirname + "/UndeployBundle.handler",
3839
options: [ NameOption, CicsplexOption, ScopeOption, CsdgroupOption , ResgroupOption,
3940
CicshlqOption, CpsmhlqOption, JobcardOption, TimeoutOption, TargetStateOption,
40-
VerboseOption],
41-
profile: { required: ["zosmf"], optional: ["cics-deploy"] },
41+
VerboseOption]
42+
.concat(ZosmfOptions.CICS_DEPLOY_ZOSMF_CONNECTION_OPTIONS),
43+
profile: { optional: ["cics-deploy", "zosmf"] },
4244
examples: [
4345
{
44-
description: "Undeploy a CICS bundle by using the default cics-deploy profile",
46+
description: "Undeploy a CICS bundle by using the default cics-deploy and zosmf profiles",
4547
options: `--name EXAMPLE`
4648
},
4749
{

0 commit comments

Comments
 (0)