-
Notifications
You must be signed in to change notification settings - Fork 158
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
Implement Kopia storage helpers #2655
Conversation
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
|
||
// HasSkipSSLVerify returns true if the location has skip SSL verification. | ||
func (l Location) HasSkipSSLVerify() bool { | ||
v, _ := strconv.ParseBool(string(l[rs.SkipSSLVerifyKey])) |
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.
Shouldn't we handle 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.
I've implemented the same logic as it is in the current implementation:
// pkg/kopia/command/storage/secret_utils.go
func checkSkipSSLVerifyFromMap(m map[string][]byte) bool {
v := string(m[repositoryserver.SkipSSLVerifyKey])
return v == "true"
}
strconv.ParseBool
returns false
in the case of error.
"github.com/kanisterio/kanister/pkg/log" | ||
) | ||
|
||
// NopLogger is a logger that does nothing. |
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.
Why do we need this?
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.
This Nop logger is used inside s3 storage as a default logger if no logger is provided.
It helps to avoid code cluttering and remove some code bumps.
You don't need to write something like below:
if logger != nil {
logger.Print("Removing trailing slashes from the endpoint")
}
and can simply use:
logger.Print("Removing trailing slashes from the endpoint")
// If the location-specific prefix is empty, the repository-specific prefix is returned. | ||
func GenerateFullRepoPath(locPrefix, repoPathPrefix string) string { | ||
if locPrefix != "" { | ||
return path.Join(locPrefix, repoPathPrefix) + "/" |
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.
Is trailing /
compulsory? What's the problem if we don't add?
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.
This code is copied from pkg/kopia/command/storage/utils.go
. @ankitjain235, can you help us understand why a trailing slash is needed here?
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.
I think it's needed, but will let @pavannd1 confirm. Anyways it's existing behaviour so should be good to merge, we can remove it if not required later?
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Signed-off-by: pavel.larkin <pavel.larkin@veeam.com>
Change Overview
This PR is the 3rd in the series of PRs that will add a new way to build Kopia CLI commands.
PR Train:
This PR introduces core storage flag structures and storage helpers which will be used to build storage flags for specific providers(filesystem, s3, etc), along with extended error definitions.
Pull request type
Please check the type of change your PR introduces:
Test Plan