smart_proxy_discovery_image 1.0.4 → 1.1.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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 33b1e050b42bfdaa738931d647c63a8a57ba82d264770fe3713a377ee8d26761
|
4
|
+
data.tar.gz: 3c7f7b8d0ec6a82eff559184537c1d207fd317d0e83ea4e91f86cac2100758b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79c394795be0c33935ef82f2396f77fefe8158a151501235544ae5ec6781cb7b31431477e1daa96ede830e8a8dd7a3deed9375b17a44b0c8c7336bfc683ea60c
|
7
|
+
data.tar.gz: c11681c80e5381cc7a0494497dd9e19337b768b404cd47395f77e81503e38ec4d527ddafe6c7d68dc8881fa1da2079dc35485cc84408bd7f847050a087ae3de3
|
@@ -7,24 +7,32 @@ module Proxy::DiscoveryImage
|
|
7
7
|
include Proxy::Util
|
8
8
|
|
9
9
|
put "/reboot" do
|
10
|
-
log_halt
|
11
|
-
run_after_response 5, shutdown, "-r", "now", "Foreman
|
10
|
+
log_halt(500, "shutdown binary was not found") unless (shutdown = which('shutdown'))
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
17
|
+
body_data = request.body.read
|
18
|
+
# change virtual terminal out of newt screen
|
19
|
+
system("chvt", "2")
|
20
|
+
logger.debug "Initiated kexec provisioning with #{body_data}"
|
21
|
+
log_halt(500, "kexec binary was not found") unless (kexec = which('kexec'))
|
22
|
+
begin
|
23
|
+
data = JSON.parse body_data
|
24
|
+
rescue JSON::ParserError
|
25
|
+
log_halt 500, "Unable to parse kexec JSON input: #{body_data}"
|
26
|
+
end
|
27
|
+
logger.debug "Downloading: #{data['kernel']}"
|
28
|
+
if ::Proxy::HttpDownload.new(data['kernel'], '/tmp/vmlinuz').start.join != 0
|
29
|
+
log_halt 500, "cannot download kernel for kexec!"
|
30
|
+
end
|
31
|
+
logger.debug "Downloading: #{data['initram']}"
|
32
|
+
if ::Proxy::HttpDownload.new(data['initram'], '/tmp/initrd.img').start.join != 0
|
33
|
+
log_halt 500, "cannot download initram for kexec!"
|
34
|
+
end
|
35
|
+
run_after_response 2, kexec, "--debug", "--force", "--append=#{data['append']}", "--initrd=/tmp/initrd.img", "/tmp/vmlinuz", *data['extra']
|
28
36
|
{ :result => true }.to_json
|
29
37
|
end
|
30
38
|
|
@@ -32,11 +40,11 @@ module Proxy::DiscoveryImage
|
|
32
40
|
# Execute command in a separate thread after 5 seconds to give the server some
|
33
41
|
# time to finish the request. Does *not* execute via a shell.
|
34
42
|
def run_after_response(seconds, *command)
|
35
|
-
logger.debug "
|
43
|
+
logger.debug "Power API scheduling in #{seconds} seconds: #{command.inspect}"
|
36
44
|
Thread.start do
|
37
45
|
begin
|
38
46
|
sleep seconds
|
39
|
-
logger.debug "
|
47
|
+
logger.debug "Power API executing: #{command.inspect}"
|
40
48
|
if (sudo = which('sudo'))
|
41
49
|
status = system(sudo, *command)
|
42
50
|
else
|
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
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas Zapletal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-03 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,19 +19,20 @@ executables: []
|
|
19
19
|
extensions: []
|
20
20
|
extra_rdoc_files: []
|
21
21
|
files:
|
22
|
+
- Gemfile
|
23
|
+
- LICENSE
|
24
|
+
- README.md
|
25
|
+
- bundler.d/discovery_image.rb
|
26
|
+
- lib/smart_proxy_discovery_image.rb
|
27
|
+
- lib/smart_proxy_discovery_image/http_config.ru
|
28
|
+
- lib/smart_proxy_discovery_image/inventory_api.rb
|
22
29
|
- lib/smart_proxy_discovery_image/plugin.rb
|
23
30
|
- lib/smart_proxy_discovery_image/power_api.rb
|
24
|
-
- lib/smart_proxy_discovery_image/http_config.ru
|
25
31
|
- lib/smart_proxy_discovery_image/version.rb
|
26
|
-
- lib/smart_proxy_discovery_image.rb
|
27
|
-
- bundler.d/discovery_image.rb
|
28
32
|
- settings.d/discovery_image.yml.example
|
29
|
-
|
30
|
-
- LICENSE
|
31
|
-
- README.md
|
32
|
-
homepage: http://github.com/theforeman/smart_proxy_discovery_image
|
33
|
+
homepage: https://github.com/theforeman/smart_proxy_discovery_image
|
33
34
|
licenses:
|
34
|
-
-
|
35
|
+
- GPL-3.0
|
35
36
|
metadata: {}
|
36
37
|
post_install_message:
|
37
38
|
rdoc_options: []
|
@@ -39,19 +40,17 @@ require_paths:
|
|
39
40
|
- lib
|
40
41
|
required_ruby_version: !ruby/object:Gem::Requirement
|
41
42
|
requirements:
|
42
|
-
- -
|
43
|
+
- - ">="
|
43
44
|
- !ruby/object:Gem::Version
|
44
45
|
version: '0'
|
45
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
47
|
requirements:
|
47
|
-
- -
|
48
|
+
- - ">="
|
48
49
|
- !ruby/object:Gem::Version
|
49
50
|
version: '0'
|
50
51
|
requirements: []
|
51
|
-
|
52
|
-
rubygems_version: 2.0.14
|
52
|
+
rubygems_version: 3.0.3
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: FDI API for Foreman Smart-Proxy
|
56
56
|
test_files: []
|
57
|
-
has_rdoc:
|