foreman_cockpit 1.0.1 → 1.0.2

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
  SHA1:
3
- metadata.gz: a8d13f04b9de76228fe512bf9d5a7641bbaf1455
4
- data.tar.gz: 04ec624bb2ff78805e3b003022c6dc69c4b259d4
3
+ metadata.gz: b2c185a866fa1fc170878ae2bb7fbdd329ec16dd
4
+ data.tar.gz: 7dccb1648a3029f60cf68ef9823f879ac1037000
5
5
  SHA512:
6
- metadata.gz: b803a80760830af1a1b6e19f61c4cfe9f3f7cad45d6815d923308d17fa5798d2402e061ef068b274ecbf828078bd2c499de7ba7fa5ab1c141cbb3bcc466b5fda
7
- data.tar.gz: e646b3d6a00d8faa7ec02d0e6cce821dbad30965756b41bb42734d0404878b7d009784c4d1de1b84a7d3043a63df951b89bb8b8ebc48dd0872758f132c9fd809
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' http://#{@host.fqdn}:9090")
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="http://<%= fqdn %>:9090/cockpit/@localhost/<%= suburl %>"/>
2
+ src="<%= protocol %>://<%= fqdn %>:9090/cockpit/@localhost/<%= suburl %>"/>
@@ -1,4 +1,4 @@
1
1
  # Specify the version to be picked up in the Gemspec
2
2
  module ForemanCockpit
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
@@ -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('http://foo.bar')
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('http://foo.bar')
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('http://foo.bar')
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.1
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-25 00:00:00.000000000 Z
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