diff --git a/README.md b/README.md index d445e33..8d6a84d 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,14 @@ verifier: name: inspec ``` +Optionally specify sudo and sudo_command +``` +verifier: + name: inspec + sudo: true + sudo_command: 'skittles' +``` + ### Directory Structure By default `kitchen-inspec` expects test to be in `test/integration/%suite%` directory structure (we use Chef as provisioner here): diff --git a/lib/kitchen/verifier/inspec.rb b/lib/kitchen/verifier/inspec.rb index 655ee38..010f368 100644 --- a/lib/kitchen/verifier/inspec.rb +++ b/lib/kitchen/verifier/inspec.rb @@ -143,6 +143,7 @@ def runner_options_for_ssh(config_data) 'logger' => logger, # pass-in sudo config from kitchen verifier 'sudo' => config[:sudo], + 'sudo_command' => config[:sudo_command], 'host' => kitchen[:hostname], 'port' => kitchen[:port], 'user' => kitchen[:username], diff --git a/spec/kitchen/verifier/inspec_spec.rb b/spec/kitchen/verifier/inspec_spec.rb index a58a983..fce7c00 100644 --- a/spec/kitchen/verifier/inspec_spec.rb +++ b/spec/kitchen/verifier/inspec_spec.rb @@ -122,6 +122,7 @@ it 'constructs a Inspec::Runner using transport config data and state' do config[:sudo] = 'jellybeans' + config[:sudo_command] = 'allyourbase' expect(Inspec::Runner).to receive(:new) .with( @@ -129,6 +130,7 @@ 'backend' => 'ssh', 'logger' => logger, 'sudo' => 'jellybeans', + 'sudo_command' => 'allyourbase', 'host' => 'boogie', 'port' => 123, 'user' => 'dance',