diff --git a/lib/serverspec/type/service.rb b/lib/serverspec/type/service.rb index 9dcbf311..bbe457fc 100644 --- a/lib/serverspec/type/service.rb +++ b/lib/serverspec/type/service.rb @@ -33,5 +33,20 @@ def monitored_by?(monitor) def has_property?(property) @runner.check_service_has_property(@name, property) end + + def property + get_property if @property.nil? + @property + end + + private + def get_property + @property = {} + props = @runner.get_service_property(@name).stdout + props.split(/\n/).each do |line| + property, _type, *value = line.split(/\s+/) + @property[property] = value.join(' ') + end + end end end