smart_proxy_discovery_image 1.0.4 → 1.0.5

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
  SHA1:
3
- metadata.gz: c9cc8032e81068991f7892a103cfc512f76cdfff
4
- data.tar.gz: 74eee65dc8349bf8aaf527cf88f5d6c6ae1f19a3
3
+ metadata.gz: e7c6b10c6097546c69107e77831b8caacc340ab8
4
+ data.tar.gz: 131af61792cc724729b7294b016dc70e4a28216c
5
5
  SHA512:
6
- metadata.gz: 94610057ed09b8a37d57d4b5813adc75a6a3e5f06c082a87efece5920897d79906e2480c6c5c51da3e6f2a4f6bf10835e4f9e5abe751b46e6b9383cde664dd86
7
- data.tar.gz: ba058eef91e4e2216ccf6e3ba7a4dfde159a7887f1f613f14f6bd10a30309cb17f194c525dcf3cbc60f76a4e92c14dc7ada0f933717679fda950fd09385fe752
6
+ metadata.gz: c843b688ac17c86d4785ebef7a5bf635ee3bc1d133ead77413f56d9d65613db57c3d2c52efc3f65ce0399606e68e084bcfa00d9cceae919929e626baf6e18812
7
+ data.tar.gz: c0e132e164d1ae53655e083f09a8d52520a0dbdebc7dd0f663f8f0abe9e98e70caa19c3ce531545caa5a61c977ceacca3e13b53266f5912e03a57f4d358cabb1
@@ -1,5 +1,10 @@
1
1
  require 'smart_proxy_discovery_image/power_api'
2
+ require 'smart_proxy_discovery_image/inventory_api'
2
3
 
3
4
  map "/power" do
4
5
  run Proxy::DiscoveryImage::PowerApi
5
6
  end
7
+
8
+ map "/inventory" do
9
+ run Proxy::DiscoveryImage::InventoryApi
10
+ end
@@ -0,0 +1,13 @@
1
+ class Proxy::DiscoveryImage::InventoryApi < Sinatra::Base
2
+ helpers ::Proxy::Helpers
3
+
4
+ get "/facter" do
5
+ begin
6
+ content_type :json
7
+ Facter.clear
8
+ Facter.to_hash.to_json
9
+ rescue => e
10
+ log_halt 400, e
11
+ end
12
+ end
13
+ end
@@ -17,12 +17,14 @@ module Proxy::DiscoveryImage
17
17
  log_halt 500, "kexec binary was not found" unless (kexec = which('kexec'))
18
18
  data = JSON.parse request.body.read
19
19
 
20
- # download kernel and image synchronously (can be improved: http://projects.theforeman.org/issues/11318)
21
- wget = "#{which("wget")} --timeout=10 --tries=3 --no-check-certificate -qc "
22
- status = system("#{wget} '#{escape_for_shell(data['kernel'])}' -O /tmp/vmlinuz")
23
- log_halt 500, "Cannot download kernel: #{$?.exitstatus}" unless status
24
- status = system("#{wget} '#{escape_for_shell(data['initram'])}' -O /tmp/initrd.img")
25
- log_halt 500, "Cannot download kernel: #{$?.exitstatus}" unless status
20
+ logger.debug "Downloading: #{data['kernel']}"
21
+ if ::Proxy::HttpDownload.new(data['kernel'], '/tmp/vmlinuz').start.join != 0
22
+ log_halt 500, "cannot download kernel for kexec!"
23
+ end
24
+ logger.debug "Downloading: #{data['initram']}"
25
+ if ::Proxy::HttpDownload.new(data['initram'], '/tmp/initrd.img').start.join != 0
26
+ log_halt 500, "cannot download initram for kexec!"
27
+ end
26
28
 
27
29
  run_after_response 2, kexec, "--force", "--append=#{data['append']}", "--initrd=/tmp/initrd.img", "/tmp/vmlinuz"
28
30
  { :result => true }.to_json
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module DiscoveryImage
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_proxy_discovery_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Zapletal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-11 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |2
14
14
  Smart Proxy plugin providing Image API on discovered nodes. This plugin is only
@@ -19,6 +19,7 @@ executables: []
19
19
  extensions: []
20
20
  extra_rdoc_files: []
21
21
  files:
22
+ - lib/smart_proxy_discovery_image/inventory_api.rb
22
23
  - lib/smart_proxy_discovery_image/plugin.rb
23
24
  - lib/smart_proxy_discovery_image/power_api.rb
24
25
  - lib/smart_proxy_discovery_image/http_config.ru