Class: SrcMstr

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

Overview

AIX services

Instance Attribute Summary collapse

Attributes inherited from ServiceManager

#inspec, #service_ctl

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.



171
172
173
# File 'lib/resources/service.rb', line 171

def name
  @name
end

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


194
195
196
# File 'lib/resources/service.rb', line 194

def enabled?
  enabled_rc_tcpip? || enabled_inittab?
end

#info(service_name) ⇒ Object



173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/resources/service.rb', line 173

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)


188
189
190
191
192
# File 'lib/resources/service.rb', line 188

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