Minor fixes to swiftfs.go

This commit is contained in:
Ole Markus With 2020-10-08 20:32:29 +02:00
parent 9dc4288b95
commit f6ce70e5c3
1 changed files with 4 additions and 4 deletions

View File

@ -96,7 +96,7 @@ func NewSwiftClient() (*gophercloud.ServiceClient, error) {
type OpenstackConfig struct {
}
func (_ OpenstackConfig) filename() (string, error) {
func (OpenstackConfig) filename() (string, error) {
name := os.Getenv("OPENSTACK_CREDENTIAL_FILE")
if name != "" {
klog.V(2).Infof("using openstack config found in $OPENSTACK_CREDENTIAL_FILE: %s", name)
@ -137,7 +137,7 @@ func (oc OpenstackConfig) GetCredential() (gophercloud.AuthOptions, error) {
// prioritize environment config
env, enverr := openstack.AuthOptionsFromEnv()
if enverr != nil {
klog.Warningf("Could not initialize swift from environment: %v", enverr)
klog.Warningf("Could not initialize OpenStack config from environment: %v", enverr)
// fallback to config file
return oc.getCredentialFromFile()
}
@ -165,7 +165,7 @@ func (oc OpenstackConfig) GetRegion() (string, error) {
// TODO: Unsure if this is the correct section for region
values, err := oc.getSection("Global", items)
if err != nil {
return "", fmt.Errorf("Region not provided in OS_REGION_NAME or openstack config section GLOBAL")
return "", fmt.Errorf("region not provided in OS_REGION_NAME or openstack config section GLOBAL")
}
return values["region"], nil
}
@ -527,7 +527,7 @@ func (p *SwiftPath) Hash(a hashing.HashAlgorithm) (*hashing.Hash, error) {
md5Bytes, err := hex.DecodeString(md5)
if err != nil {
return nil, fmt.Errorf("Etag was not a valid MD5 sum: %q", md5)
return nil, fmt.Errorf("etag was not a valid MD5 sum: %q", md5)
}
return &hashing.Hash{Algorithm: hashing.HashAlgorithmMD5, HashValue: md5Bytes}, nil