Skip to content

Commit

Permalink
Merge branch 'master' into argocd-cli-core-flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mangaal authored Mar 27, 2024
2 parents 22e28e2 + 442dac1 commit 2610292
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/user-guide/sync-options.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sync Options

Argo CD allows users to customize some aspects of how it syncs the desired state in the target cluster. Some Sync Options can defined as annotations in a specific resource. Most of the Sync Options are configured in the Application resource `spec.syncPolicy.syncOptions` attribute. Multiple Sync Options which are configured with the `argocd.argoproj.io/sync-options` annotation can be concatenated with a `,` in the annotation value; white spaces will be trimmed.
Argo CD allows users to customize some aspects of how it syncs the desired state in the target cluster. Some Sync Options can be defined as annotations in a specific resource. Most of the Sync Options are configured in the Application resource `spec.syncPolicy.syncOptions` attribute. Multiple Sync Options which are configured with the `argocd.argoproj.io/sync-options` annotation can be concatenated with a `,` in the annotation value; white spaces will be trimmed.

Below you can find details about each available Sync Option:

Expand Down
18 changes: 9 additions & 9 deletions util/gpg/gpg.go
Original file line number Diff line number Diff line change
Expand Up @@ -718,14 +718,14 @@ func SyncKeyRingFromDirectory(basePath string) ([]string, []string, error) {
return nil
})
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error walk path: %w", err)
}

// Collect GPG keys installed in the key ring
installed := make(map[string]*appsv1.GnuPGPublicKey)
keys, err := GetInstalledPGPKeys(nil)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error get installed PGP keys: %w", err)
}
for _, v := range keys {
installed[v.KeyID] = v
Expand All @@ -736,16 +736,16 @@ func SyncKeyRingFromDirectory(basePath string) ([]string, []string, error) {
if _, ok := installed[key]; !ok {
addedKey, err := ImportPGPKeys(path.Join(basePath, key))
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error import PGP keys: %w", err)
}
if len(addedKey) != 1 {
return nil, nil, fmt.Errorf("Invalid key found in %s", path.Join(basePath, key))
return nil, nil, fmt.Errorf("invalid key found in %s", path.Join(basePath, key))
}
importedKey, err := GetInstalledPGPKeys([]string{addedKey[0].KeyID})
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error get installed PGP keys: %w", err)
} else if len(importedKey) != 1 {
return nil, nil, fmt.Errorf("Could not get details of imported key ID %s", importedKey)
return nil, nil, fmt.Errorf("could not get details of imported key ID %s", importedKey)
}
newKeys = append(newKeys, key)
fingerprints = append(fingerprints, importedKey[0].Fingerprint)
Expand All @@ -756,12 +756,12 @@ func SyncKeyRingFromDirectory(basePath string) ([]string, []string, error) {
for key := range installed {
secret, err := IsSecretKey(key)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error check secret key: %w", err)
}
if _, ok := configured[key]; !ok && !secret {
err := DeletePGPKey(key)
if err != nil {
return nil, nil, err
return nil, nil, fmt.Errorf("error delete PGP keys: %w", err)
}
removedKeys = append(removedKeys, key)
}
Expand All @@ -772,5 +772,5 @@ func SyncKeyRingFromDirectory(basePath string) ([]string, []string, error) {
_ = SetPGPTrustLevelById(fingerprints, TrustUltimate)
}

return newKeys, removedKeys, err
return newKeys, removedKeys, nil
}

0 comments on commit 2610292

Please sign in to comment.