|
6 | 6 | multicast_address: '239.1.1.2' }
|
7 | 7 | end
|
8 | 8 |
|
| 9 | + auth_command = if fact('default_provider') == 'pcs' |
| 10 | + if Gem::Version.new(fact('pcs_version')) < Gem::Version.new('0.10.0') |
| 11 | + 'pcs cluster auth' |
| 12 | + else |
| 13 | + 'pcs host auth' |
| 14 | + end |
| 15 | + else |
| 16 | + 'pcs cluster auth' |
| 17 | + end |
| 18 | + cluster_name_arg = if fact('default_provider') == 'pcs' |
| 19 | + if Gem::Version.new(fact('pcs_version')) < Gem::Version.new('0.10.0') |
| 20 | + '--name' |
| 21 | + else |
| 22 | + '' |
| 23 | + end |
| 24 | + else |
| 25 | + '--name' |
| 26 | + end |
| 27 | + |
9 | 28 | shared_examples_for 'corosync' do
|
10 | 29 | it { is_expected.to compile.with_all_deps }
|
11 | 30 |
|
|
746 | 765 | let(:node) { 'node2.test.org' }
|
747 | 766 |
|
748 | 767 | it 'does not perform the auth' do
|
749 |
| - is_expected.not_to contain_exec('pcs_cluster_auth') |
| 768 | + is_expected.not_to contain_exec('Authorize members') |
750 | 769 | end
|
751 | 770 | end
|
752 | 771 |
|
|
768 | 787 | end
|
769 | 788 |
|
770 | 789 | it 'authorizes all nodes' do
|
771 |
| - is_expected.to contain_exec('pcs_cluster_auth').with( |
772 |
| - command: 'pcs cluster auth node1.test.org node2.test.org node3.test.org -u hacluster -p some-secret-sauce', |
| 790 | + is_expected.to contain_exec('Authorize members').with( |
| 791 | + command: "#{auth_command} node1.test.org node2.test.org node3.test.org -u hacluster -p some-secret-sauce", |
773 | 792 | path: '/sbin:/bin:/usr/sbin:/usr/bin',
|
774 | 793 | require: [
|
775 | 794 | 'Service[pcsd]',
|
776 | 795 | 'User[hacluster]'
|
777 | 796 | ]
|
778 | 797 | )
|
779 | 798 | end
|
| 799 | + context 'with pcs 0.10.0' do |
| 800 | + let(:params) do |
| 801 | + super().merge( |
| 802 | + 'version_pcs' => '0.10.0' |
| 803 | + ) |
| 804 | + end |
| 805 | + |
| 806 | + it 'authorizes all nodes' do |
| 807 | + is_expected.to contain_exec('Authorize members').with( |
| 808 | + command: 'pcs host auth node1.test.org node2.test.org node3.test.org -u hacluster -p some-secret-sauce', |
| 809 | + path: '/sbin:/bin:/usr/sbin:/usr/bin', |
| 810 | + require: [ |
| 811 | + 'Service[pcsd]', |
| 812 | + 'User[hacluster]' |
| 813 | + ] |
| 814 | + ) |
| 815 | + end |
| 816 | + end |
780 | 817 | end
|
781 | 818 |
|
782 | 819 | context 'using an ip baseid node list' do
|
|
800 | 837 | let(:facts) { override_facts(super(), networking: { ip: '192.168.0.10' }) }
|
801 | 838 |
|
802 | 839 | it 'match ip and auth nodes by member names' do
|
803 |
| - is_expected.to contain_exec('pcs_cluster_auth').with( |
| 840 | + is_expected.to contain_exec('Authorize members').with( |
804 | 841 | command: 'pcs cluster auth 192.168.0.10 192.168.0.12 192.168.0.13 -u hacluster -p some-secret-sauce',
|
805 | 842 | path: '/sbin:/bin:/usr/sbin:/usr/bin',
|
806 | 843 | require: [
|
|
827 | 864 | end
|
828 | 865 |
|
829 | 866 | it 'still detects that this is the auth-node' do
|
830 |
| - is_expected.to contain_exec('pcs_cluster_auth') |
| 867 | + is_expected.to contain_exec('Authorize members') |
831 | 868 | end
|
832 | 869 | end
|
833 | 870 | end
|
|
909 | 946 | end
|
910 | 947 |
|
911 | 948 | it 'does not attempt to authorize or configure the quorum node' do
|
912 |
| - is_expected.not_to contain_exec('pcs_cluster_auth_qdevice') |
| 949 | + is_expected.not_to contain_exec('Authorize qdevice') |
913 | 950 | is_expected.not_to contain_exec('pcs_cluster_add_qdevice')
|
914 | 951 | end
|
915 | 952 | end
|
|
950 | 987 | end
|
951 | 988 |
|
952 | 989 | it 'does not authorize or add the quorum device' do
|
953 |
| - is_expected.not_to contain_exec('pcs_cluster_auth_qdevice') |
| 990 | + is_expected.not_to contain_exec('Authorize qdevice') |
954 | 991 | is_expected.not_to contain_exec('pcs_cluster_add_qdevice')
|
955 | 992 | end
|
956 | 993 | end
|
|
973 | 1010 |
|
974 | 1011 | it 'configures a temporary cluster if corosync.conf is missing' do
|
975 | 1012 | is_expected.to contain_exec('pcs_cluster_temporary').with(
|
976 |
| - command: 'pcs cluster setup --force --name cluster_test node1.test.org node2.test.org node3.test.org', |
| 1013 | + command: "pcs cluster setup --force #{cluster_name_arg} cluster_test node1.test.org node2.test.org node3.test.org", |
977 | 1014 | path: '/sbin:/bin:/usr/sbin:/usr/bin',
|
978 | 1015 | onlyif: 'test ! -f /etc/corosync/corosync.conf',
|
979 |
| - require: 'Exec[pcs_cluster_auth]' |
| 1016 | + require: "Exec['Authorize members']" |
980 | 1017 | )
|
981 | 1018 | end
|
982 | 1019 |
|
983 | 1020 | it 'authorizes and adds the quorum device' do
|
984 |
| - is_expected.to contain_exec('pcs_cluster_auth_qdevice').with( |
985 |
| - command: 'pcs cluster auth quorum1.test.org -u hacluster -p quorum-secret-password', |
| 1021 | + is_expected.to contain_exec('Authorize qdevice').with( |
| 1022 | + command: "#{auth_command} quorum1.test.org -u hacluster -p quorum-secret-password", |
986 | 1023 | path: '/sbin:/bin:/usr/sbin:/usr/bin',
|
987 | 1024 | onlyif: 'test 0 -ne $(grep quorum1.test.org /var/lib/pcsd/tokens >/dev/null 2>&1; echo $?)',
|
988 | 1025 | require: [
|
989 | 1026 | 'Package[corosync-qdevice]',
|
990 |
| - 'Exec[pcs_cluster_auth]', |
| 1027 | + "Exec['Authorize members']", |
991 | 1028 | 'Exec[pcs_cluster_temporary]'
|
992 | 1029 | ]
|
993 | 1030 | )
|
| 1031 | + |
994 | 1032 | is_expected.to contain_exec('pcs_cluster_add_qdevice').with(
|
995 | 1033 | command: 'pcs quorum device add model net host=quorum1.test.org algorithm=ffsplit',
|
996 | 1034 | path: '/sbin:/bin:/usr/sbin:/usr/bin',
|
997 | 1035 | onlyif: [
|
998 | 1036 | 'test 0 -ne $(pcs quorum config | grep "host:" >/dev/null 2>&1; echo $?)'
|
999 | 1037 | ],
|
1000 |
| - require: 'Exec[pcs_cluster_auth_qdevice]' |
| 1038 | + require: "Exec['Authorize qdevice']" |
1001 | 1039 | )
|
1002 | 1040 | end
|
1003 |
| - |
1004 | 1041 | it 'contains the quorum configuration' do
|
1005 | 1042 | is_expected.to contain_file('/etc/corosync/corosync.conf').with_content(
|
1006 | 1043 | %r!quorum {
|
|
0 commit comments