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 resource not accessible within a describe #451

Closed
jeremymv2 opened this issue Feb 11, 2016 · 2 comments
Closed

os resource not accessible within a describe #451

jeremymv2 opened this issue Feb 11, 2016 · 2 comments
Labels
Type: Bug Feature not working as expected

Comments

@jeremymv2
Copy link
Contributor

For the purpose of not having to duplicate describe items, would it be possible to make the os resource available inside a describe? This way you can write a concise and elegant test that handles different architectures and releases, all from within a single describe.

For example:

describe file('/etc/ssh/sshd_config') do
  its('content') { should match('ChallengeResponseAuthentication no') }
  its('content') { should match('UsePAM yes') }
  its('content') { should match('PasswordAuthentication no') }
  if os.redhat?
    its('content') { should match("Subsystem sftp /usr/libexec/openssh/sftp-server") }
    if os[:release].to_f >= 7
       its('content') { should match("UsePrivilegeSeparation sandbox") }
       its('content') { should match("HostKey /etc/ssh/ssh_host_rsa_key") }
       its('content') { should match("HostKey /etc/ssh/ssh_host_ecdsa_key") }
    end
  end
end
@jeremymv2 jeremymv2 changed the title os resource not accessible within an describe os resource not accessible within a describe Feb 11, 2016
@jeremymv2
Copy link
Contributor Author

@chris-rock
For large organizations that have many existing serverspec tests that may include DSL syntax like the above, this will be enticing; making their conversion from serverspec to inspec easier and more delightful.

@chris-rock chris-rock added the Type: Bug Feature not working as expected label Feb 17, 2016
@arlimus
Copy link
Contributor

arlimus commented Jun 28, 2016

Discussion moved to #809 as it potentially solves this problem.

@arlimus arlimus closed this as completed Jun 28, 2016
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

Successfully merging a pull request may close this issue.

3 participants