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



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

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 external (extended framework) call



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

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



30
31
32
# File 'lib/objects/registry/command/internal.rb', line 30

def expected_keys
  super + [:orch_klass]
end

#orch_klassObject



17
18
19
# File 'lib/objects/registry/command/internal.rb', line 17

def orch_klass
  @orch_klass ||= do_constantize_orch_klass
end

#validate(*params) ⇒ Object



13
14
15
# File 'lib/objects/registry/command/internal.rb', line 13

def validate(*params)
  super
end