smart_proxy_acd_core 0.1.0 → 0.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215b06ad56d650035cdc4079ee6fcad40333f619366e9be8d4bc8c9451b9a207
4
- data.tar.gz: 295fd6ae912f62f4dddc0e59fda3afb9b72c9e059df33dd7fc46878185b07996
3
+ metadata.gz: a2672e22b05abf6a2239823a8e1ba644f1f4197470ee7893d1172a023fe3939e
4
+ data.tar.gz: d429b880e4555d4402947c1a49ca9fea8cc8a819b0b2ec5f4314fc0badbcf9a9
5
5
  SHA512:
6
- metadata.gz: 6812cf3394f08d4d184841043ea653e7fe1bd4d59c39b7726c356667061975af4262383f9dc0d3d577093c65da44f849281d4f547f7b70003ba13465cdfdb6a5
7
- data.tar.gz: e5bab31f198a74744bab097dac0426928855e7d38e77248b72dea2b81c1d9426593a344e9103e6e85308ae2a637bad3ccbcc9cdffa0bb153ab8e765a07affaad
6
+ metadata.gz: fa162bc764ecfc50acd64f3e63da4f98bac66b12e285c0156ead2f2d77a68d69ad5b70c95d7ff16329e6b7697c2a209164ff2bf1d2c31ed39159884315a103e4
7
+ data.tar.gz: 99765f2867dcfb08f69291685b17a26bd81f2caae682665683307a9bc6bfbaf69f1fcf1fd16197fe5e0bc5a35662287efa3c1ec50c6ae24cb432c488e51da786
@@ -2,6 +2,7 @@ require 'foreman_tasks_core/runner/command_runner'
2
2
  require 'tempfile'
3
3
  require 'rest-client'
4
4
  require 'tmpdir'
5
+ require 'socket'
5
6
 
6
7
  # rubocop:disable ClassLength
7
8
 
@@ -123,12 +124,19 @@ module SmartProxyAcdCore
123
124
  raise "'playbook_id' need to be specified" if @playbook_id.nil?
124
125
  end
125
126
 
127
+ def proxy_hostname
128
+ Socket.gethostbyname(Socket.gethostname).first
129
+ end
130
+
126
131
  def write_inventory
127
- inventory = Tempfile.new('acd_inventory')
128
- inventory << @acd_job['inventory']
129
- inventory << "\n"
130
- inventory.close
131
- @inventory_path = inventory.path
132
+ complete_inventory = YAML.safe_load(@acd_job['inventory'])
133
+ my_inventory = complete_inventory[proxy_hostname]
134
+
135
+ tmp_inventory_file = Tempfile.new('acd_inventory')
136
+ tmp_inventory_file << my_inventory.to_yaml
137
+ tmp_inventory_file << "\n"
138
+ tmp_inventory_file.close
139
+ @inventory_path = tmp_inventory_file.path
132
140
  end
133
141
 
134
142
  def environment
@@ -1,3 +1,3 @@
1
1
  module SmartProxyAcdCore
2
- VERSION = '0.1.0'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_acd_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernhard suttner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: foreman-tasks-core