Class: Serverspec::Type::Service

Inherits:
Base
  • Object
show all
Defined in:
lib/serverspec/type/service.rb

Instance Attribute Summary

Attributes inherited from Base

#name

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #to_ary, #to_s

Constructor Details

This class inherits a constructor from Serverspec::Type::Base

Instance Method Details

#enabled?(level = 3) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/serverspec/type/service.rb', line 3

def enabled?(level=3)
  @runner.check_service_is_enabled(@name, level)
end

#has_property?(property) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/serverspec/type/service.rb', line 29

def has_property?(property)
  @runner.check_service_has_property(@name, property)
end

#has_start_mode?(mode) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/serverspec/type/service.rb', line 11

def has_start_mode?(mode)
  @runner.check_service_has_start_mode(@name, mode)
end

#installed?(name, version) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/serverspec/type/service.rb', line 7

def installed?(name, version)
  @runner.check_service_is_installed(@name)
end

#monitored_by?(monitor) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/serverspec/type/service.rb', line 24

def monitored_by?(monitor)
  check_method = "check_service_is_monitored_by_#{monitor}".to_sym
  res = @runner.send(check_method, @name)
end

#running?(under) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
# File 'lib/serverspec/type/service.rb', line 15

def running?(under)
  if under
    check_method = "check_service_is_running_under_#{under}".to_sym
    @runner.send(check_method, @name)
  else
    @runner.check_service_is_running(@name)
  end
end