diff --git a/.travis.yml b/.travis.yml index 42c833a2..db502883 100644 --- a/.travis.yml +++ b/.travis.yml @@ -34,7 +34,7 @@ env: - INSTANCE: default-debian-8-2017-7-py2 - INSTANCE: default-ubuntu-1604-2017-7-py2 # TODO: Enable after improving the formula to work with other than `systemd` - # - INSTANCE: default-centos-6-2017-7-py2 + - INSTANCE: default-centos-6-2017-7-py2 - INSTANCE: default-fedora-28-2017-7-py2 - INSTANCE: default-opensuse-leap-42-2017-7-py2 diff --git a/kitchen.yml b/kitchen.yml index 243c19be..6049eba9 100644 --- a/kitchen.yml +++ b/kitchen.yml @@ -64,7 +64,7 @@ platforms: - name: centos-6-2017-7-py2 driver: image: netmanagers/salt-2017.7-py2:centos-6 - run_options: '--entrypoint /sbin/init' + run_command: /sbin/init - name: fedora-28-2017-7-py2 driver: image: netmanagers/salt-2017.7-py2:fedora-28 diff --git a/pillar.example b/pillar.example index 67e2591f..30755fb6 100644 --- a/pillar.example +++ b/pillar.example @@ -8,10 +8,16 @@ template: # Using bash package and udev service as an example. This allows us to # test the template formula itself. You should set these parameters to # examples that make sense in the contexto of the formula you're writing. + {%- if grains.osfinger == 'CentOS-6' %} + pkg: cronie + service: + name: crond + {%- else %} pkg: bash - config: /etc/template-formula.conf service: name: systemd-udevd + {%- endif %} + config: /etc/template-formula.conf tofs: # The files_switch key serves as a selector for alternative diff --git a/test/integration/default/controls/packages_spec.rb b/test/integration/default/controls/packages_spec.rb index e96ef877..291a2f13 100644 --- a/test/integration/default/controls/packages_spec.rb +++ b/test/integration/default/controls/packages_spec.rb @@ -1,7 +1,13 @@ +# Overide by OS +package_name = 'bash' +if os[:name] == 'centos' and os[:release].start_with?('6') + package_name = 'cronie' +end + control 'Template package' do title 'should be installed' - describe package('bash') do + describe package(package_name) do it { should be_installed } end end diff --git a/test/integration/default/controls/services_spec.rb b/test/integration/default/controls/services_spec.rb index a858660c..3b076555 100644 --- a/test/integration/default/controls/services_spec.rb +++ b/test/integration/default/controls/services_spec.rb @@ -1,3 +1,9 @@ +# Overide by OS +service_name = 'systemd-udevd' +if os[:name] == 'centos' and os[:release].start_with?('6') + service_name = 'crond' +end + # Temporary `if` due to `opensuse-leap-15` bug re: `service` if os[:name] == 'suse' puts "[Skip `service`-based tests due to `opensuse-leap-15` detection bug (see https://github.com/inspec/train/issues/377)]" @@ -6,7 +12,7 @@ impact 0.5 title 'should be running and enabled' - describe service('systemd-udevd') do + describe service(service_name) do it { should be_enabled } it { should be_running } end