diff --git a/data/os/RedHat/8.yaml b/data/os/RedHat/8.yaml new file mode 100644 index 00000000..1b83a5bc --- /dev/null +++ b/data/os/RedHat/8.yaml @@ -0,0 +1,2 @@ +--- +corosync::config_validate_cmd: "/usr/sbin/corosync -c % -t" \ No newline at end of file diff --git a/data/os/RedHat/9.yaml b/data/os/RedHat/9.yaml new file mode 100644 index 00000000..1b83a5bc --- /dev/null +++ b/data/os/RedHat/9.yaml @@ -0,0 +1,2 @@ +--- +corosync::config_validate_cmd: "/usr/sbin/corosync -c % -t" \ No newline at end of file diff --git a/metadata.json b/metadata.json index c849c456..e1e8b8c4 100644 --- a/metadata.json +++ b/metadata.json @@ -11,13 +11,17 @@ { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "7" + "7", + "8", + "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "7" + "7", + "8", + "9" ] }, { diff --git a/spec/classes/corosync_spec.rb b/spec/classes/corosync_spec.rb index ec970c27..f5640b58 100644 --- a/spec/classes/corosync_spec.rb +++ b/spec/classes/corosync_spec.rb @@ -17,12 +17,6 @@ ) end - it 'validates the corosync configuration' do - is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd( - '/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t' - ) - end - context 'validates the corosncy configuration when config_validate_cmd is set' do let(:params) do super().merge( @@ -730,6 +724,27 @@ it_configures 'corosync' + # Check the correct validation command is used for each OS + it 'validates the corosync configuration' do + case os_facts[:os]['family'] + when 'RedHat' + case os_facts[:os]['release']['major'].to_i + when 0..7 + is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd( + '/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t' + ) + else + is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd( + '/usr/sbin/corosync -c % -t' + ) + end + else + is_expected.to contain_file('/etc/corosync/corosync.conf').with_validate_cmd( + '/usr/bin/env COROSYNC_MAIN_CONFIG_FILE=% /usr/sbin/corosync -t' + ) + end + end + # Check default package installations per platform case os_facts[:os]['family'] when 'RedHat'