add arch linux support for service resource

This commit is contained in:
Christoph Hartmann 2015-09-24 23:37:31 +02:00
parent 45081735ad
commit 36ad0dd5a0
2 changed files with 12 additions and 0 deletions

View file

@ -64,6 +64,8 @@ class Service < Vulcano.resource(1)
@service_mgmt = WindowsSrv.new(vulcano)
when 'freebsd'
@service_mgmt = BSDInit.new(vulcano)
when 'arch'
@service_mgmt = Systemd.new(vulcano)
end
return skip_resource 'The `service` resource is not supported on your OS yet.' if @service_mgmt.nil?

View file

@ -35,6 +35,16 @@ describe 'Vulcano::Resources::Service' do
_(resource.running?).must_equal true
end
# arch linux with systemd
it 'verify arch linux package parsing' do
resource = MockLoader.new(:arch).load_resource('service', 'sshd')
srv = { name: 'sshd.service', description: 'OpenSSH server daemon', installed: true, running: true, enabled: true, type: 'systemd' }
_(resource.info).must_equal srv
_(resource.installed?).must_equal true
_(resource.enabled?).must_equal true
_(resource.running?).must_equal true
end
# debian 8 with systemd
it 'verify arch linux package parsing' do
resource = MockLoader.new(:debian7).load_resource('service', 'sshd')