Skip to content

Commit

Permalink
Change debug message location
Browse files Browse the repository at this point in the history
  • Loading branch information
otterobert committed Dec 15, 2024
1 parent bf6ffc4 commit d05642f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/shared/azureagent/customroles.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func (a *Agent) GenerateCustomRoleName(uai armmsi.Identity, scope string) string

func (a *Agent) CreateCustomRole(ctx context.Context, scope string, uai armmsi.Identity, actions []v2alpha1.AzureAction, dataActions []v2alpha1.AzureDataAction) (*armauthorization.RoleDefinition, error) {
roleScope := a.getSubscriptionScope(scope)
logrus.Debugf("Creating custom role for %s", *uai.Name)

formattedActions := lo.Map(actions, func(action v2alpha1.AzureAction, _ int) *string {
return to.Ptr(string(action))
Expand All @@ -63,7 +62,7 @@ func (a *Agent) CreateCustomRole(ctx context.Context, scope string, uai armmsi.I
},
}

// create the custom role
logrus.Debugf("Creating custom role for %s", *uai.Name)
resp, err := a.roleDefinitionsClient.CreateOrUpdate(ctx, roleScope, id, roleDefinition, nil)
if err != nil {
return nil, errors.Wrap(err)
Expand All @@ -74,7 +73,6 @@ func (a *Agent) CreateCustomRole(ctx context.Context, scope string, uai armmsi.I

func (a *Agent) UpdateCustomRole(ctx context.Context, scope string, role *armauthorization.RoleDefinition, actions []v2alpha1.AzureAction, dataActions []v2alpha1.AzureDataAction) error {
roleScope := a.getSubscriptionScope(scope)
logrus.Debugf("Updating custom role %s", *role.Name)

formattedActions := lo.Map(actions, func(action v2alpha1.AzureAction, _ int) *string {
return to.Ptr(string(action))
Expand All @@ -96,6 +94,7 @@ func (a *Agent) UpdateCustomRole(ctx context.Context, scope string, role *armaut
},
}

logrus.Debugf("Updating custom role %s", *role.Name)
_, err := a.roleDefinitionsClient.CreateOrUpdate(ctx, roleScope, *role.Name, *role, nil)
if err != nil {
return errors.Wrap(err)
Expand Down

0 comments on commit d05642f

Please sign in to comment.