-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Client setup (better login, config files and switch projects) #992
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
Merged
openshift-bot
merged 4 commits into
openshift:master
from
fabianofranz:osc_login_further
Mar 16, 2015
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
80bab11
UPSTREAM: loader allows multiple sets of loading rules
fabianofranz 9a34d66
Introducing client projects switching - 'osc project'
fabianofranz 2de77d1
Introducing client login and setup - 'osc login'
fabianofranz aa0ba81
Project is not required for a successful login
fabianofranz 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
33 changes: 13 additions & 20 deletions
33
...s/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd/loader.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 8 additions & 3 deletions
11
Godeps/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/cmd.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 6 additions & 2 deletions
8
...s/_workspace/src/github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/config/view.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| package cmd | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "io" | ||
|
|
||
| "github.com/spf13/cobra" | ||
|
|
||
| cmdutil "github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd/util" | ||
| "github.com/openshift/origin/pkg/cmd/cli/config" | ||
| osclientcmd "github.com/openshift/origin/pkg/cmd/util/clientcmd" | ||
| ) | ||
|
|
||
| const longDescription = `Logs in to the OpenShift server and save the session | ||
| information to a config file that will be used by every subsequent command. | ||
|
|
||
| First-time users of the OpenShift client must run this command to configure the server, | ||
| establish a session against it and save it to a configuration file, usually in the | ||
| user's home directory. | ||
|
|
||
| The information required to login, like username and password or a session token, and | ||
| the server details, can be provided through flags. If not provided, the command will | ||
| prompt for user input if needed. | ||
| ` | ||
|
|
||
| func NewCmdLogin(f *osclientcmd.Factory, reader io.Reader, out io.Writer) *cobra.Command { | ||
| options := &LoginOptions{} | ||
|
|
||
| cmds := &cobra.Command{ | ||
| Use: "login [--username=<username>] [--password=<password>] [--server=<server>] [--context=<context>] [--certificate-authority=<path>]", | ||
| Short: "Logs in and save the configuration", | ||
| Long: longDescription, | ||
| Run: func(cmd *cobra.Command, args []string) { | ||
| options.Reader = reader | ||
| options.ClientConfig = f.OpenShiftClientConfig | ||
|
|
||
| checkErr(options.GatherInfo()) | ||
|
|
||
| forcePath := cmdutil.GetFlagString(cmd, config.OpenShiftConfigFlagName) | ||
| options.PathToSaveConfig = forcePath | ||
|
|
||
| newFileCreated, err := options.SaveConfig() | ||
| checkErr(err) | ||
|
|
||
| if newFileCreated { | ||
| fmt.Println("Welcome to OpenShift v3! Use 'osc --help' for a list of commands available.") | ||
| } | ||
| }, | ||
| } | ||
|
|
||
| // TODO flags below should be DE-REGISTERED from the persistent flags and kept only here. | ||
| // Login is the only command that can negotiate a session token against the auth server. | ||
| cmds.Flags().StringVarP(&options.Username, "username", "u", "", "Username, will prompt if not provided") | ||
| cmds.Flags().StringVarP(&options.Password, "password", "p", "", "Password, will prompt if not provided") | ||
| return cmds | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$OS_ROOT should already have this dir
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't seem to pass with $OS_ROOT, I'll leave it like that for now and fix later.