foreman_omaha 5.0.0 → 5.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 +4 -4
- data/app/controllers/api/v2/omaha_reports_controller.rb +3 -2
- data/app/controllers/omaha_hosts_controller.rb +2 -2
- data/app/graphql/foreman_omaha/types/omaha_group.rb +1 -4
- data/app/graphql/foreman_omaha/types/omaha_report.rb +1 -4
- data/app/helpers/foreman_omaha/omaha_groups_helper.rb +2 -2
- data/app/models/foreman_omaha/omaha_facet.rb +1 -1
- data/app/models/foreman_omaha/omaha_group.rb +1 -10
- data/app/models/{host_status → foreman_omaha}/omaha_status.rb +6 -6
- data/app/services/foreman_omaha/charts/oem_distribution.rb +1 -4
- data/app/services/foreman_omaha/charts/status_distribution.rb +1 -5
- data/app/services/foreman_omaha/charts/version_distribution.rb +1 -4
- data/app/views/omaha_groups/show.html.erb +20 -31
- data/config/routes.rb +3 -3
- data/lib/foreman_omaha/engine.rb +92 -87
- data/lib/foreman_omaha/version.rb +1 -1
- data/lib/tasks/foreman_omaha_tasks.rake +1 -1
- data/test/unit/charts/oem_distribution_test.rb +2 -4
- data/test/unit/charts/status_distribution_test.rb +2 -5
- data/test/unit/charts/version_distribution_test.rb +2 -5
- data/test/unit/host_status/omaha_status_test.rb +1 -1
- data/test/unit/omaha_group_test.rb +37 -0
- metadata +29 -72
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 991466be3a58e6ec0a11da16ccbc0af98cedc117f4def524948a64e96504f0db
|
|
4
|
+
data.tar.gz: e511bc47ecc16080e2ba16cc399d32d8c46d02212aa6ccccee075dccd5ea0d18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de3df0f800c907f7cbfdccde128e11e57b7415c72a39c517d5c4021fd7bfa0321a8cddcfea276b285adeeb8bbae387f5398cde569ff49d3c5c6c46a01dea5db9
|
|
7
|
+
data.tar.gz: 599c02b711439bae7aea6559948b50eafdac63a8374c62500c428d0effac14683c88745fb16bb79108011fdb64f6f9a31081a1baa816a6143037f2edb45aede4
|
|
@@ -72,8 +72,9 @@ module Api
|
|
|
72
72
|
::ForemanOmaha::OmahaReport
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
def resource_scope(options
|
|
76
|
-
|
|
75
|
+
def resource_scope(*args, **options)
|
|
76
|
+
options[:permission] = :view_omaha_reports
|
|
77
|
+
super(*args, **options).my_reports
|
|
77
78
|
end
|
|
78
79
|
|
|
79
80
|
def action_permission
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module ForemanOmaha
|
|
4
4
|
module Types
|
|
5
5
|
class OmahaGroup < ::Types::BaseObject
|
|
6
|
+
graphql_name 'ForemanOmaha_OmahaGroup'
|
|
6
7
|
model_class ForemanOmaha::OmahaGroup
|
|
7
8
|
description 'An Omaha Group'
|
|
8
9
|
|
|
@@ -12,10 +13,6 @@ module ForemanOmaha
|
|
|
12
13
|
field :uuid, String
|
|
13
14
|
|
|
14
15
|
has_many :hosts, ::Types::Host
|
|
15
|
-
|
|
16
|
-
def self.graphql_definition
|
|
17
|
-
super.tap { |type| type.instance_variable_set(:@name, 'ForemanOmaha::OmahaGroup') }
|
|
18
|
-
end
|
|
19
16
|
end
|
|
20
17
|
end
|
|
21
18
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
module ForemanOmaha
|
|
4
4
|
module Types
|
|
5
5
|
class OmahaReport < ::Types::BaseObject
|
|
6
|
+
graphql_name 'ForemanOmaha_OmahaReport'
|
|
6
7
|
model_class ForemanOmaha::OmahaReport
|
|
7
8
|
description 'An Omaha Report'
|
|
8
9
|
|
|
@@ -12,10 +13,6 @@ module ForemanOmaha
|
|
|
12
13
|
field :omaha_version, String
|
|
13
14
|
|
|
14
15
|
belongs_to :host, ::Types::Host
|
|
15
|
-
|
|
16
|
-
def self.graphql_definition
|
|
17
|
-
super.tap { |type| type.instance_variable_set(:@name, 'ForemanOmaha::OmahaReport') }
|
|
18
|
-
end
|
|
19
16
|
end
|
|
20
17
|
end
|
|
21
18
|
end
|
|
@@ -13,13 +13,13 @@ module ForemanOmaha
|
|
|
13
13
|
version_list = omaha_group.operatingsystems.pluck(:major, :minor).map { |v| Gem::Version.new(v.join('.')) }.sort.reverse
|
|
14
14
|
current = version_list.max
|
|
15
15
|
content_tag :div, :class => 'progress version-breakdown' do
|
|
16
|
-
safe_join(versions.map do |version|
|
|
16
|
+
safe_join(versions.compact.map do |version|
|
|
17
17
|
semver = Gem::Version.new(version[:version])
|
|
18
18
|
position = version_list.index(semver)
|
|
19
19
|
css = {
|
|
20
20
|
:width => "#{version[:percentage]}%"
|
|
21
21
|
}
|
|
22
|
-
label = if semver > current
|
|
22
|
+
label = if !current || semver > current
|
|
23
23
|
:info
|
|
24
24
|
elsif semver == current
|
|
25
25
|
:success
|
|
@@ -11,7 +11,7 @@ module ForemanOmaha
|
|
|
11
11
|
|
|
12
12
|
belongs_to :omaha_group, :inverse_of => :omaha_facets, :class_name => 'ForemanOmaha::OmahaGroup'
|
|
13
13
|
|
|
14
|
-
scope :out_of_sync, ->(*args) { where(['last_report < ?',
|
|
14
|
+
scope :out_of_sync, ->(*args) { where(['last_report < ?', args.first || (30 + Setting[:outofsync_interval]).minutes.ago]) }
|
|
15
15
|
|
|
16
16
|
validates_lengths_from_database
|
|
17
17
|
|
|
@@ -26,12 +26,7 @@ module ForemanOmaha
|
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
def latest_operatingsystem
|
|
29
|
-
|
|
30
|
-
when :postgresql
|
|
31
|
-
operatingsystems.reorder('').order('major::text::integer DESC').order('minor::text::float DESC').limit(1).last
|
|
32
|
-
else
|
|
33
|
-
operatingsystems.reorder('').order(:major, :minor).last
|
|
34
|
-
end
|
|
29
|
+
operatingsystems.reorder('').order(:major, :minor).last
|
|
35
30
|
end
|
|
36
31
|
|
|
37
32
|
private
|
|
@@ -39,9 +34,5 @@ module ForemanOmaha
|
|
|
39
34
|
def ensure_uuid
|
|
40
35
|
self.uuid ||= SecureRandom.uuid
|
|
41
36
|
end
|
|
42
|
-
|
|
43
|
-
def database_adapter_type
|
|
44
|
-
ActiveRecord::Base.connection.adapter_name.downcase.to_sym
|
|
45
|
-
end
|
|
46
37
|
end
|
|
47
38
|
end
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
module
|
|
4
|
-
class OmahaStatus < HostStatus::Status
|
|
3
|
+
module ForemanOmaha
|
|
4
|
+
class OmahaStatus < ::HostStatus::Status
|
|
5
5
|
def self.status_name
|
|
6
6
|
N_('Omaha Status')
|
|
7
7
|
end
|
|
@@ -17,13 +17,13 @@ module HostStatus
|
|
|
17
17
|
|
|
18
18
|
case host.omaha_facet.status.to_sym
|
|
19
19
|
when :complete, :downloaded, :downloading, :installed
|
|
20
|
-
HostStatus::Global::OK
|
|
20
|
+
::HostStatus::Global::OK
|
|
21
21
|
when :instance_hold
|
|
22
|
-
HostStatus::Global::WARN
|
|
22
|
+
::HostStatus::Global::WARN
|
|
23
23
|
when :error
|
|
24
|
-
HostStatus::Global::ERROR
|
|
24
|
+
::HostStatus::Global::ERROR
|
|
25
25
|
else
|
|
26
|
-
HostStatus::Global::OK
|
|
26
|
+
::HostStatus::Global::OK
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<% javascript 'foreman_omaha/application' %>
|
|
2
|
-
<% javascript 'charts' %>
|
|
3
2
|
<% title @omaha_group.name %>
|
|
4
3
|
<%= breadcrumbs(
|
|
5
4
|
items: [
|
|
@@ -71,37 +70,37 @@
|
|
|
71
70
|
<div class="card-pf-body">
|
|
72
71
|
<div class="row">
|
|
73
72
|
<div class="col-xs-12 col-sm-4 col-md-4">
|
|
74
|
-
<h3 class="card-pf-subtitle"><%= _('Version Distribution') %></h3>
|
|
75
73
|
<%=
|
|
76
|
-
|
|
77
|
-
'
|
|
78
|
-
_('Version Distribution'),
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
react_component('ChartBox', type: 'donut',
|
|
75
|
+
status: 'RESOLVED',
|
|
76
|
+
title: _('Version Distribution'),
|
|
77
|
+
chart: {
|
|
78
|
+
data: @version_distribution.to_chart_data,
|
|
79
|
+
search: hosts_path(search: "omaha_group = #{@omaha_group} and omaha_version = ~VAL~")
|
|
80
|
+
}
|
|
82
81
|
)
|
|
83
82
|
%>
|
|
84
83
|
</div>
|
|
85
84
|
<div class="col-xs-12 col-sm-4 col-md-4">
|
|
86
|
-
<h3 class="card-pf-subtitle"><%= _('Host Upgrade Progress') %></h3>
|
|
87
85
|
<%=
|
|
88
|
-
|
|
89
|
-
'
|
|
90
|
-
_('
|
|
91
|
-
|
|
92
|
-
|
|
86
|
+
react_component('ChartBox', type: 'donut',
|
|
87
|
+
status: 'RESOLVED',
|
|
88
|
+
title: _('Host Upgrade Progress'),
|
|
89
|
+
chart: {
|
|
90
|
+
data: @status_distribution.to_chart_data
|
|
91
|
+
}
|
|
93
92
|
)
|
|
94
93
|
%>
|
|
95
94
|
</div>
|
|
96
95
|
<div class="col-xs-12 col-sm-4 col-md-4">
|
|
97
|
-
<h3 class="card-pf-subtitle"><%= _('OEM Distribution') %></h3>
|
|
98
96
|
<%=
|
|
99
|
-
|
|
100
|
-
'
|
|
101
|
-
_('OEM Distribution'),
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
react_component('ChartBox', type: 'donut',
|
|
98
|
+
status: 'RESOLVED',
|
|
99
|
+
title: _('OEM Distribution'),
|
|
100
|
+
chart: {
|
|
101
|
+
data: @oem_distribution.to_chart_data,
|
|
102
|
+
search: hosts_path(search: "omaha_group = #{@omaha_group} and omaha_oem = ~VAL~")
|
|
103
|
+
}
|
|
105
104
|
)
|
|
106
105
|
%>
|
|
107
106
|
</div>
|
|
@@ -186,13 +185,3 @@
|
|
|
186
185
|
</div>
|
|
187
186
|
<% end %>
|
|
188
187
|
</div>
|
|
189
|
-
<script>
|
|
190
|
-
$(document).on('ContentLoad', function () {
|
|
191
|
-
refreshCharts();
|
|
192
|
-
// matchHeight the contents of each .card-pf and then the .card-pf itself
|
|
193
|
-
$(".row-cards-pf > [class*='col'] > .card-pf .card-pf-title").matchHeight();
|
|
194
|
-
$(".row-cards-pf > [class*='col'] > .card-pf > .card-pf-body").matchHeight();
|
|
195
|
-
$(".row-cards-pf > [class*='col'] > .card-pf > .card-pf-footer").matchHeight();
|
|
196
|
-
$(".row-cards-pf > [class*='col'] > .card-pf").matchHeight();
|
|
197
|
-
});
|
|
198
|
-
</script>
|
data/config/routes.rb
CHANGED
|
@@ -6,7 +6,7 @@ Rails.application.routes.draw do
|
|
|
6
6
|
:defaults => { :apiv => 'v2' },
|
|
7
7
|
:apiv => /v1|v2/,
|
|
8
8
|
:constraints => ApiConstraints.new(:version => 2, :default => true) do
|
|
9
|
-
constraints(:id =>
|
|
9
|
+
constraints(:id => %r{[^/]+}) do
|
|
10
10
|
resources :omaha_reports, :only => [:index, :show, :destroy] do
|
|
11
11
|
get :last, :on => :collection
|
|
12
12
|
end
|
|
@@ -34,9 +34,9 @@ Rails.application.routes.draw do
|
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
constraints(:id =>
|
|
37
|
+
constraints(:id => %r{[^/]+}) do
|
|
38
38
|
resources :hosts do
|
|
39
|
-
constraints(:host_id =>
|
|
39
|
+
constraints(:host_id => %r{[^/]+}) do
|
|
40
40
|
resources :omaha_reports, :only => [:index, :show]
|
|
41
41
|
end
|
|
42
42
|
end
|
data/lib/foreman_omaha/engine.rb
CHANGED
|
@@ -19,96 +19,101 @@ module ForemanOmaha
|
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
-
initializer 'foreman_omaha.register_plugin', :before => :finisher_hook do |
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
:
|
|
50
|
-
|
|
22
|
+
initializer 'foreman_omaha.register_plugin', :before => :finisher_hook do |app|
|
|
23
|
+
app.reloader.to_prepare do
|
|
24
|
+
Foreman::Plugin.register :foreman_omaha do
|
|
25
|
+
requires_foreman '>= 3.0'
|
|
26
|
+
|
|
27
|
+
automatic_assets(false)
|
|
28
|
+
precompile_assets(['foreman_omaha/version_breakdown.css', 'foreman_omaha/application.js'])
|
|
29
|
+
|
|
30
|
+
apipie_documented_controllers ["#{ForemanOmaha::Engine.root}/app/controllers/api/v2/*.rb"]
|
|
31
|
+
|
|
32
|
+
register_custom_status ForemanOmaha::OmahaStatus
|
|
33
|
+
|
|
34
|
+
# Add permissions
|
|
35
|
+
security_block :foreman_omaha do
|
|
36
|
+
permission :view_omaha_reports, {
|
|
37
|
+
:omaha_reports => [:index, :show, :auto_complete_search],
|
|
38
|
+
:'api/v2/omaha_reports' => [:index, :show, :last]
|
|
39
|
+
}, :resource_type => 'ForemanOmaha::OmahaReport'
|
|
40
|
+
|
|
41
|
+
permission :destroy_omaha_reports, {
|
|
42
|
+
:omaha_reports => [:destroy],
|
|
43
|
+
:'api/v2/omaha_reports' => [:destroy]
|
|
44
|
+
}, :resource_type => 'ForemanOmaha::OmahaReport'
|
|
45
|
+
|
|
46
|
+
permission :upload_omaha_reports, {
|
|
47
|
+
:omaha_reports => [:create],
|
|
48
|
+
:'api/v2/omaha_reports' => [:create]
|
|
49
|
+
}, :resource_type => 'ForemanOmaha::OmahaReport'
|
|
50
|
+
|
|
51
|
+
permission :view_omaha_groups, {
|
|
52
|
+
:omaha_groups => [:index, :auto_complete_search, :show],
|
|
53
|
+
:'api/v2/omaha_groups' => [:index, :show]
|
|
54
|
+
}, :resource_type => 'ForemanOmaha::OmahaGroup'
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
role 'Omaha reports viewer',
|
|
58
|
+
[:view_omaha_reports],
|
|
59
|
+
'Role granting permissions to view Omaha reports.'
|
|
60
|
+
role 'Omaha reports manager',
|
|
61
|
+
[:view_omaha_reports, :destroy_omaha_reports, :upload_omaha_reports],
|
|
62
|
+
'Role granting permissions to manage Omaha reports.'
|
|
63
|
+
|
|
64
|
+
# add menu entry
|
|
65
|
+
menu :top_menu, :omaha_reports,
|
|
66
|
+
:url_hash => { controller: :omaha_reports, action: :index },
|
|
67
|
+
:caption => N_('Omaha Reports'),
|
|
68
|
+
:parent => :monitor_menu,
|
|
69
|
+
:after => :reports
|
|
70
|
+
|
|
71
|
+
menu :top_menu, :omaha_hosts,
|
|
72
|
+
:url_hash => { :controller => :omaha_hosts, :action => :index },
|
|
73
|
+
:caption => N_('Omaha Hosts'),
|
|
74
|
+
:parent => :hosts_menu,
|
|
75
|
+
:after => :hosts
|
|
76
|
+
|
|
77
|
+
divider :top_menu, :caption => N_('Omaha'), :parent => :configure_menu, :last => true
|
|
78
|
+
|
|
79
|
+
menu :top_menu, :omaha_groups,
|
|
80
|
+
:url_hash => { :controller => :omaha_groups, :action => :index },
|
|
81
|
+
:caption => N_('Omaha Groups'),
|
|
82
|
+
:parent => :configure_menu,
|
|
83
|
+
:last => :true
|
|
84
|
+
|
|
85
|
+
# Omaha Facet
|
|
86
|
+
register_facet(ForemanOmaha::OmahaFacet, :omaha_facet) do
|
|
87
|
+
api_view :list => 'foreman_omaha/api/v2/omaha_facets/base_with_root', :single => 'foreman_omaha/api/v2/omaha_facets/show'
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# extend host show page
|
|
91
|
+
extend_page('hosts/show') do |context|
|
|
92
|
+
context.add_pagelet :main_tabs,
|
|
93
|
+
:name => N_('Omaha'),
|
|
94
|
+
:partial => 'hosts/omaha_tab',
|
|
95
|
+
:onlyif => proc(&:omaha_facet)
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
add_controller_action_scope('HostsController', :index) { |base_scope| base_scope.includes(:omaha_facet) }
|
|
99
|
+
|
|
100
|
+
# add renderer extensions
|
|
101
|
+
extend_template_helpers ForemanOmaha::TemplateRendererHelper
|
|
102
|
+
allowed_template_helpers :transpile_container_linux_config
|
|
103
|
+
|
|
104
|
+
register_graphql_query_field :omaha_group, 'ForemanOmaha::Types::OmahaGroup', :record_field
|
|
105
|
+
register_graphql_query_field :omaha_groups, 'ForemanOmaha::Types::OmahaGroup', :collection_field
|
|
106
|
+
|
|
107
|
+
register_graphql_query_field :omaha_report, 'ForemanOmaha::Types::OmahaReport', :record_field
|
|
108
|
+
register_graphql_query_field :omaha_reports, 'ForemanOmaha::Types::OmahaReport', :collection_field
|
|
51
109
|
end
|
|
52
110
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'Role granting permissions to manage Omaha reports.'
|
|
59
|
-
|
|
60
|
-
# add menu entry
|
|
61
|
-
menu :top_menu, :omaha_reports,
|
|
62
|
-
:url_hash => { controller: :omaha_reports, action: :index },
|
|
63
|
-
:caption => N_('Omaha Reports'),
|
|
64
|
-
:parent => :monitor_menu,
|
|
65
|
-
:after => :reports
|
|
66
|
-
|
|
67
|
-
menu :top_menu, :omaha_hosts,
|
|
68
|
-
:url_hash => { :controller => :omaha_hosts, :action => :index },
|
|
69
|
-
:caption => N_('Omaha Hosts'),
|
|
70
|
-
:parent => :hosts_menu,
|
|
71
|
-
:after => :hosts
|
|
72
|
-
|
|
73
|
-
divider :top_menu, :caption => N_('Omaha'), :parent => :configure_menu, :last => true
|
|
74
|
-
|
|
75
|
-
menu :top_menu, :omaha_groups,
|
|
76
|
-
:url_hash => { :controller => :omaha_groups, :action => :index },
|
|
77
|
-
:caption => N_('Omaha Groups'),
|
|
78
|
-
:parent => :configure_menu,
|
|
79
|
-
:last => :true
|
|
80
|
-
|
|
81
|
-
# Omaha Facet
|
|
82
|
-
register_facet(ForemanOmaha::OmahaFacet, :omaha_facet) do
|
|
83
|
-
api_view :list => 'foreman_omaha/api/v2/omaha_facets/base_with_root', :single => 'foreman_omaha/api/v2/omaha_facets/show'
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
# extend host show page
|
|
87
|
-
extend_page('hosts/show') do |context|
|
|
88
|
-
context.add_pagelet :main_tabs,
|
|
89
|
-
:name => N_('Omaha'),
|
|
90
|
-
:partial => 'hosts/omaha_tab',
|
|
91
|
-
:onlyif => proc { |host| host.omaha_facet }
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
add_controller_action_scope('HostsController', :index) { |base_scope| base_scope.includes(:omaha_facet) }
|
|
95
|
-
|
|
96
|
-
# add renderer extensions
|
|
97
|
-
extend_template_helpers ForemanOmaha::TemplateRendererHelper
|
|
98
|
-
allowed_template_helpers :transpile_container_linux_config
|
|
99
|
-
|
|
100
|
-
register_graphql_query_field :omaha_group, 'ForemanOmaha::Types::OmahaGroup', :record_field
|
|
101
|
-
register_graphql_query_field :omaha_groups, 'ForemanOmaha::Types::OmahaGroup', :collection_field
|
|
102
|
-
|
|
103
|
-
register_graphql_query_field :omaha_report, 'ForemanOmaha::Types::OmahaReport', :record_field
|
|
104
|
-
register_graphql_query_field :omaha_reports, 'ForemanOmaha::Types::OmahaReport', :collection_field
|
|
111
|
+
# Extend built in permissions
|
|
112
|
+
Foreman::AccessControl.permission(:view_hosts).actions.concat [
|
|
113
|
+
'omaha_hosts/index',
|
|
114
|
+
'omaha_hosts/auto_complete_search'
|
|
115
|
+
]
|
|
105
116
|
end
|
|
106
|
-
|
|
107
|
-
# Extend built in permissions
|
|
108
|
-
Foreman::AccessControl.permission(:view_hosts).actions.concat [
|
|
109
|
-
'omaha_hosts/index',
|
|
110
|
-
'omaha_hosts/auto_complete_search'
|
|
111
|
-
]
|
|
112
117
|
end
|
|
113
118
|
|
|
114
119
|
# Include concerns in this config.to_prepare block
|
|
@@ -17,10 +17,8 @@ module ForemanOmaha
|
|
|
17
17
|
end
|
|
18
18
|
|
|
19
19
|
test 'calculates the oem distribution' do
|
|
20
|
-
expected = [
|
|
21
|
-
|
|
22
|
-
]
|
|
23
|
-
assert_equal(expected, oem_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
|
|
20
|
+
expected = [['rackspace', 5]]
|
|
21
|
+
assert_same_elements expected, oem_distribition_chart.to_chart_data
|
|
24
22
|
end
|
|
25
23
|
end
|
|
26
24
|
end
|
|
@@ -18,11 +18,8 @@ module ForemanOmaha
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
test 'calculates the status distribution' do
|
|
21
|
-
expected = [
|
|
22
|
-
|
|
23
|
-
{ :label => 'Downloading', :data => 3, :color => '#3D96AE' }
|
|
24
|
-
]
|
|
25
|
-
assert_equal(expected, status_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
|
|
21
|
+
expected = [['Complete', 5], ['Downloading', 3]]
|
|
22
|
+
assert_same_elements expected, status_distribition_chart.to_chart_data
|
|
26
23
|
end
|
|
27
24
|
end
|
|
28
25
|
end
|
|
@@ -18,11 +18,8 @@ module ForemanOmaha
|
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
test 'calculates the version distribution' do
|
|
21
|
-
expected = [
|
|
22
|
-
|
|
23
|
-
{ :label => '1465.7.0', :data => 7 }
|
|
24
|
-
]
|
|
25
|
-
assert_equal(expected, version_distribition_chart.to_chart_data.sort_by { |e| e[:label] })
|
|
21
|
+
expected = [['1068.9.0', 5], ['1465.7.0', 7]]
|
|
22
|
+
assert_same_elements expected, version_distribition_chart.to_chart_data
|
|
26
23
|
end
|
|
27
24
|
end
|
|
28
25
|
end
|
|
@@ -4,7 +4,7 @@ require 'test_plugin_helper'
|
|
|
4
4
|
|
|
5
5
|
class OmahaStatusTest < ActiveSupport::TestCase
|
|
6
6
|
let(:host) { FactoryBot.build_stubbed(:host, :with_omaha_facet) }
|
|
7
|
-
let(:status) {
|
|
7
|
+
let(:status) { ForemanOmaha::OmahaStatus.new }
|
|
8
8
|
|
|
9
9
|
setup do
|
|
10
10
|
User.current = FactoryBot.create(:user, :admin)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'test_plugin_helper'
|
|
4
|
+
|
|
5
|
+
class OmahaGroupTest < ActiveSupport::TestCase
|
|
6
|
+
setup do
|
|
7
|
+
User.current = FactoryBot.create(:user, :admin)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
let(:omaha_group) { FactoryBot.create(:omaha_group, :uuid => 'stable', :name => 'Stable') }
|
|
11
|
+
let(:releases) { ['1520.5.0', '1520.6.0', '1465.8.0'].map { |release| Gem::Version.new(release) } }
|
|
12
|
+
let(:operatingsystems) do
|
|
13
|
+
releases.map do |semver|
|
|
14
|
+
FactoryBot.create(
|
|
15
|
+
:coreos,
|
|
16
|
+
:with_associations,
|
|
17
|
+
:major => semver.segments.first,
|
|
18
|
+
:minor => semver.segments.last(2).join('.'),
|
|
19
|
+
:release_name => 'stable',
|
|
20
|
+
:title => "CoreOS #{semver}"
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context 'with operatingsystems' do
|
|
26
|
+
setup do
|
|
27
|
+
operatingsystems
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
test 'return latest operating system' do
|
|
31
|
+
latest_operatingsystem = omaha_group.latest_operatingsystem
|
|
32
|
+
|
|
33
|
+
assert_equal '1520', latest_operatingsystem.major
|
|
34
|
+
assert_equal '6.0', latest_operatingsystem.minor
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_omaha
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Timo Goebel
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: jquery-matchheight-rails
|
|
@@ -39,61 +38,19 @@ dependencies:
|
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name: rubocop
|
|
41
|
+
name: theforeman-rubocop
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
|
-
requirements:
|
|
45
|
-
- - ">="
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.80.0
|
|
48
|
-
type: :development
|
|
49
|
-
prerelease: false
|
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
-
requirements:
|
|
52
|
-
- - ">="
|
|
53
|
-
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.80.0
|
|
55
|
-
- !ruby/object:Gem::Dependency
|
|
56
|
-
name: rubocop-minitest
|
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
|
58
|
-
requirements:
|
|
59
|
-
- - "~>"
|
|
60
|
-
- !ruby/object:Gem::Version
|
|
61
|
-
version: 0.7.0
|
|
62
|
-
type: :development
|
|
63
|
-
prerelease: false
|
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
-
requirements:
|
|
66
|
-
- - "~>"
|
|
67
|
-
- !ruby/object:Gem::Version
|
|
68
|
-
version: 0.7.0
|
|
69
|
-
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rubocop-performance
|
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
|
72
|
-
requirements:
|
|
73
|
-
- - "~>"
|
|
74
|
-
- !ruby/object:Gem::Version
|
|
75
|
-
version: 1.5.2
|
|
76
|
-
type: :development
|
|
77
|
-
prerelease: false
|
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
79
43
|
requirements:
|
|
80
44
|
- - "~>"
|
|
81
45
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: 1.
|
|
83
|
-
- !ruby/object:Gem::Dependency
|
|
84
|
-
name: rubocop-rails
|
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
|
86
|
-
requirements:
|
|
87
|
-
- - "~>"
|
|
88
|
-
- !ruby/object:Gem::Version
|
|
89
|
-
version: 2.4.2
|
|
46
|
+
version: 0.1.2
|
|
90
47
|
type: :development
|
|
91
48
|
prerelease: false
|
|
92
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
50
|
requirements:
|
|
94
51
|
- - "~>"
|
|
95
52
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
53
|
+
version: 0.1.2
|
|
97
54
|
description: This plug-in adds support for the Omaha procotol to The Foreman. It allows
|
|
98
55
|
you to better manage and update your CoreOS servers.
|
|
99
56
|
email:
|
|
@@ -128,7 +85,7 @@ files:
|
|
|
128
85
|
- app/models/foreman_omaha/omaha_facet.rb
|
|
129
86
|
- app/models/foreman_omaha/omaha_group.rb
|
|
130
87
|
- app/models/foreman_omaha/omaha_report.rb
|
|
131
|
-
- app/models/
|
|
88
|
+
- app/models/foreman_omaha/omaha_status.rb
|
|
132
89
|
- app/services/foreman_omaha/charts/oem_distribution.rb
|
|
133
90
|
- app/services/foreman_omaha/charts/status_distribution.rb
|
|
134
91
|
- app/services/foreman_omaha/charts/version_distribution.rb
|
|
@@ -198,13 +155,13 @@ files:
|
|
|
198
155
|
- test/unit/host_status/omaha_status_test.rb
|
|
199
156
|
- test/unit/host_test.rb
|
|
200
157
|
- test/unit/omaha_fact_parser_test.rb
|
|
158
|
+
- test/unit/omaha_group_test.rb
|
|
201
159
|
- test/unit/omaha_report_test.rb
|
|
202
160
|
- test/unit/renderer_test.rb
|
|
203
161
|
homepage: http://github.com/theforeman/foreman_omaha
|
|
204
162
|
licenses:
|
|
205
163
|
- GPL-3
|
|
206
164
|
metadata: {}
|
|
207
|
-
post_install_message:
|
|
208
165
|
rdoc_options: []
|
|
209
166
|
require_paths:
|
|
210
167
|
- lib
|
|
@@ -212,39 +169,39 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
212
169
|
requirements:
|
|
213
170
|
- - ">="
|
|
214
171
|
- !ruby/object:Gem::Version
|
|
215
|
-
version: '0'
|
|
172
|
+
version: '3.0'
|
|
216
173
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
174
|
requirements:
|
|
218
175
|
- - ">="
|
|
219
176
|
- !ruby/object:Gem::Version
|
|
220
177
|
version: '0'
|
|
221
178
|
requirements: []
|
|
222
|
-
rubygems_version:
|
|
223
|
-
signing_key:
|
|
179
|
+
rubygems_version: 4.0.16
|
|
224
180
|
specification_version: 4
|
|
225
181
|
summary: This plug-in adds support for the Omaha procotol to The Foreman.
|
|
226
182
|
test_files:
|
|
227
|
-
- test/unit/omaha_fact_parser_test.rb
|
|
228
|
-
- test/unit/charts/version_distribution_test.rb
|
|
229
|
-
- test/unit/charts/oem_distribution_test.rb
|
|
230
|
-
- test/unit/charts/status_distribution_test.rb
|
|
231
|
-
- test/unit/group_version_breakdown_test.rb
|
|
232
|
-
- test/unit/host_test.rb
|
|
233
|
-
- test/unit/host_status/omaha_status_test.rb
|
|
234
|
-
- test/unit/renderer_test.rb
|
|
235
|
-
- test/unit/omaha_report_test.rb
|
|
236
|
-
- test/graphql/queries/omaha_group_query_test.rb
|
|
237
|
-
- test/graphql/queries/omaha_report_query_test.rb
|
|
238
|
-
- test/graphql/queries/omaha_groups_query_test.rb
|
|
239
|
-
- test/graphql/queries/omaha_reports_query_test.rb
|
|
240
|
-
- test/graphql/queries/host_query_extensions_test.rb
|
|
241
|
-
- test/factories/smart_proxy.rb
|
|
242
183
|
- test/factories/feature.rb
|
|
243
|
-
- test/factories/host.rb
|
|
244
184
|
- test/factories/foreman_omaha_factories.rb
|
|
245
|
-
- test/
|
|
246
|
-
- test/
|
|
247
|
-
- test/functional/omaha_hosts_controller_test.rb
|
|
185
|
+
- test/factories/host.rb
|
|
186
|
+
- test/factories/smart_proxy.rb
|
|
248
187
|
- test/functional/api/v2/omaha_groups_controller_test.rb
|
|
249
188
|
- test/functional/api/v2/omaha_reports_controller_test.rb
|
|
189
|
+
- test/functional/omaha_groups_controller_test.rb
|
|
190
|
+
- test/functional/omaha_hosts_controller_test.rb
|
|
250
191
|
- test/functional/omaha_reports_controller_test.rb
|
|
192
|
+
- test/graphql/queries/host_query_extensions_test.rb
|
|
193
|
+
- test/graphql/queries/omaha_group_query_test.rb
|
|
194
|
+
- test/graphql/queries/omaha_groups_query_test.rb
|
|
195
|
+
- test/graphql/queries/omaha_report_query_test.rb
|
|
196
|
+
- test/graphql/queries/omaha_reports_query_test.rb
|
|
197
|
+
- test/test_plugin_helper.rb
|
|
198
|
+
- test/unit/charts/oem_distribution_test.rb
|
|
199
|
+
- test/unit/charts/status_distribution_test.rb
|
|
200
|
+
- test/unit/charts/version_distribution_test.rb
|
|
201
|
+
- test/unit/group_version_breakdown_test.rb
|
|
202
|
+
- test/unit/host_status/omaha_status_test.rb
|
|
203
|
+
- test/unit/host_test.rb
|
|
204
|
+
- test/unit/omaha_fact_parser_test.rb
|
|
205
|
+
- test/unit/omaha_group_test.rb
|
|
206
|
+
- test/unit/omaha_report_test.rb
|
|
207
|
+
- test/unit/renderer_test.rb
|