Преглед изворни кода

Merge pull request #7 from tcpcloud/mos_compat

MOS packages fix
tags/2016.12
Jakub Pavlik пре 8 година
родитељ
комит
bbfc9e6626
4 измењених фајлова са 50 додато и 12 уклоњено
  1. +3
    -4
      galera/files/bootstrap.sh
  2. +17
    -0
      galera/files/init_bootstrap.sh
  3. +15
    -4
      galera/master.sls
  4. +15
    -4
      galera/slave.sls

+ 3
- 4
galera/files/bootstrap.sh Прегледај датотеку

@@ -1,13 +1,12 @@
{%- from "galera/map.jinja" import slave with context -%}
#!/bin/bash

service {{ slave.service }} start
service {{ service.service }} start

counter=70
counter=60

while [ $counter -gt 0 ]
do
service {{ slave.service }} status
mysql -u {{ service.admin.user }} -p{{ service.admin.password }} -e"quit"
if [[ $? -eq 0 ]]; then
exit 0
fi

+ 17
- 0
galera/files/init_bootstrap.sh Прегледај датотеку

@@ -0,0 +1,17 @@
#!/bin/bash

service {{ service.service }} start

counter=60

while [ $counter -gt 0 ]
do
mysql -u root -e"quit"
if [[ $? -eq 0 ]]; then
exit 0
fi
counter=$(( $counter - 1 ))
sleep 2
done

exit 1

+ 15
- 4
galera/master.sls Прегледај датотеку

@@ -62,27 +62,38 @@ galera_conf_debian:

{%- endif %}

galera_init_script:
file.managed:
- name: /usr/local/sbin/galera_init.sh
- mode: 755
- source: salt://galera/files/init_bootstrap.sh
- defaults:
service: {{ master|yaml }}
- template: jinja

galera_bootstrap_script:
file.managed:
- name: /usr/local/sbin/galera_bootstrap.sh
- mode: 755
- source: salt://galera/files/bootstrap.sh
- defaults:
service: {{ master|yaml }}
- template: jinja

{%- if salt['cmd.run']('test -e /var/lib/mysql/.galera_bootstrap; echo $?') != '0' %}

galera_bootstrap_start_service:
galera_init_start_service:
cmd.run:
- name: /usr/local/sbin/galera_bootstrap.sh
- name: /usr/local/sbin/galera_init.sh
- require:
- file: galera_run_dir
- file: galera_bootstrap_script
- file: galera_init_script

galera_bootstrap_set_root_password:
cmd.run:
- name: mysqladmin password "{{ master.admin.password }}"
- require:
- cmd: galera_bootstrap_start_service
- cmd: galera_init_start_service

mysql_bootstrap_update_maint_password:
cmd.run:

+ 15
- 4
galera/slave.sls Прегледај датотеку

@@ -62,27 +62,38 @@ galera_conf_debian:

{%- endif %}

galera_init_script:
file.managed:
- name: /usr/local/sbin/galera_init.sh
- mode: 755
- source: salt://galera/files/init_bootstrap.sh
- defaults:
service: {{ slave|yaml }}
- template: jinja

galera_bootstrap_script:
file.managed:
- name: /usr/local/sbin/galera_bootstrap.sh
- mode: 755
- defaults:
service: {{ slave|yaml }}
- source: salt://galera/files/bootstrap.sh
- template: jinja

{%- if salt['cmd.run']('test -e /var/lib/mysql/.galera_bootstrap; echo $?') != '0' %}

galera_bootstrap_start_service:
galera_init_start_service:
cmd.run:
- name: /usr/local/sbin/galera_bootstrap.sh
- name: /usr/local/sbin/galera_init.sh
- require:
- file: galera_run_dir
- file: galera_bootstrap_script
- file: galera_init_script

galera_bootstrap_set_root_password:
cmd.run:
- name: mysqladmin password "{{ slave.admin.password }}"
- require:
- cmd: galera_bootstrap_start_service
- cmd: galera_init_start_service

mysql_bootstrap_update_maint_password:
cmd.run:

Loading…
Откажи
Сачувај