smart_proxy_ansible 3.4.0 → 3.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe91bd15ae06f9e9cc9e2d54fce101129acd7fd39f8f9c3d970909e5bf029545
4
- data.tar.gz: d6e887989f068bfa795ceada359e68d911fbeba3d308d3eb0a52e35b1571c3fd
3
+ metadata.gz: 7e690f2c224c01d97752317ca99ae54ac84a01f45fc2d613c727477d0acbcdcf
4
+ data.tar.gz: 0ec2124072f46f08a9820dee2311dce4a72c44980701ed3ab12697788be1e2ca
5
5
  SHA512:
6
- metadata.gz: dfc145591dd06dad090a054332802674e30f2c5b51ef22809b1dcd3a42e24f587cb4e577c9e41740ff691290fe4621610ba092c888f35eaba4fa3fa73a9f90dc
7
- data.tar.gz: 53dfb48a0c82802307cb05df916a48d146bce2505148d8eb67162ef4f87bbeab626c02ecfed46e151051d12c6af1efea7c757ac50f24768654ff39933fa2b485
6
+ metadata.gz: 1b9e32a10bec5a241ea8e6d5aa9727f67e31b7cac1f47b6181ab14177942a48d722d23d54dc324a1fdfb19e0f57d442f80126a93e06331551700210628d8b7c8
7
+ data.tar.gz: 83f106b39297d92d521a2472db2c6c8c5a8d60b6391ea88b16a455e2d01070df6acb03ce2138474e8790a6d2495b897a1e118d4954af5115cba6f914a1e0de13
@@ -65,6 +65,7 @@ module Proxy::Ansible
65
65
  def publish_exit_status(status)
66
66
  process_artifacts
67
67
  super
68
+ @targets.each_key { |host| publish_exit_status_for(host, status) } if status != 0
68
69
  end
69
70
 
70
71
  def initialize_command(*command)
@@ -98,7 +99,7 @@ module Proxy::Ansible
98
99
  logger.debug("[foreman_ansible] - parsing event file #{event_file}")
99
100
  begin
100
101
  event = JSON.parse(File.read(event_file))
101
- if (hostname = event.dig('event_data', 'host'))
102
+ if (hostname = hostname_for_event(event))
102
103
  handle_host_event(hostname, event)
103
104
  else
104
105
  handle_broadcast_data(event)
@@ -110,6 +111,17 @@ module Proxy::Ansible
110
111
  end
111
112
  end
112
113
 
114
+ def hostname_for_event(event)
115
+ hostname = event.dig('event_data', 'host') || event.dig('event_data', 'remote_addr')
116
+ return nil if hostname.nil? || hostname.empty?
117
+
118
+ unless @targets.key?(hostname)
119
+ logger.warn("handle_host_event: unknown host #{hostname} for event '#{event['event']}', broadcasting")
120
+ return nil
121
+ end
122
+ hostname
123
+ end
124
+
113
125
  def handle_host_event(hostname, event)
114
126
  log_event("for host: #{hostname.inspect}", event)
115
127
  publish_data_for(hostname, event['stdout'] + "\n", 'stdout') if event['stdout']
@@ -2,6 +2,6 @@ module Proxy
2
2
  # Version, this allows the proxy and other plugins know
3
3
  # what version of the Ansible plugin is running
4
4
  module Ansible
5
- VERSION = '3.4.0'
5
+ VERSION = '3.4.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.0
4
+ version: 3.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Nečas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 1980-01-01 00:00:00.000000000 Z
12
+ date: 2022-09-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
185
  - !ruby/object:Gem::Version
186
186
  version: '0'
187
187
  requirements: []
188
- rubygems_version: 3.2.26
188
+ rubygems_version: 3.1.6
189
189
  signing_key:
190
190
  specification_version: 4
191
191
  summary: Smart-Proxy Ansible plugin