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

asset/*: re-implement user prompts #287

Merged
merged 4 commits into from
Sep 20, 2018
Merged

asset/*: re-implement user prompts #287

merged 4 commits into from
Sep 20, 2018

Conversation

crawford
Copy link
Contributor

This uses a library instead of a custom implementation. This has the
advantage of providing defaults, help messages, and a nicer interface.

b00e40e erroneously added a bunch of unneeded files.
`glide update` hadn't been run after the Tectonic Node Controller was
removed.
This library provides nice terminal prompting functionality that the
installer will use to read input from the user.
@openshift-ci-robot openshift-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 20, 2018
@crawford
Copy link
Contributor Author

This supersedes #212.

@crawford
Copy link
Contributor Author

/hold

I still want to fix a couple things.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 20, 2018
Help: "The AWS region to be used for installation.",
Default: "us-east-1 (N. Virginia)",
Options: []string{
"us-east-2 (Ohio)",
Copy link
Member

Choose a reason for hiding this comment

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

Did you work this up by hand? I'd rather auto-generate it. You can get close with:

$ aws ec2 describe-regions --query Regions --output json | jq '[.[] | .RegionName] | sort'
[
  "ap-northeast-1",
  "ap-northeast-2",
  "ap-south-1",
  "ap-southeast-1",
  "ap-southeast-2",
  "ca-central-1",
  "eu-central-1",
  "eu-west-1",
  "eu-west-2",
  "eu-west-3",
  "sa-east-1",
  "us-east-1",
  "us-east-2",
  "us-west-1",
  "us-west-2"
]

But I can't find a way to get the human names ("Ohio" here). There's more here (including "how do you get the human name?"). Amazon provides this.

The CLI query also doesn't list GovCloud regions (presumably because I don't have access to any of those). And the AWS page talks about plans for additional future regions. So maybe just throw up our hands and don't list options?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied the list from AWS's documentation.

My thinking with the regions was that if the user couldn't find their region, they could just modify install-config.yaml after the fact. This list won't include GovCloud or AWS China.

survey.AskOne(&survey.Select{
Message: "SSH Public Key",
Help: "The SSH key used to access all nodes within the cluster. This is optional.",
Options: append([]string{none}, paths...),
Copy link
Member

Choose a reason for hiding this comment

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

I think you also want to continue to support "paste in your SSH pubkey" (vs. just reading it from a file).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can just tell the user to edit their install config if they want to do that. Remember, this interactive UI is for the basic use case - nothing fancy.

path := paths[i-1]
input = pubKeys[path]
} else {
err = validate.OpenSSHPublicKey(input)
Copy link
Member

Choose a reason for hiding this comment

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

I think we want to keep this validation for when a user pastes in a pubkey directly.

This uses a library instead of a custom implementation. This has the
advantage of providing defaults, help messages, and a nicer interface.
@abhinavdahiya
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 20, 2018
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinavdahiya, crawford

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [abhinavdahiya,crawford]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@crawford
Copy link
Contributor Author

/retest

home := os.Getenv("HOME")
if home != "" {
paths, err = filepath.Glob(filepath.Join(home, ".ssh", "*.pub"))
paths, err := filepath.Glob(filepath.Join(home, ".ssh", "*.pub"))
Copy link
Member

Choose a reason for hiding this comment

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

nit: I liked the old way better, instead of using an if-scoped path here, throwing it away, and then (re)building a function-scoped path later. Not worth blocking the merge though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All I did was move the construction of paths outside of this block. The pubkeys map is really the output of this block.

{Data: []byte(input)},
},
Contents: []asset.Content{{
Data: pubKeys[path],
Copy link
Member

Choose a reason for hiding this comment

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

Looks like we're still not supporting "paste in your SSH pubkey". Is that going to be another "edit your install-config YAML afterwards if you need it"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah. Copying from above because I'm lazy:

We can just tell the user to edit their install config if they want to do that. Remember, this interactive UI is for the basic use case - nothing fancy.

@crawford
Copy link
Contributor Author

/retest
/hold

@crawford
Copy link
Contributor Author

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 20, 2018
@openshift-merge-robot openshift-merge-robot merged commit 8f4425c into openshift:master Sep 20, 2018
@crawford crawford deleted the prompt branch September 20, 2018 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants