foreman_omaha 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/controllers/api/v2/omaha_groups_controller.rb +2 -0
- data/app/controllers/api/v2/omaha_reports_controller.rb +2 -0
- data/app/controllers/omaha_groups_controller.rb +2 -0
- data/app/controllers/omaha_hosts_controller.rb +2 -0
- data/app/controllers/omaha_reports_controller.rb +2 -0
- data/app/graphql/types/omaha_group.rb +15 -0
- data/app/graphql/types/omaha_report.rb +15 -0
- data/app/graphql/types/omaha_report_status_enum.rb +9 -0
- data/app/helpers/concerns/foreman_omaha/hosts_helper_extensions.rb +2 -0
- data/app/helpers/foreman_omaha/application_helper.rb +2 -0
- data/app/helpers/foreman_omaha/omaha_groups_helper.rb +2 -0
- data/app/helpers/omaha_hosts_helper.rb +2 -0
- data/app/helpers/omaha_reports_helper.rb +2 -0
- data/app/lib/foreman_omaha/renderer/scope/macros/omaha.rb +2 -0
- data/app/models/concerns/foreman_omaha/host_extensions.rb +3 -1
- data/app/models/concerns/foreman_omaha/omaha_facet_host_extensions.rb +2 -0
- data/app/models/foreman_omaha/fact_name.rb +2 -0
- data/app/models/foreman_omaha/omaha_facet.rb +2 -0
- data/app/models/foreman_omaha/omaha_group.rb +4 -0
- data/app/models/foreman_omaha/omaha_report.rb +4 -0
- data/app/models/host_status/omaha_status.rb +2 -0
- data/app/services/foreman_omaha/charts/oem_distribution.rb +2 -0
- data/app/services/foreman_omaha/charts/status_distribution.rb +2 -0
- data/app/services/foreman_omaha/charts/version_distribution.rb +2 -0
- data/app/services/foreman_omaha/container_linux_config_transpiler.rb +2 -0
- data/app/services/foreman_omaha/fact_importer.rb +2 -0
- data/app/services/foreman_omaha/fact_parser.rb +11 -3
- data/app/services/foreman_omaha/group_version_breakdown.rb +2 -0
- data/app/services/foreman_omaha/omaha_report_importer.rb +2 -0
- data/app/services/foreman_omaha/status_mapper.rb +2 -2
- data/app/views/api/v2/omaha_groups/base.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/index.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/main.json.rabl +2 -0
- data/app/views/api/v2/omaha_groups/show.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/base.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/create.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/index.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/main.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/show.json.rabl +2 -0
- data/app/views/api/v2/omaha_reports/update.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/base.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/base_with_root.json.rabl +2 -0
- data/app/views/foreman_omaha/api/v2/omaha_facets/show.json.rabl +2 -0
- data/app/views/omaha_reports/_list.html.erb +1 -1
- data/config/routes.rb +2 -0
- data/db/migrate/20160812083100_add_omaha_fields_to_reports.foreman_omaha.rb +2 -0
- data/db/migrate/20171101204100_create_omaha_facets.foreman_omaha.rb +2 -0
- data/db/seeds.d/200_omaha_groups.rb +2 -0
- data/db/seeds.d/60_omaha_proxy_feature.rb +2 -0
- data/lib/foreman_omaha.rb +2 -0
- data/lib/foreman_omaha/engine.rb +24 -8
- data/lib/foreman_omaha/version.rb +3 -1
- data/lib/tasks/foreman_omaha_tasks.rake +2 -0
- data/locale/gemspec.rb +2 -0
- data/test/factories/feature.rb +3 -1
- data/test/factories/foreman_omaha_factories.rb +8 -6
- data/test/factories/host.rb +19 -4
- data/test/factories/smart_proxy.rb +2 -0
- data/test/functional/api/v2/omaha_groups_controller_test.rb +2 -0
- data/test/functional/api/v2/omaha_reports_controller_test.rb +3 -1
- data/test/functional/omaha_groups_controller_test.rb +2 -0
- data/test/functional/omaha_hosts_controller_test.rb +2 -0
- data/test/functional/omaha_reports_controller_test.rb +2 -0
- data/test/graphql/queries/host_query_extensions_test.rb +41 -0
- data/test/graphql/queries/omaha_group_query_test.rb +51 -0
- data/test/graphql/queries/omaha_groups_query_test.rb +47 -0
- data/test/graphql/queries/omaha_report_query_test.rb +44 -0
- data/test/graphql/queries/omaha_reports_query_test.rb +47 -0
- data/test/test_plugin_helper.rb +2 -0
- data/test/unit/charts/oem_distribution_test.rb +2 -0
- data/test/unit/charts/status_distribution_test.rb +2 -0
- data/test/unit/charts/version_distribution_test.rb +2 -0
- data/test/unit/group_version_breakdown_test.rb +2 -0
- data/test/unit/host_status/omaha_status_test.rb +4 -2
- data/test/unit/host_test.rb +2 -0
- data/test/unit/omaha_fact_parser_test.rb +45 -11
- data/test/unit/omaha_report_test.rb +2 -0
- data/test/unit/renderer_test.rb +2 -0
- metadata +62 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d18486e7d9ec48f38e24dc3230ac7952154b6368bb03b6200b530d40dfccb56
|
4
|
+
data.tar.gz: a35576ff4b8182f2d12364c3440d8fea31e194f1c39e4b8ed9787a5f487fdb69
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea1a506216f9a64abe54920027716bfe31557db3d32b7cd867ad10c7bf6617f76413264be1b560bee338d6ece41c04b4752631cb773b27d53f664431b848fc5b
|
7
|
+
data.tar.gz: 9209885e3ca0b369d6acca9de2b59fbca45ce5d97ab163aa9d922bf6091f81453609c4fe0764f3b57b02cb162d7a5a093ed814d533f7b6d786743e47e83f8447
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# ForemanOmaha
|
2
2
|
|
3
|
-
This plug-in enables CoreOS updates using [The Foreman](https://theforeman.org/) without using the public update infrastructure.
|
3
|
+
This plug-in enables CoreOS and Flatcar updates using [The Foreman](https://theforeman.org/) without using the public update infrastructure.
|
4
4
|
To follow along with common Foreman architecture, you need this Foreman plug-in installed and a [Smart-Proxy plugin](https://github.com/theforeman/smart_proxy_omaha). The smart-proxy plug-in does all the heavy lifting. The Foreman plug-in shows facts and reports for your hosts.
|
5
5
|
Foreman core already supports deploying CoreOS hosts and is great for on-premise setups. This plug-in enables you to better manage your servers.
|
6
6
|
|
@@ -12,6 +12,7 @@ Foreman core already supports deploying CoreOS hosts and is great for on-premise
|
|
12
12
|
| >= 1.17 | ~> 1.0 |
|
13
13
|
| >= 1.18 | ~> 2.0 |
|
14
14
|
| >= 1.20 | ~> 3.0 |
|
15
|
+
| >= 1.24 | ~> 4.0 |
|
15
16
|
|
16
17
|
## Installation
|
17
18
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Types
|
4
|
+
class OmahaGroup < BaseObject
|
5
|
+
model_class ::ForemanOmaha::OmahaGroup
|
6
|
+
description 'An Omaha Group'
|
7
|
+
|
8
|
+
global_id_field :id
|
9
|
+
timestamps
|
10
|
+
field :name, String
|
11
|
+
field :uuid, String
|
12
|
+
|
13
|
+
has_many :hosts, Types::Host
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Types
|
4
|
+
class OmahaReport < BaseObject
|
5
|
+
model_class ::ForemanOmaha::OmahaReport
|
6
|
+
description 'An Omaha Report'
|
7
|
+
|
8
|
+
global_id_field :id
|
9
|
+
timestamps
|
10
|
+
field :status, Types::OmahaReportStatusEnum
|
11
|
+
field :omaha_version, String
|
12
|
+
|
13
|
+
belongs_to :host, Types::Host
|
14
|
+
end
|
15
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ForemanOmaha
|
2
4
|
module HostExtensions
|
3
5
|
extend ActiveSupport::Concern
|
@@ -14,7 +16,7 @@ module ForemanOmaha
|
|
14
16
|
end
|
15
17
|
|
16
18
|
def clear_omaha_facet
|
17
|
-
omaha_facet
|
19
|
+
omaha_facet&.destroy
|
18
20
|
end
|
19
21
|
|
20
22
|
def clear_omaha_facet_on_build
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ForemanOmaha
|
2
4
|
class OmahaGroup < ApplicationRecord
|
3
5
|
include Authorizable
|
@@ -6,6 +8,8 @@ module ForemanOmaha
|
|
6
8
|
N_('Omaha Channel')
|
7
9
|
end
|
8
10
|
|
11
|
+
graphql_type '::Types::OmahaGroup'
|
12
|
+
|
9
13
|
has_many :omaha_facets, :class_name => 'ForemanOmaha::OmahaFacet', :foreign_key => :omaha_group_id,
|
10
14
|
:inverse_of => :omaha_group, :dependent => :restrict_with_exception
|
11
15
|
has_many :hosts, :class_name => '::Host::Managed', :through => :omaha_facets,
|
@@ -1,7 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ForemanOmaha
|
2
4
|
class OmahaReport < ::Report
|
3
5
|
enum :status => OmahaFacet::VALID_OMAHA_STATUSES
|
4
6
|
|
7
|
+
graphql_type '::Types::OmahaReport'
|
8
|
+
|
5
9
|
scoped_search :on => :omaha_version, :rename => :version, :complete_value => true
|
6
10
|
scoped_search :on => :status, :complete_value => statuses
|
7
11
|
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ForemanOmaha
|
2
4
|
class FactParser < ::FactParser
|
3
5
|
def operatingsystem
|
4
|
-
args = { :name =>
|
5
|
-
description = "#{
|
6
|
+
args = { :name => os_name, :major => facts['osmajor'], :minor => facts['osminor'] }
|
7
|
+
description = "#{os_name} #{facts['version']}"
|
6
8
|
Coreos.where(args).first ||
|
7
9
|
create_coreos_version(args.merge(:description => description,
|
8
10
|
:release_name => facts['track']))
|
@@ -31,6 +33,12 @@ module ForemanOmaha
|
|
31
33
|
|
32
34
|
private
|
33
35
|
|
36
|
+
def os_name
|
37
|
+
return 'Flatcar' if facts['distribution']&.downcase == 'flatcar'
|
38
|
+
|
39
|
+
facts['platform']
|
40
|
+
end
|
41
|
+
|
34
42
|
def create_coreos_version(attrs)
|
35
43
|
previous_version = previous_coreos_version
|
36
44
|
return Coreos.create!(attrs) unless previous_coreos_version
|
@@ -43,7 +51,7 @@ module ForemanOmaha
|
|
43
51
|
end
|
44
52
|
|
45
53
|
def previous_coreos_version
|
46
|
-
Coreos.
|
54
|
+
Coreos.where(name: os_name).max_by { |os| Gem::Version.new(os.release) }
|
47
55
|
end
|
48
56
|
end
|
49
57
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module ForemanOmaha
|
2
4
|
class StatusMapper
|
3
5
|
attr_accessor :status
|
@@ -25,7 +27,6 @@ module ForemanOmaha
|
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
28
|
-
# rubocop:disable Metrics/CyclomaticComplexity
|
29
30
|
def to_description(version = nil)
|
30
31
|
case status.to_sym
|
31
32
|
when :complete
|
@@ -48,6 +49,5 @@ module ForemanOmaha
|
|
48
49
|
_('The status of this host is unknown.')
|
49
50
|
end
|
50
51
|
end
|
51
|
-
# rubocop:enable Metrics/CyclomaticComplexity
|
52
52
|
end
|
53
53
|
end
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<td title="<%= report.to_description(report.omaha_version) %>"><span class="<%= iconclass_for_omaha_status(report.status) %>"></span> <%= report.to_label %></td>
|
26
26
|
<td>
|
27
27
|
<%= action_buttons(display_delete_if_authorized hash_for_omaha_report_path(:id => report).merge(:auth_object => report, :authorizer => authorizer),
|
28
|
-
|
28
|
+
:data => { :confirm => _("Delete report for %s?") % report.host.try(:name)}) %>
|
29
29
|
</td>
|
30
30
|
</tr>
|
31
31
|
<% end %>
|