Class: SrcMstr

Inherits:
ServiceManager show all
Defined in:
lib/resources/service.rb

Overview

AIX services

Instance Attribute Summary collapse

Attributes inherited from ServiceManager

#inspec

Instance Method Summary collapse

Methods inherited from ServiceManager

#initialize

Constructor Details

This class inherits a constructor from ServiceManager

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



162
163
164
# File 'lib/resources/service.rb', line 162

def name
  @name
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


185
186
187
# File 'lib/resources/service.rb', line 185

def enabled?
  enabled_rc_tcpip? || enabled_inittab?
end

#info(service_name) ⇒ Object



164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/resources/service.rb', line 164

def info(service_name)
  @name = service_name
  running = status?
  return nil if running.nil?

  {
    name: service_name,
    description: nil,
    installed: true,
    running: running,
    enabled: enabled?,
    type: 'srcmstr',
  }
end

#status?Boolean

Returns:

  • (Boolean)


179
180
181
182
183
# File 'lib/resources/service.rb', line 179

def status?
  status_cmd = inspec.command("lssrc -s #{@name}")
  return nil if status_cmd.exit_status.to_i != 0
  status_cmd.stdout.split(/\n/).last.chomp =~ /active$/ ? true : false
end