smart_proxy_discovery_image 1.2.1 → 1.5.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: e5fc93e913ac9a70a9d099a12e4a7eba8139777de210569b44fb8e305e74299c
4
- data.tar.gz: b41a1f2e085f2f7a04a33a88a6f670581d1d89ae34b6a59a497b135f12ad76ea
3
+ metadata.gz: 63fcad0e9bd9c8a39569890351e410f31a18067de5047df0c8fa8417af589fe7
4
+ data.tar.gz: 6d543be76718df30385823f19e9b9ba6c53ded883974f7a65f9e620ca9d2e9d9
5
5
  SHA512:
6
- metadata.gz: e79b8fc34a0f3e04a99fd5f380bb9aa55699fe9d9db0b61e093173e41aa98e0340a8bc99a981b799ae669b5aec8fed82283d6c00ebd5000ced63c026cf6af94d
7
- data.tar.gz: 6c2a81f40a1f6285a3e928cea8340a7c3ad633bd3cca2f87c1352b76f1c4599c49f94b15b5f6b8fbd4e66349c24dc9ceeba27bbfdb17d8bd85f8aa6c98f63de3
6
+ metadata.gz: b8dcb2bedf37a4e212751dbd6183208b03aff8e88dca2bebbccd008e36efa03bbb79ab6daa4ef42eabe2934fdd15e49b58eeee67ccde7197b1a842373b5007d9
7
+ data.tar.gz: 7d2cb6faa3d9cb6f01e0bb5e6cef224dd7c14ebe2dca84a9783999622c04d78b09592d3caf5c2655cc9d378823c3a2f5a6b2fe141dff70f9493af8318a265ac7
@@ -7,8 +7,9 @@ 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'))
11
- run_after_response 5, shutdown, "-r", "now", "Foreman Power API reboot"
10
+ log_halt(500, "reboot binary was not found") unless (reboot = which('reboot'))
11
+ # --force must be used to avoid transitioning back from systemd to initramdisk
12
+ run_after_response 2, reboot, "-f"
12
13
  content_type :json
13
14
  { :result => true }.to_json
14
15
  end
@@ -17,6 +18,8 @@ module Proxy::DiscoveryImage
17
18
  body_data = request.body.read
18
19
  # change virtual terminal out of newt screen
19
20
  system("chvt", "2")
21
+ is_secureboot = system('mokutil --sb-state|grep enabled')
22
+ logger.debug "Secure boot is #{is_secureboot}"
20
23
  logger.debug "Initiated kexec provisioning with #{body_data}"
21
24
  log_halt(500, "kexec binary was not found") unless (kexec = which('kexec'))
22
25
  begin
@@ -24,7 +27,18 @@ module Proxy::DiscoveryImage
24
27
  rescue JSON::ParserError
25
28
  log_halt 500, "Unable to parse kexec JSON input: #{body_data}"
26
29
  end
27
- download_and_run_after_response data, 2, kexec, "--debug", "--force", "--append=#{data['append']}", "--initrd=/tmp/initrd.img", "/tmp/vmlinuz", *data['extra']
30
+ args = ["--debug", "--force"]
31
+ extra = data['extra']
32
+ if extra && extra.is_a?(String)
33
+ args << extra
34
+ elsif extra && extra.is_a?(Array)
35
+ args.concat(extra)
36
+ end
37
+ args << "--kexec-file-syscall" if is_secureboot
38
+ args << "--append=#{data['append']}"
39
+ args << "--initrd=/tmp/initrd.img"
40
+ download_and_run_after_response data, 2, kexec, *args, "/tmp/vmlinuz"
41
+
28
42
  { :result => true }.to_json
29
43
  end
30
44
 
@@ -1,5 +1,5 @@
1
1
  module Proxy
2
2
  module DiscoveryImage
3
- VERSION = '1.2.1'
3
+ VERSION = '1.5.0'
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.2.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Zapletal
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-06 00:00:00.000000000 Z
11
+ date: 2022-01-07 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
@@ -34,7 +34,7 @@ homepage: https://github.com/theforeman/smart_proxy_discovery_image
34
34
  licenses:
35
35
  - GPL-3.0
36
36
  metadata: {}
37
- post_install_message:
37
+ post_install_message:
38
38
  rdoc_options: []
39
39
  require_paths:
40
40
  - lib
@@ -49,8 +49,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
49
49
  - !ruby/object:Gem::Version
50
50
  version: '0'
51
51
  requirements: []
52
- rubygems_version: 3.1.2
53
- signing_key:
52
+ rubygems_version: 3.1.4
53
+ signing_key:
54
54
  specification_version: 4
55
55
  summary: FDI API for Foreman Smart-Proxy
56
56
  test_files: []