smart_proxy_discovery_image 1.0.6 → 1.0.7

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: 9e9e8345ac2b1139379f5afc7d0b617258afc2e2
4
- data.tar.gz: fbf8485197642a9fb8e0ed9b36ecdfdc04bcc4e2
3
+ metadata.gz: e4dc7cb1398ac217438e11f78f53d58526a2c295
4
+ data.tar.gz: 1724af6417967817b778f7529996ab85a6d6650b
5
5
  SHA512:
6
- metadata.gz: ac98ab2e5b4cbf3d1dcea1c763e84d799d2860c46cf99a1d20e5d7560d493570fa302fda5ca6c1b5bbd0b029703fa704f5606bc496fdbc8c5d6389a2ba68a341
7
- data.tar.gz: 2f6a15bccbf3533af192e2571495cd36adbb891491d81f612e4efc99918856e5db1c15c707b4b4e7c58da279f435944fafdde9004a2f1af8ff8130854e4858c3
6
+ metadata.gz: b8ee13bb9505903bff9c0c989ccd2daaf6d4cec08f8efccf4b7e52759f03c4b1cd8814276c32e812d95b06831a800cc97c00f4d625482ca524c2d30e14bbc68e
7
+ data.tar.gz: 738479e7aebcdd9a8e2f8cc653cdc231c2bd3b9e4c112446ff2d7993fd90242eef3de427d6389021efde1d0943ec660a76078acfac0dd0a29c530ed92ed0f5eb
@@ -7,16 +7,21 @@ module Proxy::DiscoveryImage
7
7
  include Proxy::Util
8
8
 
9
9
  put "/reboot" do
10
- log_halt 500, "shutdown binary was not found" unless (shutdown = which('shutdown'))
10
+ log_halt(500, "shutdown binary was not found") unless (shutdown = which('shutdown'))
11
11
  run_after_response 5, shutdown, "-r", "now", "Foreman Power API reboot"
12
12
  content_type :json
13
13
  { :result => true }.to_json
14
14
  end
15
15
 
16
16
  put "/kexec" do
17
- log_halt 500, "kexec binary was not found" unless (kexec = which('kexec'))
18
- data = JSON.parse request.body.read
19
-
17
+ body_data = request.body.read
18
+ logger.debug "Initiated kexec provisioning with #{body_data}"
19
+ log_halt(500, "kexec binary was not found") unless (kexec = which('kexec'))
20
+ begin
21
+ data = JSON.parse body_data
22
+ rescue JSON::ParserError
23
+ log_halt 500, "Unable to parse kexec JSON input: #{body_data}"
24
+ end
20
25
  logger.debug "Downloading: #{data['kernel']}"
21
26
  if ::Proxy::HttpDownload.new(data['kernel'], '/tmp/vmlinuz').start.join != 0
22
27
  log_halt 500, "cannot download kernel for kexec!"
@@ -33,7 +38,7 @@ module Proxy::DiscoveryImage
33
38
  # Execute command in a separate thread after 5 seconds to give the server some
34
39
  # time to finish the request. Does *not* execute via a shell.
35
40
  def run_after_response(seconds, *command)
36
- logger.debug "Power API command scheduled in #{seconds} seconds"
41
+ logger.debug "Power API scheduling in #{seconds} seconds: #{command.inspect}"
37
42
  Thread.start do
38
43
  begin
39
44
  sleep seconds
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module DiscoveryImage
3
- VERSION = '1.0.6'
3
+ VERSION = '1.0.7'
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.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Zapletal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-24 00:00:00.000000000 Z
11
+ date: 2017-08-10 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
@@ -32,7 +32,7 @@ files:
32
32
  - settings.d/discovery_image.yml.example
33
33
  homepage: http://github.com/theforeman/smart_proxy_discovery_image
34
34
  licenses:
35
- - GPLv3
35
+ - GPL-3.0
36
36
  metadata: {}
37
37
  post_install_message:
38
38
  rdoc_options: []