Skip to content

Commit

Permalink
removing diagnostic logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jpflueger committed Apr 20, 2020
1 parent 348f49f commit 421942e
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 46 deletions.
20 changes: 0 additions & 20 deletions controllers/cosmosdb_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ package controllers

import (
"context"
"log"
"testing"

"github.com/Azure/azure-service-operator/api/v1alpha1"
Expand Down Expand Up @@ -49,25 +48,6 @@ func TestCosmosDBHappyPath(t *testing.T) {

assert.Eventually(func() bool {
secret, err := tc.secretClient.Get(ctx, key)
cond := err == nil && len(secret) > 0
if !cond {
//TODO: remove before completing pull request
tc.k8sClient.Get(ctx, key, dbInstance)
log.Printf(
`----- COSMOSDB -----
Secret: %v
Assertion: %v
Error: %v
Secret: %v
Status: %v
`,
key,
cond,
err,
secret,
dbInstance.Status,
)
}
return err == nil && len(secret) > 0
}, tc.timeoutFast, tc.retry, "wait for cosmosdb to have secret")

Expand Down
26 changes: 0 additions & 26 deletions pkg/resourcemanager/cosmosdbs/cosmosdb_reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package cosmosdbs
import (
"context"
"fmt"
"log"
"strings"

"github.com/Azure/azure-service-operator/api/v1alpha1"
Expand Down Expand Up @@ -67,16 +66,13 @@ func (m *AzureCosmosDBManager) Ensure(ctx context.Context, obj runtime.Object, o
}

if instance.Status.State == "Succeeded" {
log.Println("Hit Get success path")

// provisioning is complete, update the secrets
if err = m.createOrUpdateAccountKeysSecret(ctx, instance); err != nil {
instance.Status.Message = err.Error()
return false, err
}

if instance.Status.SpecHash == hash {
log.Println("Hit Get + SpecHash success path")
instance.Status.Message = resourcemanager.SuccessMsg
instance.Status.Provisioning = false
instance.Status.Provisioned = true
Expand Down Expand Up @@ -129,7 +125,6 @@ func (m *AzureCosmosDBManager) Ensure(ctx context.Context, obj runtime.Object, o
}
}

log.Printf("Hit unhandled error case: %v\n", err)
return false, err
}

Expand All @@ -138,7 +133,6 @@ func (m *AzureCosmosDBManager) Ensure(ctx context.Context, obj runtime.Object, o
return false, err
}

log.Println("Hit terminal success case.")
instance.Status.SpecHash = hash
instance.Status.ResourceId = *db.ID
instance.Status.State = *db.ProvisioningState
Expand Down Expand Up @@ -240,15 +234,6 @@ func (m *AzureCosmosDBManager) convert(obj runtime.Object) (*v1alpha1.CosmosDB,
func (m *AzureCosmosDBManager) createOrUpdateAccountKeysSecret(ctx context.Context, instance *v1alpha1.CosmosDB) error {
result, err := m.ListKeys(ctx, instance.Spec.ResourceGroup, instance.ObjectMeta.Name)
if err != nil {
//TODO: remove before completing pull request
log.Printf(
`Failed to list CosmosDB Account Keys:
Status: %v
Error: %v
`,
instance.Status,
err,
)
return err
}

Expand All @@ -265,20 +250,9 @@ func (m *AzureCosmosDBManager) createOrUpdateAccountKeysSecret(ctx context.Conte

err = m.SecretClient.Upsert(ctx, secretKey, secretData)
if err != nil {
//TODO: remove before completing pull request
log.Printf(
`Failed to upsert CosmosDB Account Keys:
Status: %v
Error: %v
`,
instance.Status,
err,
)
return err
}

//TODO: remove before completing pull request
log.Printf("Successfully upserted CosmosDB Account Keys: %v\n", secretKey)
return nil
}

Expand Down

0 comments on commit 421942e

Please sign in to comment.