-
Notifications
You must be signed in to change notification settings - Fork 683
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
Provide service params #721
Conversation
+1 in making info private; is there anything in info, that is not exposed via accessors? anything that shouldn't be exposed via accessors but only via info? |
inspec> s.info
=> {:name=>"sshd.service",
:description=>"OpenSSH server daemon",
:installed=>true,
:running=>true,
:enabled=>true,
:type=>"systemd",
:params=>
{"Type"=>"simple",
"Restart"=>"on-failure", Right now, out of this bunch, only |
I like the
|
Ok, with the latest code, this is working now: describe service('avahi-daemon').params do
its('UnitFileState') { should_not eq 'enabled' }
end
describe service('sshd') do
its('type') { should eq 'systemd' }
its('name') { should eq 'sshd.service' }
its('description') { should eq 'OpenSSH server daemon' }
its('params.UnitFileState') { should eq 'enabled' }
end |
@@ -22,7 +24,9 @@ | |||
it 'verify ubuntu package parsing' do | |||
resource = MockLoader.new(:ubuntu1404).load_resource('service', 'ssh') | |||
srv = { name: 'ssh', description: nil, installed: true, running: true, enabled: true, type: 'upstart' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we remove the srv
?
@alexpop Implementation is very good. I would like to remove all
|
_(resource.installed?).must_equal true | ||
_(resource.enabled?).must_equal true | ||
_(resource.running?).must_equal true | ||
end | ||
|
||
it 'verify centos 7 package parsing with systemd_service and service_ctl override' do | ||
resource = MockLoader.new(:centos7).load_resource('systemd_service', 'sshd', '/path/to/systemctl') | ||
srv = { name: 'sshd.service', description: 'OpenSSH server daemon', installed: true, running: true, enabled: true, type: 'systemd', :properties=>{"Id"=>"sshd.service", "Names"=>"sshd.service", "Description"=>"OpenSSH server daemon", "LoadState"=>"loaded", "UnitFileState"=>"enabled", "SubState"=>"running"} } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Alex, would it make sense to re-add the systemd tests:
_(resource.params).must_equal {object}'
Awesome addition @alexpop |
4a2e723
to
9ded3b8
Compare
Replacing the current method of accessing these params:
with this:
hashie
dependency, but wanted to share the vision and start the discussion.info
method private now?params
looks to be an internal inspec way of handing attributes. Isproperties
a better name for this method? For example: