Class: Bcome::Registry::Command::Internal

Inherits:
Base
  • Object
show all
Defined in:
lib/objects/registry/command/internal.rb

Instance Method Summary collapse

Methods inherited from Base

#defaults, #initialize, is_valid_type?, #method_missing, new_from_raw_command, #process_arguments, valid_types, #validation_error

Constructor Details

This class inherits a constructor from Bcome::Registry::Command::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Bcome::Registry::Command::Base

Instance Method Details

#do_constantize_orch_klassObject



23
24
25
26
27
28
29
30
# File 'lib/objects/registry/command/internal.rb', line 23

def do_constantize_orch_klass
  klass_name = "Bcome::Orchestration::#{@data[:orch_klass]}"
  begin
    klass_name.constantize
  rescue NameError
    raise Bcome::Exception::CannotFindInternalRegistryKlass, "'#{@data[:console_command]}'. #{klass_name} does not exist. Make sure you've created this class inside your orchestration folder in bcome/orchestration"
  end
end

#execute(node, arguments) ⇒ Object

In which the bcome context is an internal (extended framework) call



7
8
9
10
11
12
13
# File 'lib/objects/registry/command/internal.rb', line 7

def execute(node, arguments)
  merged_arguments = process_arguments(arguments)
  orchestrator = orch_klass.new(node, merged_arguments)
  orchestrator.do_execute
rescue Interrupt
  puts "\nExiting gracefully from interrupt\n".warning
end

#expected_keysObject



32
33
34
# File 'lib/objects/registry/command/internal.rb', line 32

def expected_keys
  super + [:orch_klass]
end

#orch_klassObject



19
20
21
# File 'lib/objects/registry/command/internal.rb', line 19

def orch_klass
  @orch_klass ||= do_constantize_orch_klass
end

#validate(*params) ⇒ Object



15
16
17
# File 'lib/objects/registry/command/internal.rb', line 15

def validate(*params)
  super
end