Sha256: c71115f67187fb32633c1877bcbe7cdb5b63bea194ca4e6191f9fcd456426e6c
Contents?: true
Size: 1.25 KB
Versions: 6
Compression:
Stored size: 1.25 KB
Contents
module InsightsCloud module Generators class PlaybookProgressGenerator attr_reader :correlation_id def initialize(correlation_id) @messages = [] @correlation_id = correlation_id end def host_progress_message(host_name, output, sequence) @messages << { "type": "playbook_run_update", "version": 3, "correlation_id": correlation_id, "sequence": sequence, "host": host_name, "console": output, } end def host_finished_message(host_name, exit_code) @messages << { "type": "playbook_run_finished", "version": 3, "correlation_id": correlation_id, "host": host_name, "status": exit_code == 0 ? 'success' : 'failure', "connection_code": 0, "execution_code": exit_code, } end def job_finished_message(success) @messages << { "type": "playbook_run_completed", "version": 3, "correlation_id": correlation_id, "status": success ? 'success' : 'failure', } end def generate @messages.map do |message| message.to_json end.join("\n") end end end end
Version data entries
6 entries across 6 versions & 1 rubygems