fixed bug in etcd retention where backups are not sorted by date (#6860)

* fixed bug in etcd retention where backups are not sorted by date

* added directory filter to find command
This commit is contained in:
axelgobletbdr 2020-10-28 17:09:57 +01:00 committed by GitHub
parent d36b5d7d55
commit 097bec473c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,5 +62,5 @@
- name: Remove old etcd backups
shell:
chdir: "{{ etcd_backup_prefix }}"
cmd: "find . -name 'etcd-*' | head -n -{{ etcd_backup_retention_count }} | xargs rm -rf"
cmd: "find . -name 'etcd-*' -type d | sort -n | head -n -{{ etcd_backup_retention_count }} | xargs rm -rf"
when: etcd_backup_retention_count >= 0