Class: RightScale::ExternalParameterGatherer
- Includes:
- EM::Deferrable
- Defined in:
- lib/instance/cook/external_parameter_gatherer.rb
Overview
Provides access to RightLink agent audit methods
Instance Attribute Summary collapse
-
#failure_message ⇒ Object
readonly
Failure title and message if any.
-
#failure_title ⇒ Object
readonly
Failure title and message if any.
Instance Method Summary collapse
-
#initialize(bundle, options) ⇒ ExternalParameterGatherer
constructor
Initialize parameter gatherer.
-
#run ⇒ Object
TODO docs.
Constructor Details
#initialize(bundle, options) ⇒ ExternalParameterGatherer
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/instance/cook/external_parameter_gatherer.rb', line 43 def initialize(bundle, ) @serializer = Serializer.new @audit = AuditStub.instance = [:cookie] @listen_port = [:listen_port] @thread_name = [:thread_name] @executables_inputs = {} bundle.executables.each do |exe| externals = exe.external_inputs next if externals.nil? || externals.empty? @executables_inputs[exe] = externals.dup end end |
Instance Attribute Details
#failure_message ⇒ Object (readonly)
Failure title and message if any
32 33 34 |
# File 'lib/instance/cook/external_parameter_gatherer.rb', line 32 def end |
#failure_title ⇒ Object (readonly)
Failure title and message if any
32 33 34 |
# File 'lib/instance/cook/external_parameter_gatherer.rb', line 32 def failure_title @failure_title end |
Instance Method Details
#run ⇒ Object
TODO docs
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/instance/cook/external_parameter_gatherer.rb', line 59 def run if done? #we might not have ANY external parameters! report_success return true end @audit.create_new_section('Retrieving credentials') #Preflight to check validity of cred objects ok = true @executables_inputs.each_pair do |exe, inputs| inputs.each_pair do |name, location| next if location.is_a?(RightScale::SecureDocumentLocation) msg = "The provided credential (#{location.class.name}) is incompatible with this version of RightLink" report_failure('Cannot process external input', msg) ok = false end end return false unless ok @executables_inputs.each_pair do |exe, inputs| inputs.each_pair do |name, location| payload = { :ticket => location.ticket, :namespace => location.namespace, :names => [location.name] } = { :targets => location.targets } self.send_idempotent_request('/vault/read_documents', payload, ) do |data| handle_response(exe, name, location, data) end end end rescue Exception => e report_failure('Credential gathering failed', "The following execption occured while gathering credentials", e) end |