Skip to content

errors while updating Zowe SDK create session function to Zowe V2 version #1548

Answered by t1m0thyj
ghost asked this question in Q&A
Discussion options

You must be logged in to vote

@inv9wj1 Here are two methods that should work to convert the profile object into a session class:

  1. The addPropsOrPrompt method must be awaited. It will issue a CLI prompt for host/user/password if they are missing.
const profile = {
    host: "example.com", port: 443, user: "admin", password: "123456", rejectUnauthorized: false
};
const sessCfg = zowe.ZosmfSession.createSessCfgFromArgs(profile);
const sessCfgWithCreds = await imperative.ConnectionPropsForSessCfg.addPropsOrPrompt(sessCfg, profile);
const session = new imperative.Session(sessCfgWithCreds);
  1. If you don't want prompting, you can convert the profile to an array of args and pass it to the createSession method.
const profile…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@ghost
Comment options

@t1m0thyj
Comment options

@ghost
Comment options

Answer selected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant