Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os[:family] returns "centos" rather than "redhat" on my Centos 7.2 box #847

Closed
davidcpell opened this issue Jul 28, 2016 · 1 comment
Closed
Labels
Type: Bug Feature not working as expected
Milestone

Comments

@davidcpell
Copy link
Contributor

Hi all,

Pretty new to inspec so forgive me if I'm just missing something here, but I ran into an issue when writing specs with the service resource where I needed to specify service for my Ubuntu 14.04 box and sysv_service for my Centos 7.2 box (using with test kitchen).

My test:

if os[:family] == 'centos'
  describe sysv_service('zabbix_agentd') do
    it { should be_installed }
    it { should be_running }
    it { should be_running }
  end
else
  describe service('zabbix_agentd') do
    it { should be_installed }
    it { should be_enabled }
    it { should be_running }
  end
end

Note that I've had to compare against 'centos' here because that is the value being returned by os[:family] on my Centos box. However, in the docs the options that can be returned by os[:family] are:

bsd, debian, linux, redhat, solaris, suse, unix, or windows

os[:family] looks like it's meant to function like node['platform_family'] in a Chef recipe but seems to be functioning like node['platform'] for me.

InSpec and Platform Version

Inspec 0.28.0
Mac OSX 10.11.5

Replication Case

  1. With centos-7.2 as a platform, $ kitchen create default-centos-72
  2. Add puts os[:family] in any spec file
  3. $ kitchen verify default-centos-72 will print what is being returned as the family
@chris-rock chris-rock added the Type: Bug Feature not working as expected label Aug 1, 2016
@chris-rock chris-rock added this to the 1.0.0 milestone Aug 1, 2016
@chris-rock
Copy link
Contributor

Thanks @davidcpell for the reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Feature not working as expected
Projects
None yet
Development

No branches or pull requests

3 participants