Add backup command to upgrade

Depends-On: I3ea3cb4342f66da4ead91e945baaddd799522bcf
Change-Id: I95612568b4bcbad52dba95b3275e7465027f3917
This commit is contained in:
Yuriy Taraday 2016-11-16 23:50:03 +03:00
parent d4e93847cd
commit 8ce8211722
2 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,6 @@
#!/bin/bash -ex
set -o pipefail
BACKUP_FILE="/var/ccp/backup/keystone/backup-$(date "+%Y%m%d%H%M%S").sql"
mysqldump -h {{ address(service.database) }} \
-u {{ keystone.db.username }} -p{{ keystone.db.password }} \
--single-transaction {{ keystone.db.name }} > "${BACKUP_FILE}"

View File

@ -2,6 +2,15 @@ upgrade:
name: upgrade-keystone
image: keystone
steps:
- name: backup
command: /opt/ccp/bin/backup.sh
files:
- backup-sh
volumes:
- name: backup-dir
path: /var/ccp/backup/keystone
type: host
readOnly: false
- name: expand
files:
- keystone-conf
@ -20,3 +29,7 @@ files:
keystone-conf:
path: /etc/keystone/keystone.conf
content: keystone.conf.j2
backup-sh:
path: /opt/ccp/bin/backup.sh
content: backup.sh.j2
perm: "500"