-
Notifications
You must be signed in to change notification settings - Fork 149
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
Register Kopia additional args #2858
Conversation
4e28125
to
18795af
Compare
@@ -39,7 +40,7 @@ type ConnectServerArgs struct { | |||
|
|||
// ConnectServer creates a new `kopia repository connect server...` command. | |||
func ConnectServer(args ConnectServerArgs) (*safecli.Builder, error) { |
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.
Perhaps we could rename this argument rather than aliasing the import?
@@ -20,6 +20,7 @@ import ( | |||
"github.com/kanisterio/safecli" | |||
"gopkg.in/check.v1" | |||
|
|||
cliArgs "github.com/kanisterio/kanister/pkg/kopia/cli/args" |
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.
Perhaps we shouldn't alias this import either?
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.
Small changes but otherwise LGTM
pkg/kopia/cli/args/ephemeral_args.go
Outdated
a.args[key] = value | ||
} | ||
|
||
func (a *Args) AppendToCmd(cmd *logsafe.Cmd) { |
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.
func (a *Args) AppendToCmd(cmd *logsafe.Cmd) { | |
func (a *Args) AppendToCmd(cmd logsafe.Cmd) logsafe.Cmd { |
pkg/kopia/cli/args/ephemeral_args.go
Outdated
|
||
func (a *Args) AppendToCmd(cmd *logsafe.Cmd) { | ||
for k, v := range a.args { | ||
*cmd = cmd.AppendLoggableKV(k, v) |
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.
*cmd = cmd.AppendLoggableKV(k, v) | |
cmd = cmd.AppendLoggableKV(k, v) |
Add return cmd
pkg/kopia/command/repository.go
Outdated
} | ||
|
||
args.RepositoryCreate.AppendToCmd(&command) |
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.
Change to reflect new method.
pkg/kopia/command/repository.go
Outdated
|
||
args = args.AppendRedactedKV(serverCertFingerprint, cmdArgs.Fingerprint) | ||
args.RepositoryConnectServer.AppendToCmd(&command) |
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.
Change to reflect new method.
pkg/kopia/command/repository_test.go
Outdated
// else { | ||
// defer func() { args.RepositoryCreate = flags }() | ||
// } |
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.
Delete
pkg/kopia/command/server.go
Outdated
|
||
return stringSliceCommand(args) | ||
args.UserAddSet.AppendToCmd(&command) |
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.
Changes to reflect new method.
pkg/kopia/command/server.go
Outdated
|
||
return stringSliceCommand(args) | ||
args.UserAddSet.AppendToCmd(&command) |
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.
Changes to reflect new method.
pkg/kopia/repository/client_test.go
Outdated
@@ -0,0 +1,25 @@ | |||
package repository |
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.
package repository | |
package repository_test |
fd709ce
to
bd332b2
Compare
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.
LGTM
Change Overview
This PR adds the ability to register additional Kopia arguments for the following kopia commands-
kopia repo create
kopia repo connect server
kopia user add
kopia user set
Once registered all subsequent calls to these command will use the additional arguments.
Pull request type
Please check the type of change your PR introduces:
Issues
Test Plan