mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-08-02 03:56:07 -04:00
AB#2033 Remove redundant "failed" in error wrapping
Remove "failed" from wrapped errors Where appropriate rephrase "unable to/could not" to "failed" in root errors Start error log messages with "Failed"
This commit is contained in:
parent
0c9ca50be8
commit
9441e46e4b
56 changed files with 204 additions and 204 deletions
|
@ -107,7 +107,7 @@ func (c *Client) updateAppCredentials(ctx context.Context, objectID string) (str
|
|||
keyID := uuid.New().String()
|
||||
clientSecret, err := generateClientSecret()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("generating client secret failed: %w", err)
|
||||
return "", fmt.Errorf("generating client secret: %w", err)
|
||||
}
|
||||
updateParameters := graphrbac.PasswordCredentialsUpdateParameters{
|
||||
Value: &[]graphrbac.PasswordCredential{
|
||||
|
|
|
@ -69,7 +69,7 @@ func (c *ServiceAccountCreator) createServiceAccountGCP(ctx context.Context, cl
|
|||
stat state.ConstellationState, config *config.Config,
|
||||
) (string, state.ConstellationState, error) {
|
||||
if err := cl.SetState(stat); err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to set state while creating service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("setting state while creating service account: %w", err)
|
||||
}
|
||||
|
||||
input := gcpcl.ServiceAccountInput{
|
||||
|
@ -77,12 +77,12 @@ func (c *ServiceAccountCreator) createServiceAccountGCP(ctx context.Context, cl
|
|||
}
|
||||
serviceAccount, err := cl.CreateServiceAccount(ctx, input)
|
||||
if err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to create service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("creating service account: %w", err)
|
||||
}
|
||||
|
||||
stat, err = cl.GetState()
|
||||
if err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to get state after creating service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("getting state after creating service account: %w", err)
|
||||
}
|
||||
return serviceAccount, stat, nil
|
||||
}
|
||||
|
@ -91,16 +91,16 @@ func (c *ServiceAccountCreator) createServiceAccountAzure(ctx context.Context, c
|
|||
stat state.ConstellationState, config *config.Config,
|
||||
) (string, state.ConstellationState, error) {
|
||||
if err := cl.SetState(stat); err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to set state while creating service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("setting state while creating service account: %w", err)
|
||||
}
|
||||
serviceAccount, err := cl.CreateServicePrincipal(ctx)
|
||||
if err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to create service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("creating service account: %w", err)
|
||||
}
|
||||
|
||||
stat, err = cl.GetState()
|
||||
if err != nil {
|
||||
return "", state.ConstellationState{}, fmt.Errorf("failed to get state after creating service account: %w", err)
|
||||
return "", state.ConstellationState{}, fmt.Errorf("getting state after creating service account: %w", err)
|
||||
}
|
||||
return serviceAccount, stat, nil
|
||||
}
|
||||
|
|
|
@ -127,7 +127,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, ser
|
|||
return err
|
||||
}
|
||||
if err := waiter.WaitForAll(ctx, endpoints, coordinatorstate.AcceptingInit); err != nil {
|
||||
return fmt.Errorf("failed to wait for peer status: %w", err)
|
||||
return fmt.Errorf("waiting for all peers status: %w", err)
|
||||
}
|
||||
|
||||
var autoscalingNodeGroups []string
|
||||
|
@ -161,7 +161,7 @@ func initialize(ctx context.Context, cmd *cobra.Command, protCl protoClient, ser
|
|||
}
|
||||
|
||||
if err := writeWGQuickFile(fileHandler, vpnHandler, vpnConfig); err != nil {
|
||||
return fmt.Errorf("write wg-quick file: %w", err)
|
||||
return fmt.Errorf("writing wg-quick file: %w", err)
|
||||
}
|
||||
|
||||
if flags.autoconfigureWG {
|
||||
|
|
|
@ -71,7 +71,7 @@ func verify(ctx context.Context, cmd *cobra.Command, provider cloudprovider.Prov
|
|||
}
|
||||
if _, err := protoClient.GetState(ctx); err != nil {
|
||||
if err, ok := rpcStatus.FromError(err); ok {
|
||||
return fmt.Errorf("unable to verify Constellation cluster: %s", err.Message())
|
||||
return fmt.Errorf("verifying Constellation cluster: %s", err.Message())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
}
|
||||
op, err := c.insertInstanceTemplate(ctx, nodeTemplateInput)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting instanceTemplate failed: %w", err)
|
||||
return fmt.Errorf("inserting instanceTemplate: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.nodeTemplate = nodeTemplateInput.Name
|
||||
|
@ -64,7 +64,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
}
|
||||
op, err = c.insertInstanceTemplate(ctx, coordinatorTemplateInput)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting instanceTemplate failed: %w", err)
|
||||
return fmt.Errorf("inserting instanceTemplate: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.coordinatorTemplate = coordinatorTemplateInput.Name
|
||||
|
@ -83,7 +83,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
}
|
||||
op, err = c.insertInstanceGroupManger(ctx, coordinatorGroupInput)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting instanceGroupManager failed: %w", err)
|
||||
return fmt.Errorf("inserting instanceGroupManager: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.coordinatorInstanceGroup = coordinatorGroupInput.Name
|
||||
|
@ -98,7 +98,7 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
}
|
||||
op, err = c.insertInstanceGroupManger(ctx, nodeGroupInput)
|
||||
if err != nil {
|
||||
return fmt.Errorf("inserting instanceGroupManager failed: %w", err)
|
||||
return fmt.Errorf("inserting instanceGroupManager: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.nodesInstanceGroup = nodeGroupInput.Name
|
||||
|
@ -108,18 +108,18 @@ func (c *Client) CreateInstances(ctx context.Context, input CreateInstancesInput
|
|||
}
|
||||
|
||||
if err := c.waitForInstanceGroupScaling(ctx, c.nodesInstanceGroup); err != nil {
|
||||
return fmt.Errorf("waiting for instanceGroupScaling failed: %w", err)
|
||||
return fmt.Errorf("waiting for instanceGroupScaling: %w", err)
|
||||
}
|
||||
|
||||
if err := c.waitForInstanceGroupScaling(ctx, c.coordinatorInstanceGroup); err != nil {
|
||||
return fmt.Errorf("waiting for instanceGroupScaling failed: %w", err)
|
||||
return fmt.Errorf("waiting for instanceGroupScaling: %w", err)
|
||||
}
|
||||
|
||||
if err := c.getInstanceIPs(ctx, c.nodesInstanceGroup, c.nodes); err != nil {
|
||||
return fmt.Errorf("failed to get instanceIPs: %w", err)
|
||||
return fmt.Errorf("getting instanceIPs: %w", err)
|
||||
}
|
||||
if err := c.getInstanceIPs(ctx, c.coordinatorInstanceGroup, c.coordinators); err != nil {
|
||||
return fmt.Errorf("failed to get instanceIPs: %w", err)
|
||||
return fmt.Errorf("getting instanceIPs: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ func (c *Client) TerminateInstances(ctx context.Context) error {
|
|||
if c.nodesInstanceGroup != "" {
|
||||
op, err := c.deleteInstanceGroupManager(ctx, c.nodesInstanceGroup)
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting instanceGroupManager '%s' failed: %w", c.nodesInstanceGroup, err)
|
||||
return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.nodesInstanceGroup, err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.nodesInstanceGroup = ""
|
||||
|
@ -140,7 +140,7 @@ func (c *Client) TerminateInstances(ctx context.Context) error {
|
|||
if c.coordinatorInstanceGroup != "" {
|
||||
op, err := c.deleteInstanceGroupManager(ctx, c.coordinatorInstanceGroup)
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting instanceGroupManager '%s' failed: %w", c.coordinatorInstanceGroup, err)
|
||||
return fmt.Errorf("deleting instanceGroupManager '%s': %w", c.coordinatorInstanceGroup, err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.coordinatorInstanceGroup = ""
|
||||
|
@ -154,7 +154,7 @@ func (c *Client) TerminateInstances(ctx context.Context) error {
|
|||
if c.nodeTemplate != "" {
|
||||
op, err := c.deleteInstanceTemplate(ctx, c.nodeTemplate)
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting instanceTemplate failed: %w", err)
|
||||
return fmt.Errorf("deleting instanceTemplate: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.nodeTemplate = ""
|
||||
|
@ -162,7 +162,7 @@ func (c *Client) TerminateInstances(ctx context.Context) error {
|
|||
if c.coordinatorTemplate != "" {
|
||||
op, err := c.deleteInstanceTemplate(ctx, c.coordinatorTemplate)
|
||||
if err != nil {
|
||||
return fmt.Errorf("deleting instanceTemplate failed: %w", err)
|
||||
return fmt.Errorf("deleting instanceTemplate: %w", err)
|
||||
}
|
||||
ops = append(ops, op)
|
||||
c.coordinatorTemplate = ""
|
||||
|
|
|
@ -14,7 +14,7 @@ func (c *Client) addIAMPolicyBindings(ctx context.Context, input AddIAMPolicyBin
|
|||
}
|
||||
policy, err := c.projectsAPI.GetIamPolicy(ctx, getReq)
|
||||
if err != nil {
|
||||
return fmt.Errorf("retrieving current iam policy failed: %w", err)
|
||||
return fmt.Errorf("retrieving current iam policy: %w", err)
|
||||
}
|
||||
for _, binding := range input.Bindings {
|
||||
addIAMPolicy(policy, binding)
|
||||
|
@ -24,7 +24,7 @@ func (c *Client) addIAMPolicyBindings(ctx context.Context, input AddIAMPolicyBin
|
|||
Policy: policy,
|
||||
}
|
||||
if _, err := c.projectsAPI.SetIamPolicy(ctx, setReq); err != nil {
|
||||
return fmt.Errorf("setting new iam policy failed: %w", err)
|
||||
return fmt.Errorf("setting new iam policy: %w", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ func (c *Client) TerminateServiceAccount(ctx context.Context) error {
|
|||
Name: "projects/-/serviceAccounts/" + c.serviceAccount,
|
||||
}
|
||||
if err := c.iamAPI.DeleteServiceAccount(ctx, req); err != nil {
|
||||
return fmt.Errorf("deleting service account failed: %w", err)
|
||||
return fmt.Errorf("deleting service account: %w", err)
|
||||
}
|
||||
c.serviceAccount = ""
|
||||
}
|
||||
|
@ -81,11 +81,11 @@ func (c *Client) createServiceAccountKey(ctx context.Context, email string) (gcp
|
|||
req := createServiceAccountKeyRequest(email)
|
||||
key, err := c.iamAPI.CreateServiceAccountKey(ctx, req)
|
||||
if err != nil {
|
||||
return gcpshared.ServiceAccountKey{}, fmt.Errorf("creating service account key failed: %w", err)
|
||||
return gcpshared.ServiceAccountKey{}, fmt.Errorf("creating service account key: %w", err)
|
||||
}
|
||||
var serviceAccountKey gcpshared.ServiceAccountKey
|
||||
if err := json.Unmarshal(key.PrivateKeyData, &serviceAccountKey); err != nil {
|
||||
return gcpshared.ServiceAccountKey{}, fmt.Errorf("decoding service account key JSON failed: %w", err)
|
||||
return gcpshared.ServiceAccountKey{}, fmt.Errorf("decoding service account key JSON: %w", err)
|
||||
}
|
||||
|
||||
return serviceAccountKey, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue