You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
jeremymv2
changed the title
os resource not accessible within an describeos resource not accessible within a describeFeb 11, 2016
@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.
For the purpose of not having to duplicate
describe
items, would it be possible to make theos
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 singledescribe
.For example:
The text was updated successfully, but these errors were encountered: