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

Register Kopia additional args #2858

Merged
merged 6 commits into from
May 10, 2024
Merged

Conversation

bathina2
Copy link
Contributor

@bathina2 bathina2 commented May 4, 2024

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:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Issues

Test Plan

  • 💪 Manual
  • ⚡ Unit test
  • 💚 E2E

@infraq infraq added this to In Progress in Kanister May 4, 2024
@bathina2 bathina2 force-pushed the register_kopia_additional_flags branch 2 times, most recently from 4e28125 to 18795af Compare May 7, 2024 00:59
@@ -39,7 +40,7 @@ type ConnectServerArgs struct {

// ConnectServer creates a new `kopia repository connect server...` command.
func ConnectServer(args ConnectServerArgs) (*safecli.Builder, error) {
Copy link
Contributor

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"
Copy link
Contributor

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?

Copy link
Contributor

@kidgilson kidgilson left a 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

a.args[key] = value
}

func (a *Args) AppendToCmd(cmd *logsafe.Cmd) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func (a *Args) AppendToCmd(cmd *logsafe.Cmd) {
func (a *Args) AppendToCmd(cmd logsafe.Cmd) logsafe.Cmd {


func (a *Args) AppendToCmd(cmd *logsafe.Cmd) {
for k, v := range a.args {
*cmd = cmd.AppendLoggableKV(k, v)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
*cmd = cmd.AppendLoggableKV(k, v)
cmd = cmd.AppendLoggableKV(k, v)

Add return cmd

}

args.RepositoryCreate.AppendToCmd(&command)
Copy link
Contributor

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.


args = args.AppendRedactedKV(serverCertFingerprint, cmdArgs.Fingerprint)
args.RepositoryConnectServer.AppendToCmd(&command)
Copy link
Contributor

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.

Comment on lines 192 to 194
// else {
// defer func() { args.RepositoryCreate = flags }()
// }
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete


return stringSliceCommand(args)
args.UserAddSet.AppendToCmd(&command)
Copy link
Contributor

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.


return stringSliceCommand(args)
args.UserAddSet.AppendToCmd(&command)
Copy link
Contributor

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.

@@ -0,0 +1,25 @@
package repository
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
package repository
package repository_test

Kanister automation moved this from In Progress to Reviewer approved May 8, 2024
@bathina2 bathina2 force-pushed the register_kopia_additional_flags branch from fd709ce to bd332b2 Compare May 8, 2024 23:30
Copy link
Contributor

@pavannd1 pavannd1 left a comment

Choose a reason for hiding this comment

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

LGTM

@bathina2 bathina2 added the kueue label May 10, 2024
@mergify mergify bot merged commit a3aa9e6 into master May 10, 2024
15 checks passed
@mergify mergify bot deleted the register_kopia_additional_flags branch May 10, 2024 21:47
Kanister automation moved this from Reviewer approved to Done May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging this pull request may close these issues.

Allow registration and setting of additional kopia command arguments
4 participants