Skip to content

Commit

Permalink
Merge pull request #82 from agelostsal/devel
Browse files Browse the repository at this point in the history
Minor code clean up
  • Loading branch information
agelostsal authored Aug 3, 2018
2 parents 3bbaa95 + 9a23373 commit f39339b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
4 changes: 0 additions & 4 deletions authmethods/auth_method_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ func (f *AuthMethodFactory) Create(amType string) (AuthMethod, error) {
var am AuthMethod
var aMInit AuthMethodInit

if amType == "api-key" {
return new(ApiKeyAuthMethod), nil
}

if aMInit, ok = AuthMethodsTypes[amType]; !ok {
err = utils.APIGenericInternalError("Type is supported but not found")
LOGGER.Errorf("Type: %v was requested, but was not found inside the source code despite being supported", amType)
Expand Down
10 changes: 1 addition & 9 deletions authmethods/authmethods.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ import (
"io"
)

var ApiKeyAuthMethodsPaths = map[string]string{
"ams": "/v1/users:byUUID/{{identifier}}?key={{access_key}}",
}

var AuthMethodsRetrievalFields = map[string]string{
"ams": "token",
}

type AuthMethodInit func() AuthMethod

var AuthMethodsTypes = map[string]AuthMethodInit{
Expand Down Expand Up @@ -153,7 +145,7 @@ func AuthMethodAlreadyExists(serviceUUID string, host string, authMethodType str
return err
}

// if the error
// if there is any other error, treat it as a normal error
if err.Error() != "Auth method was not found" {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions servicetypes/service_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ func (s *ServiceType) IsOfValidType(cfg config.Config) error {
}

//UpdateServiceType updates a binding after validating its fields
func UpdateServiceType(original ServiceType, tempBind TempServiceType, store stores.Store, cfg config.Config) (ServiceType, error) {
func UpdateServiceType(original ServiceType, tempServiceType TempServiceType, store stores.Store, cfg config.Config) (ServiceType, error) {

var err error
var updated ServiceType
Expand All @@ -303,7 +303,7 @@ func UpdateServiceType(original ServiceType, tempBind TempServiceType, store sto
return ServiceType{}, err
}

if err := utils.CopyFields(tempBind, &updated); err != nil {
if err := utils.CopyFields(tempServiceType, &updated); err != nil {
err = utils.APIGenericInternalError(err.Error())
return ServiceType{}, err
}
Expand All @@ -314,8 +314,8 @@ func UpdateServiceType(original ServiceType, tempBind TempServiceType, store sto
}

// if there is an update happening to the name field, check if its unique
if original.Name != tempBind.Name {
if err = ExistsWithName(tempBind.Name, store); err != nil {
if original.Name != tempServiceType.Name {
if err = ExistsWithName(tempServiceType.Name, store); err != nil {
return ServiceType{}, err
}
}
Expand Down

0 comments on commit f39339b

Please sign in to comment.