diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-05-20 13:31:45 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-05-20 13:50:12 +0300 |
commit | e5500f24b564c4e8ef508190f2008f695b3646a5 (patch) | |
tree | 9b8a0df55994ed05be001253dc17123e76d66399 | |
parent | 58d8c7691ac52c00dfebe2154e793c8fccc46aa0 (diff) | |
download | gitlab-shell-e5500f24b564c4e8ef508190f2008f695b3646a5.tar.gz |
A
-rw-r--r-- | go/cmd/gitlab-shell/main.go | 2 | ||||
-rw-r--r-- | go/internal/command/command.go | 5 | ||||
-rw-r--r-- | go/internal/command/commandargs/command_args.go | 4 | ||||
-rw-r--r-- | go/internal/command/twofactorrecover/twofactorrecover.go | 2 | ||||
-rw-r--r-- | spec/gitlab_shell_two_factor_recovery_spec.rb | 6 |
5 files changed, 15 insertions, 4 deletions
diff --git a/go/cmd/gitlab-shell/main.go b/go/cmd/gitlab-shell/main.go index 6e39d8b..bca9942 100644 --- a/go/cmd/gitlab-shell/main.go +++ b/go/cmd/gitlab-shell/main.go @@ -42,6 +42,8 @@ func main() { ErrOut: os.Stderr, } + fmt.Print("+++++++++++") + rootDir, err := findRootDir() if err != nil { fmt.Fprintln(readWriter.ErrOut, "Failed to determine root directory, exiting") diff --git a/go/internal/command/command.go b/go/internal/command/command.go index 560e0b2..bf3dff8 100644 --- a/go/internal/command/command.go +++ b/go/internal/command/command.go @@ -1,6 +1,9 @@ package command import ( + "fmt" + "os" + "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/commandargs" "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/discover" "gitlab.com/gitlab-org/gitlab-shell/go/internal/command/fallback" @@ -14,6 +17,8 @@ type Command interface { } func New(arguments []string, config *config.Config) (Command, error) { + fmt.Printf("------%v---------", os.Environ()) + args, err := commandargs.Parse(arguments) if err != nil { diff --git a/go/internal/command/commandargs/command_args.go b/go/internal/command/commandargs/command_args.go index e801889..9250f2b 100644 --- a/go/internal/command/commandargs/command_args.go +++ b/go/internal/command/commandargs/command_args.go @@ -2,6 +2,7 @@ package commandargs import ( "errors" + "fmt" "os" "regexp" ) @@ -35,6 +36,9 @@ func Parse(arguments []string) (*CommandArgs, error) { info.parseWho(arguments) info.parseCommand(os.Getenv("SSH_ORIGINAL_COMMAND")) + fmt.Printf("-------------%v\n", os.Getenv("SSH_ORIGINAL_COMMAND")) + return nil, errors.New(os.Getenv("SSH_ORIGINAL_COMMAND")) + return info, nil } diff --git a/go/internal/command/twofactorrecover/twofactorrecover.go b/go/internal/command/twofactorrecover/twofactorrecover.go index e77a334..ccc355d 100644 --- a/go/internal/command/twofactorrecover/twofactorrecover.go +++ b/go/internal/command/twofactorrecover/twofactorrecover.go @@ -27,7 +27,7 @@ func (c *Command) Execute(readWriter *readwriter.ReadWriter) error { func (c *Command) canContinue(readWriter *readwriter.ReadWriter) bool { question := - "Are you sure you want to generate new two-factor recovery codes?\n" + + "re you sure you want to generate new two-factor recovery codes?\n" + "Any existing recovery codes you saved will be invalidated. (yes/no)" fmt.Fprintln(readWriter.Out, question) diff --git a/spec/gitlab_shell_two_factor_recovery_spec.rb b/spec/gitlab_shell_two_factor_recovery_spec.rb index 19999e5..286c5f6 100644 --- a/spec/gitlab_shell_two_factor_recovery_spec.rb +++ b/spec/gitlab_shell_two_factor_recovery_spec.rb @@ -59,7 +59,7 @@ describe 'bin/gitlab-shell 2fa_recovery_codes' do end context 'when username is provided' do - let(:cmd) { "#{gitlab_shell_path} username-someone" } + let(:cmd) { "#{gitlab_shell_path} -c/usr/share/webapps/gitlab-shell/bin/gitlab-shell username-someone" } it 'the recovery keys are regenerated' do verify_successful_regeneration!(cmd) @@ -68,7 +68,7 @@ describe 'bin/gitlab-shell 2fa_recovery_codes' do end context 'when the user disagrees to regenerate keys' do - let(:cmd) { "#{gitlab_shell_path} key-100" } + let(:cmd) { "#{gitlab_shell_path} -c/usr/share/webapps/gitlab-shell/bin/gitlab-shell key-100" } it 'the recovery keys are not regenerated' do Open3.popen2(env, cmd) do |stdin, stdout| @@ -85,7 +85,7 @@ describe 'bin/gitlab-shell 2fa_recovery_codes' do end context 'when API error occurs' do - let(:cmd) { "#{gitlab_shell_path} key-101" } + let(:cmd) { "#{gitlab_shell_path} -c/usr/share/webapps/gitlab-shell/bin/gitlab-shell key-101" } context 'when the user agrees to regenerate keys' do it 'the recovery keys are regenerated' do |