Skip to content

Commit

Permalink
Merge pull request #86 from jeremymv2/sudo_command
Browse files Browse the repository at this point in the history
support for sudo_command
  • Loading branch information
chris-rock committed May 16, 2016
2 parents 9b759d1 + 286e999 commit d194a25
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions lib/kitchen/verifier/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 2 additions & 0 deletions spec/kitchen/verifier/inspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@

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(
hash_including(
'backend' => 'ssh',
'logger' => logger,
'sudo' => 'jellybeans',
'sudo_command' => 'allyourbase',
'host' => 'boogie',
'port' => 123,
'user' => 'dance',
Expand Down

0 comments on commit d194a25

Please sign in to comment.