Skip to content

Commit 77059f1

Browse files
committed
sometimes code isn't self documenting
1 parent a73a60b commit 77059f1

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

packages/go/analysis/azure/post.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ func AppRoleAssignments(ctx context.Context, db graph.Database) (*analysis.Atomi
241241
return nil
242242
}); err != nil {
243243
if err := operation.Done(); err != nil {
244-
slog.ErrorContext(ctx, "Error caught during azure AppRoleAssignments teardown: %v", err)
244+
slog.ErrorContext(ctx, "Error caught during azure AppRoleAssignments teardown", slog.String("err", err.Error()))
245245
}
246246

247247
return &operation.Stats, err
@@ -661,7 +661,7 @@ func addSecret(operation analysis.StatTrackedOperation[analysis.CreatePostRelati
661661
} else {
662662
for _, role := range addSecretRoles {
663663
for _, target := range tenantAppsAndSPs {
664-
slog.DebugContext(ctx, "Adding AZAddSecret edge from role %s to %s %d", role.ID.String(), target.Kinds.Strings(), target.ID)
664+
slog.DebugContext(ctx, fmt.Sprintf("Adding AZAddSecret edge from role %s to %s %d", role.ID.String(), target.Kinds.Strings(), target.ID))
665665
nextJob := analysis.CreatePostRelationshipJob{
666666
FromID: role.ID,
667667
ToID: target.ID,
@@ -724,7 +724,7 @@ func ExecuteCommand(ctx context.Context, db graph.Database) (*analysis.AtomicPos
724724
return nil
725725
}); err != nil {
726726
if err := operation.Done(); err != nil {
727-
slog.ErrorContext(ctx, "Error caught during azure ExecuteCommand teardown: %v", err)
727+
slog.ErrorContext(ctx, "Error caught during azure ExecuteCommand teardown", slog.String("err", err.Error()))
728728
}
729729

730730
return &operation.Stats, err
@@ -810,7 +810,7 @@ func globalAdmins(roleAssignments RoleAssignments, tenant *graph.Node, operation
810810

811811
return nil
812812
}); err != nil {
813-
slog.Error("Failed to submit azure global admins post processing job: %v", err)
813+
slog.Error("Failed to submit azure global admins post processing job", slog.String("err", err.Error()))
814814
}
815815
}
816816

@@ -828,7 +828,7 @@ func privilegedRoleAdmins(roleAssignments RoleAssignments, tenant *graph.Node, o
828828

829829
return nil
830830
}); err != nil {
831-
slog.Error("Failed to submit privileged role admins post processing job: %v", err)
831+
slog.Error("Failed to submit privileged role admins post processing job", slog.String("err", err.Error()))
832832
}
833833
}
834834

@@ -846,7 +846,7 @@ func privilegedAuthAdmins(roleAssignments RoleAssignments, tenant *graph.Node, o
846846

847847
return nil
848848
}); err != nil {
849-
slog.Error("Failed to submit azure privileged auth admins post processing job: %v", err)
849+
slog.Error("Failed to submit azure privileged auth admins post processing job", slog.String("err", err.Error()))
850850
}
851851
}
852852

@@ -870,7 +870,7 @@ func addMembers(roleAssignments RoleAssignments, operation analysis.StatTrackedO
870870

871871
return nil
872872
}); err != nil {
873-
slog.Error("Failed to submit post processing job for users with role allowing AZAddMembers edge: %v", err)
873+
slog.Error("Failed to submit post processing job for users with role allowing AZAddMembers edge", slog.String("err", err.Error()))
874874
}
875875

876876
if err := operation.Operation.SubmitReader(func(ctx context.Context, tx graph.Transaction, outC chan<- analysis.CreatePostRelationshipJob) error {
@@ -886,13 +886,13 @@ func addMembers(roleAssignments RoleAssignments, operation analysis.StatTrackedO
886886

887887
return nil
888888
}); err != nil {
889-
slog.Error("Failed to submit post processing job for service principals with role allowing AZAddMembers edge: %v", err)
889+
slog.Error("Failed to submit post processing job for service principals with role allowing AZAddMembers edge", slog.String("err", err.Error()))
890890
}
891891

892892
if err := operation.Operation.SubmitReader(func(ctx context.Context, tx graph.Transaction, outC chan<- analysis.CreatePostRelationshipJob) error {
893893
if isRoleAssignable, err := innerGroup.Properties.Get(azure.IsAssignableToRole.String()).Bool(); err != nil {
894894
if graph.IsErrPropertyNotFound(err) {
895-
slog.WarnContext(ctx, "Node %d is missing property %s", innerGroup.ID, azure.IsAssignableToRole)
895+
slog.WarnContext(ctx, fmt.Sprintf("Node %d is missing property %s", innerGroup.ID, azure.IsAssignableToRole))
896896
} else {
897897
return err
898898
}
@@ -910,13 +910,13 @@ func addMembers(roleAssignments RoleAssignments, operation analysis.StatTrackedO
910910

911911
return nil
912912
}); err != nil {
913-
slog.Error("Failed to submit post processing job for users with role allowing AZAddMembers edge: %v", err)
913+
slog.Error("Failed to submit post processing job for users with role allowing AZAddMembers edge", slog.String("err", err.Error()))
914914
}
915915

916916
if err := operation.Operation.SubmitReader(func(ctx context.Context, tx graph.Transaction, outC chan<- analysis.CreatePostRelationshipJob) error {
917917
if isRoleAssignable, err := innerGroup.Properties.Get(azure.IsAssignableToRole.String()).Bool(); err != nil {
918918
if graph.IsErrPropertyNotFound(err) {
919-
slog.WarnContext(ctx, "Node %d is missing property %s", innerGroup.ID, azure.IsAssignableToRole)
919+
slog.WarnContext(ctx, fmt.Sprintf("Node %d is missing property %s", innerGroup.ID, azure.IsAssignableToRole))
920920
} else {
921921
return err
922922
}
@@ -934,7 +934,7 @@ func addMembers(roleAssignments RoleAssignments, operation analysis.StatTrackedO
934934

935935
return nil
936936
}); err != nil {
937-
slog.Error("Failed to submit post processing job for service principals with role allowing AZAddMembers edge: %v", err)
937+
slog.Error("Failed to submit post processing job for service principals with role allowing AZAddMembers edge", slog.String("err", err.Error()))
938938
}
939939
}
940940
}
@@ -948,14 +948,14 @@ func UserRoleAssignments(ctx context.Context, db graph.Database) (*analysis.Atom
948948
for _, tenant := range tenantNodes {
949949
if roleAssignments, err := TenantRoleAssignments(ctx, db, tenant); err != nil {
950950
if err := operation.Done(); err != nil {
951-
slog.ErrorContext(ctx, "Error caught during azure UserRoleAssignments.TenantRoleAssignments teardown: %v", err)
951+
slog.ErrorContext(ctx, "Error caught during azure UserRoleAssignments.TenantRoleAssignments teardown", slog.String("err", err.Error()))
952952
}
953953

954954
return &analysis.AtomicPostProcessingStats{}, err
955955
} else {
956956
if err := resetPassword(operation, tenant, roleAssignments); err != nil {
957957
if err := operation.Done(); err != nil {
958-
slog.ErrorContext(ctx, "Error caught during azure UserRoleAssignments.resetPassword teardown: %v", err)
958+
slog.ErrorContext(ctx, "Error caught during azure UserRoleAssignments.resetPassword teardown", slog.String("err", err.Error()))
959959
}
960960

961961
return &analysis.AtomicPostProcessingStats{}, err

0 commit comments

Comments
 (0)