From 1cfa3252ce9475c05f4e0df3badb3bb294c9f508 Mon Sep 17 00:00:00 2001 From: Anirudh Gupta Date: Wed, 21 Sep 2016 11:33:17 +0530 Subject: [PATCH 1/3] making the examples in the code consistent with rst docs --- lib/resources/gem.rb | 1 + lib/resources/oneget.rb | 1 + lib/resources/os.rb | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/resources/gem.rb b/lib/resources/gem.rb index c34480a46..3cf04e036 100644 --- a/lib/resources/gem.rb +++ b/lib/resources/gem.rb @@ -9,6 +9,7 @@ module Inspec::Resources example " describe gem('rubocop') do it { should be_installed } + its('version') { should eq '0.33.0' } end " diff --git a/lib/resources/oneget.rb b/lib/resources/oneget.rb index 589c98c99..fea2616a7 100644 --- a/lib/resources/oneget.rb +++ b/lib/resources/oneget.rb @@ -16,6 +16,7 @@ module Inspec::Resources example " describe oneget('zoomit') do it { should be_installed } + its('version') { should eq '1.2.3' } end " diff --git a/lib/resources/os.rb b/lib/resources/os.rb index 9b3b07c47..26ac6faf4 100644 --- a/lib/resources/os.rb +++ b/lib/resources/os.rb @@ -7,7 +7,7 @@ module Inspec::Resources name 'os' desc 'Use the os InSpec audit resource to test the platform on which the system is running.' example " - describe os.family do + describe os[:family] do it { should eq 'redhat' } end From 024027a3a17aceaa0101588844769af7789a7f1d Mon Sep 17 00:00:00 2001 From: Anirudh Gupta Date: Wed, 21 Sep 2016 13:11:23 +0530 Subject: [PATCH 2/3] fixing the debian package manager - when the package is removed but not purged --- lib/resources/package.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/resources/package.rb b/lib/resources/package.rb index 6600149ac..58288e732 100644 --- a/lib/resources/package.rb +++ b/lib/resources/package.rb @@ -91,9 +91,11 @@ module Inspec::Resources assignment_re: /^\s*([^:]*?)\s*:\s*(.*?)\s*$/, multiple_values: false, ).params + # If the package is removed and not purged, Status is "deinstall ok config-files" with exit_status 0 + # If the package is purged cmd fails with non-zero exit status { name: params['Package'], - installed: true, + installed: params['Status'].split(' ').first == 'install' ? true : false, version: params['Version'], type: 'deb', } From a355af670fd8f49062d935a5086711fcf4d14327 Mon Sep 17 00:00:00 2001 From: Anirudh Gupta Date: Wed, 21 Sep 2016 13:41:59 +0530 Subject: [PATCH 3/3] fixup! fixing the debian package manager - when the package is removed but not purged --- lib/resources/package.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resources/package.rb b/lib/resources/package.rb index 58288e732..24666a403 100644 --- a/lib/resources/package.rb +++ b/lib/resources/package.rb @@ -95,7 +95,7 @@ module Inspec::Resources # If the package is purged cmd fails with non-zero exit status { name: params['Package'], - installed: params['Status'].split(' ').first == 'install' ? true : false, + installed: params['Status'].split(' ').first == 'install', version: params['Version'], type: 'deb', }