diff --git a/.travis.yml b/.travis.yml index 31a7aa6..febaa11 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,18 +23,8 @@ matrix: dist: trusty bundler_args: script: bundle exec rake validate - - rvm: default - env: BEAKER_set="centos6-docker" - dist: trusty - bundler_args: - script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb - rvm: default env: BEAKER_set="centos7-docker" dist: trusty bundler_args: script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb - - rvm: default - env: BEAKER_set="ubuntu16-docker" - dist: trusty - bundler_args: - script: sudo service docker restart ; sleep 10 && bundle exec rspec spec/acceptance/*_spec.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index ab52a65..bfb28f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # CHANGELOG +## 0.4.18 + +* xtrabackup install needs to happen after mysql deployment +* added GPG for Percona: RPM-GPG-KEY-Percona + ## 0.4.17 * Added option to handle extra options for mysqldump diff --git a/examples/mysqldump_extraopts.pp b/examples/mysqldump_extraopts.pp index f9bf7e9..3ffe1c9 100644 --- a/examples/mysqldump_extraopts.pp +++ b/examples/mysqldump_extraopts.pp @@ -7,5 +7,5 @@ mysql::backup::mysqldump { 'test': destination => '/backup', - extraopts => '--quick', + extraopts => '--quick', } diff --git a/files/percona/GPG-key-percona b/files/percona/GPG-key-percona new file mode 100644 index 0000000..1c78566 --- /dev/null +++ b/files/percona/GPG-key-percona @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1.4.9 (GNU/Linux) + +mQGiBEsm3aERBACyB1E9ixebIMRGtmD45c6c/wi2IVIa6O3G1f6cyHH4ump6ejOi +AX63hhEs4MUCGO7KnON1hpjuNN7MQZtGTJC0iX97X2Mk+IwB1KmBYN9sS/OqhA5C +itj2RAkug4PFHR9dy21v0flj66KjBS3GpuOadpcrZ/k0g7Zi6t7kDWV0hwCgxCa2 +f/ES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Rj5CFUKRpShfDIiow9qxtqv7yVd514Qqmjb4 +eEihtcjltGAoS54+6C3lbjrHUQhLwPGqlAh8uZKzfSZq0C06kTxiEqsG6VDDYWy6 +L7qaMwOqWdQtdekKiCk8w/FoovsMYED2qlWEt0i52G+0CjoRFx2zNsN3v4dWiIhk +ZSL00Mx+g3NA7pQ1Yo5Vhok034mP8L2fBLhhWaK3LG63jYvd0HLkUFhNG+xjkpeI +SQQYEQIACQUCSybdoQIbDAAKCRAcTL3NzS79KlacAJ0aAkBQapIaHNvmAhtVjLPN +wke4ZgCePe3sPPF49lBal7QaYPdjqapa1SQ= +=qcCk +-----END PGP PUBLIC KEY BLOCK----- diff --git a/manifests/backup/xtrabackup.pp b/manifests/backup/xtrabackup.pp index 55bdd8f..007b7c2 100644 --- a/manifests/backup/xtrabackup.pp +++ b/manifests/backup/xtrabackup.pp @@ -79,6 +79,7 @@ # if(!defined(Class['mysql::backup::xtrabackup::install'])) { + Service <| tag == 'mysqlservice' |> -> class { 'mysql::backup::xtrabackup::install': version => $xtrabackup_version, } diff --git a/manifests/community/service.pp b/manifests/community/service.pp index 08b75ae..d46f92e 100644 --- a/manifests/community/service.pp +++ b/manifests/community/service.pp @@ -18,6 +18,7 @@ service { "mysqlcommunity@${instance_name}": ensure => $service_ensure, enable => $service_enable, + tag => 'mysqlservice', } } } diff --git a/manifests/perconarepo.pp b/manifests/perconarepo.pp index d5623c9..abc4c52 100644 --- a/manifests/perconarepo.pp +++ b/manifests/perconarepo.pp @@ -7,6 +7,23 @@ path => '/usr/sbin:/usr/bin:/sbin:/bin', } + $percona_gpg_path='/etc/pki/rpm-gpg/RPM-GPG-KEY-Percona' + + file { $percona_gpg_path: + ensure => 'present', + owner => 'root', + group => 'root', + mode => '0644', + content => file("${module_name}/percona/GPG-key-percona"), + } + + exec { 'import-percona-gpg': + command => "rpm --import ${percona_gpg_path}", + path => ['/bin', '/usr/bin'], + unless => "rpm -q gpg-pubkey-$(gpg --throw-keyids ${percona_gpg_path} | grep pub | cut -c 12-19 | tr '[A-Z]' '[a-z]')", + require => File[$percona_gpg_path], + } + exec { "mysql perconarepo srcdir ${srcdir}": command => "mkdir -p ${srcdir}", creates => $srcdir, @@ -28,7 +45,7 @@ ensure => $package_ensure, provider => $mysql::params::package_provider, source => "${srcdir}/repo_perconarepo.${mysql::params::package_provider}", - require => Exec['wget perconarepo'], + require => Exec[['wget perconarepo','import-percona-gpg']], notify => Exec['perconarepo install update'], } diff --git a/manifests/xtradbcluster/service.pp b/manifests/xtradbcluster/service.pp index 43b29f2..491cf4a 100644 --- a/manifests/xtradbcluster/service.pp +++ b/manifests/xtradbcluster/service.pp @@ -17,6 +17,7 @@ service { "xtradbcluster@${instance_name}": ensure => $service_ensure, enable => $service_enable, + tag => 'mysqlservice', } } } diff --git a/metadata.json b/metadata.json index f292bfe..7534099 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "eyp-mysql", - "version": "0.4.17", + "version": "0.4.18", "author": "eyp", "summary": "multi instance mysql community and Percona XtraDB cluster (galera)", "license": "Apache-2.0", diff --git a/spec/acceptance/base_spec.rb b/spec/acceptance/base_spec.rb deleted file mode 100644 index 67879b8..0000000 --- a/spec/acceptance/base_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require 'spec_helper_acceptance' -require_relative './version.rb' - -describe 'mysql class' do - - context 'basic setup' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOF - - class { 'mysql': } - - EOF - - # Run it twice and test for idempotency - expect(apply_manifest(pp).exit_code).to_not eq(1) - expect(apply_manifest(pp).exit_code).to eq(0) - end - - end -end diff --git a/spec/acceptance/community_instance_mysqldump_spec.rb b/spec/acceptance/community_instance_mysqldump_spec.rb index 6072826..675c15d 100644 --- a/spec/acceptance/community_instance_mysqldump_spec.rb +++ b/spec/acceptance/community_instance_mysqldump_spec.rb @@ -51,7 +51,7 @@ its(:content) { should match '[mysqld]' } end - describe file("/etc/mysql/test/my.cnf") do + describe file("/etc/mysql/test_mysqldump/my.cnf") do it { should be_file } its(:content) { should match '[mysqld]' } end diff --git a/spec/acceptance/community_instance_xtrabackup_spec.rb b/spec/acceptance/community_instance_xtrabackup_spec.rb index e13c9a8..3638702 100644 --- a/spec/acceptance/community_instance_xtrabackup_spec.rb +++ b/spec/acceptance/community_instance_xtrabackup_spec.rb @@ -25,18 +25,21 @@ pp = <<-EOF mysql::community::instance { 'test_xtrabackup': - port => '3308', + port => '3408', password => 'password', add_default_mycnf => true, default_instance => true, } - -> - mysql::backup::xtrabackup { 'test_xtrabackup': destination => '/backup', } + mysql_database { 'et2blog': + ensure => 'present', + instance_name => 'test_xtrabackup', + } + EOF # Run it twice and test for idempotency @@ -50,7 +53,7 @@ end it "check db and mysql access" do - expect(shell("echo show databases | mysql | grep et2blog").exit_code).to be_zero + expect(shell("echo show databases | mysql --defaults-group-suffix=test_xtrabackup | grep et2blog").exit_code).to be_zero end #instance tomcat-8080 HTTP connector @@ -63,7 +66,7 @@ its(:content) { should match '[mysqld]' } end - describe file("/etc/mysql/test/my.cnf") do + describe file("/etc/mysql/test_xtrabackup/my.cnf") do it { should be_file } its(:content) { should match '[mysqld]' } end diff --git a/spec/acceptance/zz_percona_toolkit_spec.rb b/spec/acceptance/zz_percona_toolkit_spec.rb deleted file mode 100644 index b7d8e4f..0000000 --- a/spec/acceptance/zz_percona_toolkit_spec.rb +++ /dev/null @@ -1,54 +0,0 @@ -require 'spec_helper_acceptance' - -describe 'percona toolkit class' do - context 'basic setup ' do - it 'should work with no errors' do - pp = <<-EOF - - package { 'mysql-community-server': - ensure => 'absent', - } - - EOF - - # Run it twice and test for idempotency - expect(apply_manifest(pp).exit_code).to_not eq(1) - expect(apply_manifest(pp).exit_code).to eq(0) - - end - - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOF - - class { 'mysql::tools::perconatoolkit': } - - EOF - - # Run it twice and test for idempotency - expect(apply_manifest(pp).exit_code).to_not eq(1) - expect(apply_manifest(pp).exit_code).to eq(0) - - end - - it "check pt-query-digest" do - expect(shell("echo | pt-query-digest").exit_code).to be_zero - end - - it 'should work with no errors' do - pp = <<-EOF - - class { 'mysql::tools::perconatoolkit': - package_ensure => 'absent', - } - - EOF - - # Run it twice and test for idempotency - expect(apply_manifest(pp).exit_code).to_not eq(1) - expect(apply_manifest(pp).exit_code).to eq(0) - end - end -end - -#echo | pt-query-digest