-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(services): don't manage them in mode=none
- Loading branch information
1 parent
15d4810
commit e094946
Showing
10 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# InSpec Profile: `mode-eq-none` | ||
|
||
This shows the implementation of the `mode-eq-none` InSpec [profile](https://github.com/inspec/inspec/blob/master/docs/profiles.md). | ||
|
||
## Verify a profile | ||
|
||
InSpec ships with built-in features to verify a profile structure. | ||
|
||
```bash | ||
$ inspec check mode-eq-none | ||
Summary | ||
------- | ||
Location: mode-eq-none | ||
Profile: profile | ||
Controls: 4 | ||
Timestamp: 2019-06-24T23:09:01+00:00 | ||
Valid: true | ||
|
||
Errors | ||
------ | ||
|
||
Warnings | ||
-------- | ||
``` | ||
|
||
## Execute a profile | ||
|
||
To run all **supported** controls on a local machine use `inspec exec /path/to/profile`. | ||
|
||
```bash | ||
$ inspec exec mode-eq-none | ||
.. | ||
|
||
Finished in 0.0025 seconds (files took 0.12449 seconds to load) | ||
8 examples, 0 failures | ||
``` | ||
|
||
## Execute a specific control from a profile | ||
|
||
To run one control from the profile use `inspec exec /path/to/profile --controls name`. | ||
|
||
```bash | ||
$ inspec exec mode-eq-none --controls package | ||
. | ||
|
||
Finished in 0.0025 seconds (files took 0.12449 seconds to load) | ||
1 examples, 0 failures | ||
``` | ||
|
||
See an [example control here](https://github.com/inspec/inspec/blob/master/examples/profile/controls/example.rb). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
config_dir = '/etc/nut' | ||
config_dir = '/etc/ups' if %w[redhat fedora suse].include? os.family | ||
|
||
nut_user = nut_group = 'nut' | ||
nut_user = nut_group = 'upsd' if %w[suse].include? os.family | ||
|
||
control 'nut configuration' do | ||
title 'should match desired lines' | ||
|
||
describe file("#{config_dir}/nut.conf") do | ||
it { should be_file } | ||
it { should be_owned_by nut_user } | ||
it { should be_grouped_into nut_group } | ||
its('mode') { should cmp '0640' } | ||
its('content') { should include '# Your changes will be overwritten.' } | ||
its('content') { should match '^MODE=none' } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
control 'nut-server service' do | ||
impact 0.5 | ||
title 'should not be running' | ||
|
||
describe service('nut-server') do | ||
it { should_not be_running } | ||
end | ||
end | ||
|
||
control 'nut-monitor service' do | ||
impact 0.5 | ||
title 'should not be running' | ||
|
||
describe service('nut-monitor') do | ||
it { should_not be_running } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
name: mode-eq-none | ||
title: nut formula | ||
maintainer: SaltStack Formulas | ||
license: Apache-2.0 | ||
summary: Verify that the nut services are not started in mode='none' | ||
supports: | ||
- platform-name: debian | ||
- platform-name: ubuntu | ||
- platform-name: centos | ||
- platform-name: fedora | ||
- platform-name: opensuse | ||
- platform-name: suse | ||
- platform-name: freebsd | ||
- platform-name: arch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# vim: ft=yaml | ||
--- | ||
nut: | ||
mode: none |