Class: GrimReaper::PythonModule

Inherits:
Object
  • Object
show all
Defined in:
lib/grim_reaper/python_module.rb

Overview

Python module wrapper for py_grim operations

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, grim_root) ⇒ PythonModule

Returns a new instance of PythonModule.



10
11
12
13
# File 'lib/grim_reaper/python_module.rb', line 10

def initialize(config, grim_root)
  @config = config
  @grim_root = grim_root
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/grim_reaper/python_module.rb', line 8

def config
  @config
end

#grim_rootObject (readonly)

Returns the value of attribute grim_root.



8
9
10
# File 'lib/grim_reaper/python_module.rb', line 8

def grim_root
  @grim_root
end

Instance Method Details

#execute(command, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/grim_reaper/python_module.rb', line 15

def execute(command, *args)
  case command
  when "health"
    execute_health
  when "status"
    execute_status
  when "backup"
    execute_backup(*args)
  when "monitor"
    execute_monitor(*args)
  when "security"
    execute_security(*args)
  when "ai"
    execute_ai(*args)
  else
    execute_generic(command, *args)
  end
end

#statusObject



34
35
36
37
38
39
40
41
# File 'lib/grim_reaper/python_module.rb', line 34

def status
  {
    status: "ready",
    module: "python",
    available_commands: %w[health status backup monitor security ai],
    grim_root: @grim_root
  }
end