smart_proxy_dynflow 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/smart_proxy_dynflow/action/runner.rb +1 -0
- data/lib/smart_proxy_dynflow/continuous_output.rb +10 -8
- data/lib/smart_proxy_dynflow/runner/base.rb +4 -3
- data/lib/smart_proxy_dynflow/runner/parent.rb +6 -6
- data/lib/smart_proxy_dynflow/runner/update.rb +3 -2
- data/lib/smart_proxy_dynflow/version.rb +1 -1
- metadata +4 -4
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e7e0e12ddc21b25d46fe7d1ea6c7af572f98d0fff69e19ebf4764059e41a6644
         | 
| 4 | 
            +
              data.tar.gz: 2326988132e96960c1739c41b1b99f53452cf3684839f97e8cb4c050459b43df
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: bc8c5012e01624d165f801e6de4f3d0707cbdcfa42437fc0887fe10ccc89d5606813fae0fc8761c73cee40bae0ae275d0115165521f903e7ee24f90a129423bb
         | 
| 7 | 
            +
              data.tar.gz: a20e4eb660064c01d2ede0c5e38ccadaded5d0feac2768865e59295b2a3ba44a47be743a3bd074f68cdb11891930bbe08f8b554033f24907b64e0d0d09bd843b
         | 
| @@ -37,18 +37,20 @@ module Proxy::Dynflow | |
| 37 37 | 
             
                  raw_outputs.map { |output| output['output'] }.join("\n")
         | 
| 38 38 | 
             
                end
         | 
| 39 39 |  | 
| 40 | 
            -
                def add_exception(context, exception, timestamp  | 
| 41 | 
            -
                  add_output(context + ": #{exception.class} - #{exception.message}", 'debug', timestamp)
         | 
| 40 | 
            +
                def add_exception(context, exception, timestamp: Time.now.getlocal, id: nil)
         | 
| 41 | 
            +
                  add_output(context + ": #{exception.class} - #{exception.message}", 'debug', timestamp: timestamp, id: id)
         | 
| 42 42 | 
             
                end
         | 
| 43 43 |  | 
| 44 | 
            -
                def add_output( | 
| 45 | 
            -
                  add_raw_output(self.class.format_output( | 
| 44 | 
            +
                def add_output(...)
         | 
| 45 | 
            +
                  add_raw_output(self.class.format_output(...))
         | 
| 46 46 | 
             
                end
         | 
| 47 47 |  | 
| 48 | 
            -
                def self.format_output(message, type = 'debug', timestamp  | 
| 49 | 
            -
                  { 'output_type' => type,
         | 
| 50 | 
            -
             | 
| 51 | 
            -
             | 
| 48 | 
            +
                def self.format_output(message, type = 'debug', timestamp: Time.now.getlocal, id: nil)
         | 
| 49 | 
            +
                  base = { 'output_type' => type,
         | 
| 50 | 
            +
                           'output' => message,
         | 
| 51 | 
            +
                           'timestamp' => timestamp.to_f }
         | 
| 52 | 
            +
                  base['id'] = id if id
         | 
| 53 | 
            +
                  base
         | 
| 52 54 | 
             
                end
         | 
| 53 55 | 
             
              end
         | 
| 54 56 | 
             
            end
         | 
| @@ -58,8 +58,8 @@ module Proxy::Dynflow | |
| 58 58 | 
             
                    #   or nil for no timeout
         | 
| 59 59 | 
             
                  end
         | 
| 60 60 |  | 
| 61 | 
            -
                  def publish_data( | 
| 62 | 
            -
                    @continuous_output.add_output( | 
| 61 | 
            +
                  def publish_data(...)
         | 
| 62 | 
            +
                    @continuous_output.add_output(...)
         | 
| 63 63 | 
             
                  end
         | 
| 64 64 |  | 
| 65 65 | 
             
                  def publish_exception(context, exception, fatal = true)
         | 
| @@ -71,6 +71,7 @@ module Proxy::Dynflow | |
| 71 71 |  | 
| 72 72 | 
             
                  def publish_exit_status(status)
         | 
| 73 73 | 
             
                    @exit_status = status
         | 
| 74 | 
            +
                    @exit_status_timestamp = Time.now.utc
         | 
| 74 75 | 
             
                  end
         | 
| 75 76 |  | 
| 76 77 | 
             
                  def dispatch_exception(context, exception)
         | 
| @@ -90,7 +91,7 @@ module Proxy::Dynflow | |
| 90 91 | 
             
                  end
         | 
| 91 92 |  | 
| 92 93 | 
             
                  def new_update(data, exit_status)
         | 
| 93 | 
            -
                    { @suspended_action => Runner::Update.new(data, exit_status) }
         | 
| 94 | 
            +
                    { @suspended_action => Runner::Update.new(data, exit_status, exit_status_timestamp: @exit_status_timestamp) }
         | 
| 94 95 | 
             
                  end
         | 
| 95 96 |  | 
| 96 97 | 
             
                  def initialize_continuous_outputs
         | 
| @@ -13,13 +13,13 @@ module Proxy::Dynflow | |
| 13 13 |  | 
| 14 14 | 
             
                  def generate_updates
         | 
| 15 15 | 
             
                    base = {}
         | 
| 16 | 
            -
                    base[@suspended_action] = Runner::Update.new(Proxy::Dynflow::ContinuousOutput.new, @exit_status) if @exit_status
         | 
| 16 | 
            +
                    base[@suspended_action] = Runner::Update.new(Proxy::Dynflow::ContinuousOutput.new, @exit_status, exit_status_timestamp: @exit_status_timestamp) if @exit_status
         | 
| 17 17 | 
             
                    # Operate on all hosts if the main process ended or only on hosts for which we have updates
         | 
| 18 18 | 
             
                    @outputs.reject { |_, output| @exit_status.nil? && output.empty? }
         | 
| 19 19 | 
             
                            .reduce(base) do |acc, (identifier, output)|
         | 
| 20 20 | 
             
                              @outputs[identifier] = Proxy::Dynflow::ContinuousOutput.new # Create a new ContinuousOutput for next round of updates
         | 
| 21 21 | 
             
                              exit_status = @exit_statuses[identifier] || @exit_status if @exit_status
         | 
| 22 | 
            -
                              acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status))
         | 
| 22 | 
            +
                              acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status, exit_status_timestamp: @exit_status_timestamp))
         | 
| 23 23 | 
             
                            end
         | 
| 24 24 | 
             
                  end
         | 
| 25 25 |  | 
| @@ -35,16 +35,16 @@ module Proxy::Dynflow | |
| 35 35 | 
             
                    Dynflow::Action::Suspended.new OpenStruct.new(options)
         | 
| 36 36 | 
             
                  end
         | 
| 37 37 |  | 
| 38 | 
            -
                  def broadcast_data( | 
| 39 | 
            -
                    @outputs.each_value { |output| output.add_output( | 
| 38 | 
            +
                  def broadcast_data(...)
         | 
| 39 | 
            +
                    @outputs.each_value { |output| output.add_output(...) }
         | 
| 40 40 | 
             
                  end
         | 
| 41 41 |  | 
| 42 42 | 
             
                  def publish_data(_data, _type)
         | 
| 43 43 | 
             
                    true
         | 
| 44 44 | 
             
                  end
         | 
| 45 45 |  | 
| 46 | 
            -
                  def publish_data_for(identifier, data, type)
         | 
| 47 | 
            -
                    @outputs[identifier].add_output(data, type)
         | 
| 46 | 
            +
                  def publish_data_for(identifier, data, type, **kwargs)
         | 
| 47 | 
            +
                    @outputs[identifier].add_output(data, type, **kwargs)
         | 
| 48 48 | 
             
                  end
         | 
| 49 49 |  | 
| 50 50 | 
             
                  def dispatch_exception(context, exception)
         | 
| @@ -7,11 +7,12 @@ module Proxy::Dynflow | |
| 7 7 | 
             
                # Runner::Update represents chunk of data produced by runner that
         | 
| 8 8 | 
             
                # can be consumed by other components, such as RunnerAction
         | 
| 9 9 | 
             
                class Update
         | 
| 10 | 
            -
                  attr_reader :continuous_output, :exit_status
         | 
| 10 | 
            +
                  attr_reader :continuous_output, :exit_status, :exit_status_timestamp
         | 
| 11 11 |  | 
| 12 | 
            -
                  def initialize(continuous_output, exit_status)
         | 
| 12 | 
            +
                  def initialize(continuous_output, exit_status, exit_status_timestamp: nil)
         | 
| 13 13 | 
             
                    @continuous_output = continuous_output
         | 
| 14 14 | 
             
                    @exit_status = exit_status
         | 
| 15 | 
            +
                    @exit_status_timestamp = exit_status_timestamp || Time.now.utc if @exit_status
         | 
| 15 16 | 
             
                  end
         | 
| 16 17 |  | 
| 17 18 | 
             
                  def self.encode_exception(context, exception, fatal = true)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: smart_proxy_dynflow
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Ivan Nečas
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2024- | 
| 11 | 
            +
            date: 2024-11-20 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: dynflow
         | 
| @@ -108,7 +108,7 @@ files: | |
| 108 108 | 
             
            - settings.d/dynflow.yml.example
         | 
| 109 109 | 
             
            homepage: https://github.com/theforeman/smart_proxy_dynflow
         | 
| 110 110 | 
             
            licenses:
         | 
| 111 | 
            -
            - GPL-3.0
         | 
| 111 | 
            +
            - GPL-3.0-only
         | 
| 112 112 | 
             
            metadata:
         | 
| 113 113 | 
             
              rubygems_mfa_required: 'true'
         | 
| 114 114 | 
             
            post_install_message:
         | 
| @@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 129 129 | 
             
                - !ruby/object:Gem::Version
         | 
| 130 130 | 
             
                  version: '0'
         | 
| 131 131 | 
             
            requirements: []
         | 
| 132 | 
            -
            rubygems_version: 3.3. | 
| 132 | 
            +
            rubygems_version: 3.3.27
         | 
| 133 133 | 
             
            signing_key:
         | 
| 134 134 | 
             
            specification_version: 4
         | 
| 135 135 | 
             
            summary: Dynflow runtime for Foreman smart proxy
         |