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

fix virtualization usage in older inspec versions #95

Merged
merged 1 commit into from
Jun 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion controls/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@

shadow_group = 'root'
shadow_group = 'shadow' if os.debian? || os.suse?
container_execution = virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError
false
end

blacklist = attribute(
'blacklist',
Expand Down
6 changes: 5 additions & 1 deletion controls/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
# author: Patrick Muench

val_syslog_pkg = attribute('syslog_pkg', default: 'rsyslog', description: 'syslog package to ensure present (default: rsyslog, alternative: syslog-ng...')
container_execution = virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError
false
end

control 'package-01' do
impact 1.0
Expand Down
6 changes: 5 additions & 1 deletion controls/sysctl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@

sysctl_forwarding = attribute('sysctl_forwarding', default: false, description: 'Is network forwarding needed?')
kernel_modules_disabled = attribute('kernel_modules_disabled', default: 0, description: 'Should loading of kernel modules be disabled?')
container_execution = virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
container_execution = begin
virtualization.role == 'guest' && virtualization.system =~ /^(lxc|docker)$/
rescue NoMethodError
false
end

control 'sysctl-01' do
impact 1.0
Expand Down