Skip to content

Instantly share code, notes, and snippets.

@Sauraus
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sauraus/5360e2871603b5e7b168 to your computer and use it in GitHub Desktop.
Save Sauraus/5360e2871603b5e7b168 to your computer and use it in GitHub Desktop.
directory content serverspec test
/etc/yum.repos.d/base.repo
/etc/yum.repos.d/updates.repo
/etc/yum.repos.d/extras.repo
veryfing centos yum channel repositories
File "/etc/yum.repos.d/base.repo"
should exist
should be owned by "root"
should be grouped into "root"
File "/etc/yum.repos.d/updates.repo"
should exist
should be owned by "root"
should be grouped into "root"
File "/etc/yum.repos.d/extras.repo"
should exist
should be owned by "root"
should be grouped into "root"
File "/etc/yum.repos.d/"
should contain "base.repo", "updates.repo", and "extras.repo" (FAILED - 1)
Failures:
1) yum-centos::default veryfing centos yum channel repositories File "/etc/yum.repos.d/" should contain "base.repo", "updates.repo", and "extras.repo"
Failure/Error: it { should contain repos }
expected File "/etc/yum.repos.d/" to contain "base.repo", "updates.repo", and "extras.repo"
# /tmp/verifier/suites/serverspec/default_spec.rb:38:in `block (4 levels) in <top (required)>'
puts ::Dir['/etc/yum.repos.d/*']
repos = %w(base updates extras)
repos.each do |repo|
describe file("/etc/yum.repos.d/#{repo}.repo") do
it { should exist }
it { should be_owned_by 'root' }
it { should be_grouped_into 'root' }
end
end
repos.map! {|repo| "#{repo}.repo"}
describe file("/etc/yum.repos.d/") do
it { should contain repos }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment