Class: Serverspec::Type::Cgroup

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

Instance Attribute Summary collapse

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

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/serverspec/type/cgroup.rb', line 4

def method_missing(meth)
  if @subsystem.nil?
    @subsystem = meth.to_s
    self
  else
    param = "#{@subsystem}.#{meth.to_s}"
    ret = @runner.run_command("cgget -n -r #{param} #{@name} | awk '{print $2}'")
    val = ret.stdout.strip
    val = val.to_i if val.match(/^\d+$/)
    val
  end
end

Instance Attribute Details

#subsystemObject

Returns the value of attribute subsystem


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

def subsystem
  @subsystem
end