foreman_cockpit 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/concerns/foreman_cockpit/hosts_controller_extensions.rb +7 -2
- data/app/overrides/add_load_partials_js_legacy.rb +7 -0
- data/app/views/foreman_cockpit/hosts/_cockpit.html.erb +1 -1
- data/lib/foreman_cockpit/version.rb +1 -1
- data/test/unit/concerns/foreman_cockpit_test.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2c185a866fa1fc170878ae2bb7fbdd329ec16dd
|
4
|
+
data.tar.gz: 7dccb1648a3029f60cf68ef9823f879ac1037000
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e4e5f59bb9527f6bb472b7277a73488e7ff5e1f646644612967dd4fa9d43bc1fdf9c6c91964e62cc02621bf3e7e85de2ee15267b70f2bb897aaede1e4e1e500
|
7
|
+
data.tar.gz: 458c42416e20f2a905cb383ba6303ad0972dc242c5c7da19d9af48fe44e29a4408acd8f0766d7154d6328bbb37895fb7c829f307b4933b8ff085e501d6c0f443
|
@@ -14,7 +14,8 @@ module ForemanCockpit
|
|
14
14
|
find_resource
|
15
15
|
suburl = ForemanCockpit::COCKPIT_SUBURL[action.to_sym]
|
16
16
|
render :partial => 'foreman_cockpit/hosts/cockpit',
|
17
|
-
:locals => { :fqdn => @host.fqdn, :suburl => suburl
|
17
|
+
:locals => { :fqdn => @host.fqdn, :suburl => suburl,
|
18
|
+
:protocol => cockpit_protocol }
|
18
19
|
end
|
19
20
|
end
|
20
21
|
|
@@ -23,7 +24,7 @@ module ForemanCockpit
|
|
23
24
|
def allow_cockpit_iframe
|
24
25
|
response.headers['Content-Security-Policy'].
|
25
26
|
sub!("frame-src 'self'",
|
26
|
-
"frame-src 'self'
|
27
|
+
"frame-src 'self' #{cockpit_protocol}://#{@host.fqdn}:9090")
|
27
28
|
end
|
28
29
|
|
29
30
|
def action_permission
|
@@ -34,5 +35,9 @@ module ForemanCockpit
|
|
34
35
|
super
|
35
36
|
end
|
36
37
|
end
|
38
|
+
|
39
|
+
def cockpit_protocol
|
40
|
+
require_ssl? ? 'https' : 'http'
|
41
|
+
end
|
37
42
|
end
|
38
43
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# In case deface < 1.0 is installed, for instance on Foreman 1.9 and older
|
2
|
+
# we need to use a different matcher to match code
|
3
|
+
Deface::Override.new(
|
4
|
+
:virtual_path => 'hosts/show',
|
5
|
+
:name => 'add_load_partials_js_legacy',
|
6
|
+
:insert_after => 'code:contains("javascript")',
|
7
|
+
:text => "<% javascript 'foreman_cockpit/load_partial' %>")
|
@@ -1,2 +1,2 @@
|
|
1
1
|
<iframe class='col-md-12' height='600px' frameBorder="0"
|
2
|
-
src="
|
2
|
+
src="<%= protocol %>://<%= fqdn %>:9090/cockpit/@localhost/<%= suburl %>"/>
|
@@ -17,7 +17,7 @@ class CockpitTest < ActiveSupport::TestCase
|
|
17
17
|
end
|
18
18
|
|
19
19
|
test 'cockpit is enabled if cockpit ping is successful' do
|
20
|
-
@dummy_host.stubs(:fqdn).returns('
|
20
|
+
@dummy_host.stubs(:fqdn).returns('foo.bar')
|
21
21
|
cockpit_ping_url = "#{@dummy_host.fqdn}:9090/ping"
|
22
22
|
RestClient.expects(:get).with(cockpit_ping_url).
|
23
23
|
returns('{"service": "cockpit"}')
|
@@ -32,13 +32,13 @@ class CockpitTest < ActiveSupport::TestCase
|
|
32
32
|
|
33
33
|
test 'cockpit is not displayed when host does not have an OS' do
|
34
34
|
@dummy_host.stubs(:os).returns(nil)
|
35
|
-
@dummy_host.stubs(:fqdn).returns('
|
35
|
+
@dummy_host.stubs(:fqdn).returns('foo.bar')
|
36
36
|
refute @dummy_host.cockpit_enabled?
|
37
37
|
end
|
38
38
|
|
39
39
|
test 'cockpit is not displayed for incompatible OSs' do
|
40
40
|
@dummy_host.stubs(:os).returns(OpenStruct.new(:type => 'Debian'))
|
41
|
-
@dummy_host.stubs(:fqdn).returns('
|
41
|
+
@dummy_host.stubs(:fqdn).returns('foo.bar')
|
42
42
|
refute @dummy_host.cockpit_enabled?
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_cockpit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Lobato Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-10-
|
11
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -55,6 +55,7 @@ files:
|
|
55
55
|
- app/helpers/concerns/foreman_cockpit/hosts_helper_extensions.rb
|
56
56
|
- app/models/concerns/foreman_cockpit/host_extensions.rb
|
57
57
|
- app/overrides/add_load_partials_js.rb
|
58
|
+
- app/overrides/add_load_partials_js_legacy.rb
|
58
59
|
- app/views/foreman_cockpit/hosts/_cockpit.html.erb
|
59
60
|
- config/routes.rb
|
60
61
|
- lib/foreman_cockpit.rb
|