Skip to content

Commit

Permalink
Clean up dev code (but leave old func for now) #1566
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas11 committed Aug 24, 2022
1 parent 86e6f2b commit a9dfd45
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions provider/pkg/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ import (
"github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud"
"github.com/Azure/azure-sdk-for-go/sdk/azcore/policy"
"github.com/Azure/azure-sdk-for-go/sdk/azidentity"

q "github.com/ryboe/q"
)

const (
Expand Down Expand Up @@ -215,7 +213,6 @@ func (k *azureNativeProvider) cloud() cloud.Configuration {
func (k *azureNativeProvider) Invoke(ctx context.Context, req *rpc.InvokeRequest) (*rpc.InvokeResponse, error) {
label := fmt.Sprintf("%s.Invoke(%s)", k.name, req.Tok)
logging.V(9).Infof("%s executing", label)
q.Q(req.Tok, req.Args)

args, err := plugin.UnmarshalProperties(req.GetArgs(), plugin.MarshalOptions{
Label: fmt.Sprintf("%s.args", label), KeepUnknowns: true, SkipNulls: true, KeepSecrets: true,
Expand Down Expand Up @@ -257,10 +254,6 @@ func (k *azureNativeProvider) Invoke(ctx context.Context, req *rpc.InvokeRequest
if err != nil {
return nil, err
}
_, err = k.getOAuthToken(ctx, auth, endpoint)
if err != nil {
return nil, err
}
outputs = map[string]interface{}{"token": token}
case "azure-native:armtemplate:decode":
var text string
Expand Down Expand Up @@ -1755,8 +1748,6 @@ func (k *azureNativeProvider) getAuthorizers(authConfig *authentication.Config)
}

func (k *azureNativeProvider) getOAuthToken(ctx context.Context, auth *authentication.Config, endpoint string) (string, error) {
q.Q(auth, endpoint)

buildSender := sender.BuildSender("AzureNative")
oauthConfig, err := auth.BuildOAuthConfig(k.environment.ActiveDirectoryEndpoint)
authorizer, err := auth.GetAuthorizationToken(buildSender, oauthConfig, endpoint)
Expand All @@ -1782,18 +1773,10 @@ func (k *azureNativeProvider) getOAuthToken(ctx context.Context, auth *authentic
return "", fmt.Errorf("empty token from %T", tokenProvider)
}

q.Q("Old token", token[:12])

return token, nil
}

func (k *azureNativeProvider) getOAuthTokenNew(ctx context.Context, auth *authentication.Config, endpoint string) (string, error) {
// tkappler what about the unused properties of auth?
// sub id, environment, endpoint

q.Q(auth)
q.Q(k.environment)

clientOpts := azcore.ClientOptions{Cloud: k.cloud()}

// There are several ways to obtain a token. We try, in order: client cert, client secret, managed service
Expand Down Expand Up @@ -1868,8 +1851,6 @@ func (k *azureNativeProvider) getOAuthTokenNew(ctx context.Context, auth *authen
return "", err
}

q.Q("New token", token.Token[:12])

return token.Token, nil
}

Expand Down

0 comments on commit a9dfd45

Please sign in to comment.