Commit 3d378c60 authored by Antoine Catton's avatar Antoine Catton

Easily switch from main MariaDB to backup one

parent 92278483
...@@ -75,8 +75,15 @@ class Recipe(object): ...@@ -75,8 +75,15 @@ class Recipe(object):
partition_parameter_kw[config_parameter] = \ partition_parameter_kw[config_parameter] = \
options['config-%s' % config_parameter] options['config-%s' % config_parameter]
name = options['name']
if 'id' in options:
id_ = int(options['id'], 10)
if 'id-increment' in options:
id_ += int(options['id-increment'], 10)
name += '-%03d' % id_
instance = self.request(options['software-url'], software_type, instance = self.request(options['software-url'], software_type,
options['name'], partition_parameter_kw=partition_parameter_kw, name, partition_parameter_kw=partition_parameter_kw,
filter_kw=filter_kw, shared=self.isSlave) filter_kw=filter_kw, shared=self.isSlave)
self.failed = None self.failed = None
......
...@@ -76,7 +76,7 @@ strip-top-level-dir = true ...@@ -76,7 +76,7 @@ strip-top-level-dir = true
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
md5sum = d7a6e9bbde95bf8bbb3f1844aefd789a md5sum = f4e4cf75225685e1787c0bc6d1c16910
mode = 0644 mode = 0644
[template-apache-php] [template-apache-php]
...@@ -90,14 +90,7 @@ mode = 0644 ...@@ -90,14 +90,7 @@ mode = 0644
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-backuped.cfg url = ${:_profile_base_location_}/instance-backuped.cfg
output = ${buildout:directory}/template-backuped.cfg output = ${buildout:directory}/template-backuped.cfg
md5sum = 0fedb9ed84137b2d5518ffbaaa6d76eb md5sum = d2d910986762b52d8ff965292d7c3635
mode = 0644
[template-use-backup]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-use-backup.cfg
output = ${buildout:directory}/template-use-backup.cfg
md5sum = e2e0fe0da5d2944feba0991b8948d04b
mode = 0644 mode = 0644
[template-mariadb] [template-mariadb]
......
...@@ -31,6 +31,7 @@ slave = false ...@@ -31,6 +31,7 @@ slave = false
[request-mariadb] [request-mariadb]
software-type = mariadb-pbsready-export software-type = mariadb-pbsready-export
id = $${slap-parameter:mariadb-id}
config = authorized-key notify config = authorized-key notify
config-authorized-key = $${request-pull-backup-server:connection-ssh-key} config-authorized-key = $${request-pull-backup-server:connection-ssh-key}
config-notify = $${request-pull-backup-server:connection-notification-url} config-notify = $${request-pull-backup-server:connection-notification-url}
...@@ -39,7 +40,9 @@ return = url ssh-public-key ssh-url notification-id ...@@ -39,7 +40,9 @@ return = url ssh-public-key ssh-url notification-id
[request-mariadb-pseudo-replicating] [request-mariadb-pseudo-replicating]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:request recipe = slapos.cookbook:request
name = MariaDB (backup) name = $${request-mariadb:name}
id = $${request-mariadb:id}
id-increment = 1
software-url = $${slap-connection:software-release-url} software-url = $${slap-connection:software-release-url}
software-type = mariadb-pbsready-import software-type = mariadb-pbsready-import
return = url ssh-public-key ssh-url notification-url return = url ssh-public-key ssh-url notification-url
......
[buildout]
extends =
${template-backuped:output}
[mariadb-urlparse]
recipe = slapos.cookbook:urlparse
url = $${request-mariadb-pseudo-replicating:connection-url}
[request-mariadb]
software-type = mariadb-pbsready-import
[request-mariadb-pseudo-replicating]
software-type = mariadb-pbsready-export
[request-pull-backup-server-mariadb]
config-type = push
[request-pull-backup-server-mariadb-backup]
config-type = pull
...@@ -10,7 +10,6 @@ offline = true ...@@ -10,7 +10,6 @@ offline = true
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
default = ${template-apache-php:output} default = ${template-apache-php:output}
backuped = ${template-backuped:output} backuped = ${template-backuped:output}
use-backup = ${template-use-backup:output}
mariadb = ${template-mariadb:output} mariadb = ${template-mariadb:output}
mariadb-pbsready-import = ${template-mariadb-pbsready-import:output} mariadb-pbsready-import = ${template-mariadb-pbsready-import:output}
mariadb-pbsready-export = ${template-mariadb-pbsready-export:output} mariadb-pbsready-export = ${template-mariadb-pbsready-export:output}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment