Skip to content

Commit

Permalink
add a warning when ansible_label is not found on a secret. addresses a…
Browse files Browse the repository at this point in the history
  • Loading branch information
kaysond committed Nov 9, 2020
1 parent e691ad7 commit 0de1d39
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/31-docker-secret.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "docker_secret - add a warning when the secret does not have an 'ansible_key' label but the 'force' parameter is not set"
3 changes: 3 additions & 0 deletions plugins/modules/docker_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ def present(self):
if attrs.get('Labels', {}).get('ansible_key'):
if attrs['Labels']['ansible_key'] != self.data_key:
data_changed = True
else:
if not self.force:
self.client.module.warn("'ansible_key' label not found. Secret will not be changed unless the force parameter is set to 'yes'")
labels_changed = not compare_generic(self.labels, attrs.get('Labels'), 'allow_more_present', 'dict')
if data_changed or labels_changed or self.force:
# if something changed or force, delete and re-create the secret
Expand Down

0 comments on commit 0de1d39

Please sign in to comment.