katello 3.0.0.rc4 → 3.0.0.rc5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of katello might be problematic. Click here for more details.

Files changed (68) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/katello/hosts/host_and_hostgroup_edit.js +129 -47
  3. data/app/controllers/katello/api/rhsm/candlepin_proxies_controller.rb +2 -2
  4. data/app/controllers/katello/api/v2/activation_keys_controller.rb +9 -0
  5. data/app/controllers/katello/api/v2/api_controller.rb +13 -6
  6. data/app/controllers/katello/api/v2/content_view_filter_rules_controller.rb +1 -1
  7. data/app/controllers/katello/api/v2/content_view_filters_controller.rb +1 -1
  8. data/app/controllers/katello/api/v2/environments_controller.rb +0 -2
  9. data/app/controllers/katello/api/v2/host_collections_controller.rb +4 -2
  10. data/app/controllers/katello/api/v2/repositories_controller.rb +10 -4
  11. data/app/controllers/katello/api/v2/repository_sets_controller.rb +3 -3
  12. data/app/controllers/katello/api/v2/systems_controller.rb +4 -1
  13. data/app/controllers/katello/application_controller.rb +1 -1
  14. data/app/controllers/katello/concerns/organizations_controller_extensions.rb +1 -1
  15. data/app/helpers/katello/hosts_and_hostgroups_helper.rb +125 -3
  16. data/app/lib/actions/candlepin/owner/refresh_subscriptions.rb +15 -0
  17. data/app/lib/actions/katello/host/register.rb +2 -2
  18. data/app/lib/actions/katello/product/create.rb +20 -15
  19. data/app/lib/actions/katello/repository/clone_yum_content.rb +4 -3
  20. data/app/lib/actions/katello/repository/index_errata.rb +0 -3
  21. data/app/lib/actions/pulp/repository/purge_empty_errata.rb +2 -8
  22. data/app/lib/actions/pulp/repository/purge_empty_package_groups.rb +3 -5
  23. data/app/lib/katello/concerns/renderer_extensions.rb +1 -2
  24. data/app/lib/katello/resources/candlepin.rb +0 -1
  25. data/app/models/katello/concerns/host_managed_extensions.rb +7 -2
  26. data/app/models/katello/concerns/hostgroup_extensions.rb +6 -2
  27. data/app/models/katello/concerns/redhat_extensions.rb +11 -5
  28. data/app/models/katello/content_view.rb +0 -35
  29. data/app/models/katello/erratum.rb +2 -1
  30. data/app/models/katello/host/content_facet.rb +2 -1
  31. data/app/models/katello/repository.rb +26 -0
  32. data/app/models/katello/rhsm_fact_parser.rb +6 -2
  33. data/app/models/setting/katello.rb +2 -2
  34. data/app/overrides/add_activation_keys_input.rb +10 -0
  35. data/app/views/katello/api/v2/environments/show.json.rabl +1 -0
  36. data/app/views/katello/api/v2/host_collections/{_host_collection.json.rabl → base.json.rabl} +0 -0
  37. data/app/views/katello/api/v2/host_collections/copy.json.rabl +1 -1
  38. data/app/views/katello/api/v2/host_collections/create.json.rabl +1 -1
  39. data/app/views/katello/api/v2/host_collections/index.json.rabl +5 -1
  40. data/app/views/katello/api/v2/host_collections/show.json.rabl +2 -1
  41. data/app/views/katello/api/v2/host_collections/update.json.rabl +1 -1
  42. data/app/views/katello/api/v2/subscriptions/show.json.rabl +5 -0
  43. data/app/views/overrides/activation_keys/_host_environment_select.html.erb +12 -14
  44. data/app/views/overrides/activation_keys/_host_media_type_select.html.erb +26 -0
  45. data/app/views/overrides/activation_keys/_host_synced_content_select.html.erb +24 -0
  46. data/config/routes/overrides.rb +2 -6
  47. data/db/migrate/20150930183738_migrate_content_hosts.rb +5 -0
  48. data/db/migrate/20160413230128_add_kickstart_repository_to_hosts_and_hostgroups.rb +9 -0
  49. data/db/migrate/20160426145517_move_host_description_to_host_comment.rb +27 -0
  50. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion-katello-bootstrap.js +2 -1
  51. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/bastion_katello.js +3 -0
  52. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/content-hosts/details/content-host-base-subscriptions.controller.js +2 -2
  53. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/environments/views/environments.html +4 -5
  54. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/packages/details/package-details-repositories.controller.js +1 -1
  55. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/product-details.controller.js +3 -3
  56. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/products/details/views/product-details.html +4 -4
  57. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/repositories/new/new-repository.controller.js +14 -2
  58. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/setting.factory.js +15 -0
  59. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/settings/settings.module.js +12 -0
  60. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/subscriptions/details/views/subscription-associations-content-hosts.html +1 -1
  61. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/new/new-sync-plan.controller.js +1 -0
  62. data/engines/bastion_katello/app/assets/javascripts/bastion_katello/sync-plans/sync-plans.controller.js +1 -0
  63. data/lib/katello/engine.rb +5 -1
  64. data/lib/katello/tasks/clean_backend_objects.rake +6 -0
  65. data/lib/katello/version.rb +1 -1
  66. metadata +10 -5
  67. data/app/controllers/katello/concerns/operatingsystems_controller_extensions.rb +0 -34
  68. data/lib/katello/permissions/operatingsystems_permissions.rb +0 -5
@@ -82,7 +82,8 @@ module Katello
82
82
  joins("INNER JOIN #{Katello::RepositoryErratum.table_name} AS host_repo_errata ON \
83
83
  host_repo_errata.erratum_id = #{Katello::Erratum.table_name}.id").
84
84
  where("#{Katello::ContentFacetRepository.table_name}.repository_id = host_repo_errata.repository_id")
85
- query.where("#{Katello::Host::ContentFacet.table_name}.host_id" => [hosts.map(&:id)]) if hosts
85
+
86
+ query = query.joins(:content_facets).where("#{Katello::Host::ContentFacet.table_name}.host_id" => [hosts.map(&:id)]) if hosts
86
87
  query.uniq
87
88
  end
88
89
 
@@ -3,6 +3,7 @@ module Katello
3
3
  class ContentFacet < Katello::Model
4
4
  self.table_name = 'katello_content_facets'
5
5
 
6
+ belongs_to :kickstart_repository, :class_name => "::Katello::Repository", :foreign_key => :kickstart_repository_id, :inverse_of => :kickstart_content_facets
6
7
  belongs_to :host, :inverse_of => :content_facet, :class_name => "::Host::Managed"
7
8
  belongs_to :content_view, :inverse_of => :content_facets, :class_name => "Katello::ContentView"
8
9
  belongs_to :lifecycle_environment, :inverse_of => :content_facets, :class_name => "Katello::KTEnvironment"
@@ -18,7 +19,7 @@ module Katello
18
19
  validates :host, :presence => true, :allow_blank => false
19
20
  validates_with Validators::ContentViewEnvironmentValidator
20
21
 
21
- attr_accessible :content_view_id, :lifecycle_environment_id, :host
22
+ attr_accessible :content_view_id, :lifecycle_environment_id, :host, :kickstart_repository_id
22
23
 
23
24
  def update_repositories_by_paths(paths)
24
25
  paths = paths.map { |path| path.gsub('/pulp/repos/', '') }
@@ -1,4 +1,5 @@
1
1
  module Katello
2
+ # rubocop:disable Metrics/ClassLength
2
3
  class Repository < Katello::Model
3
4
  self.include_root_in_json = false
4
5
 
@@ -62,6 +63,9 @@ module Katello
62
63
  has_many :repository_package_groups, :class_name => "Katello::RepositoryPackageGroup", :dependent => :destroy
63
64
  has_many :package_groups, :through => :repository_package_groups
64
65
 
66
+ has_many :kickstart_content_facets, :class_name => "Katello::Host::ContentFacet", :foreign_key => :kickstart_repository_id,
67
+ :inverse_of => :kickstart_repository, :dependent => :nullify
68
+
65
69
  # rubocop:disable HasAndBelongsToMany
66
70
  # TODO: change this into has_many :through association
67
71
  has_and_belongs_to_many :filters, :class_name => "Katello::ContentViewFilter",
@@ -192,6 +196,28 @@ module Katello
192
196
  !(redhat?)
193
197
  end
194
198
 
199
+ def empty_errata
200
+ repository_rpm = Katello::RepositoryRpm.table_name
201
+ repository_errata = Katello::RepositoryErratum.table_name
202
+ rpm = Katello::Rpm.table_name
203
+ errata = Katello::Erratum.table_name
204
+ erratum_package = Katello::ErratumPackage.table_name
205
+
206
+ errata_with_packages = Erratum.joins(
207
+ "INNER JOIN #{erratum_package} on #{erratum_package}.erratum_id = #{errata}.id",
208
+ "INNER JOIN #{repository_errata} on #{repository_errata}.erratum_id = #{errata}.id",
209
+ "INNER JOIN #{rpm} on #{rpm}.filename = #{erratum_package}.filename",
210
+ "INNER JOIN #{repository_rpm} on #{repository_rpm}.rpm_id = #{rpm}.id").
211
+ where("#{repository_rpm}.repository_id" => self.id).
212
+ where("#{repository_errata}.repository_id" => self.id)
213
+
214
+ if errata_with_packages.any?
215
+ self.errata.where("#{Katello::Erratum.table_name}.id NOT IN (?)", errata_with_packages.pluck("#{errata}.id"))
216
+ else
217
+ self.errata
218
+ end
219
+ end
220
+
195
221
  def library_instance?
196
222
  library_instance.nil?
197
223
  end
@@ -42,13 +42,17 @@ module Katello
42
42
  return nil if name.nil? || version.nil?
43
43
 
44
44
  os_name = ::Katello::Candlepin::Consumer.distribution_to_puppet_os(name)
45
- if os_name
46
- major, minor = version.split('.')
45
+ major, minor = version.split('.')
46
+ if os_name && !invalid_centos_os?(os_name, minor)
47
47
  os_attributes = {:major => major, :minor => minor || '', :name => os_name}
48
48
  ::Operatingsystem.find_by(os_attributes) || ::Operatingsystem.create!(os_attributes)
49
49
  end
50
50
  end
51
51
 
52
+ def invalid_centos_os?(name, minor_version)
53
+ name == 'CentOS' && minor_version.blank?
54
+ end
55
+
52
56
  #required to be defined, even if they return nil
53
57
  def domain
54
58
  end
@@ -21,8 +21,8 @@ class Setting::Katello < Setting
21
21
  self.set('pulp_sync_node_action_finish_timeout', N_("Time in seconds to wait for a pulp node to finish sync"), 12.hours.to_i),
22
22
  self.set('check_services_before_actions', N_("Whether or not to check the status of backend services such as pulp and candlepin prior to performing some actions."), true),
23
23
  self.set('force_post_sync_actions', N_("Force post sync actions such as indexing and email even if no content was available."), false),
24
- self.set('default_download_policy', N_("Default download policy for repositories (either 'immediate', 'on_demand', or 'background')"), "on_demand"),
25
- self.set('pulp_export_destination', N_("On-disk location for exported repositories"), N_("Please fill path in.")),
24
+ self.set('default_download_policy', N_("Default download policy for repositories (either 'immediate', 'on_demand', or 'background')"), "immediate"),
25
+ self.set('pulp_export_destination', N_("On-disk location for exported repositories"), N_("/var/lib/pulp/katello-export")),
26
26
  self.set('pulp_client_key', N_("Path for ssl key used for pulp server auth"), "/etc/pki/katello/private/pulp-client.key"),
27
27
  self.set('pulp_client_cert', N_("Path for ssl cert used for pulp server auth"), "/etc/pki/katello/certs/pulp-client.crt"),
28
28
  self.set('remote_execution_by_default', N_("If set to true, use the remote execution over katello-agent for remote actions"), false),
@@ -17,3 +17,13 @@ Deface::Override.new(:virtual_path => "hosts/_form",
17
17
  :name => "hosts_update_environments_select",
18
18
  :replace => 'erb[loud]:contains("select_f"):contains(":environment_id")',
19
19
  :partial => 'overrides/activation_keys/host_environment_select')
20
+
21
+ Deface::Override.new(:virtual_path => "common/os_selection/_operatingsystem",
22
+ :name => "hosts_select_media_type",
23
+ :insert_before => 'erb[loud]:contains("select_f"):contains(":medium_id")',
24
+ :partial => 'overrides/activation_keys/host_media_type_select')
25
+
26
+ Deface::Override.new(:virtual_path => "common/os_selection/_operatingsystem",
27
+ :name => "hosts_select_synced_content",
28
+ :insert_after => 'erb[loud]:contains("select_f"):contains(":medium_id")',
29
+ :partial => 'overrides/activation_keys/host_synced_content_select')
@@ -37,6 +37,7 @@ end
37
37
 
38
38
  node :permissions do |env|
39
39
  {
40
+ :create_lifecycle_environments => env.creatable?,
40
41
  :view_lifecycle_environments => env.readable?,
41
42
  :edit_lifecycle_environments => env.editable?,
42
43
  :destroy_lifecycle_environments => env.deletable?,
@@ -1,3 +1,3 @@
1
1
  object @resource
2
2
 
3
- extends "katello/api/v2/host_collections/host_collection"
3
+ extends "katello/api/v2/host_collections/base"
@@ -1,3 +1,3 @@
1
1
  object @host_collection
2
2
 
3
- extends "katello/api/v2/host_collections/host_collection"
3
+ extends "katello/api/v2/host_collections/base"
@@ -1,3 +1,7 @@
1
1
  object false
2
2
 
3
- extends "katello/api/v2/common/index"
3
+ extends "katello/api/v2/common/metadata"
4
+
5
+ child @collection[:results] => :results do
6
+ extends "katello/api/v2/host_collections/base"
7
+ end
@@ -1,3 +1,4 @@
1
1
  object @host_collection
2
2
 
3
- extends "katello/api/v2/host_collections/host_collection"
3
+ extends "katello/api/v2/host_collections/base"
4
+ attributes :host_ids
@@ -1,3 +1,3 @@
1
1
  object @host_collection
2
2
 
3
- extends "katello/api/v2/host_collections/host_collection"
3
+ extends "katello/api/v2/host_collections/base"
@@ -27,6 +27,11 @@ node :systems do |subscription|
27
27
  service_level: sys.serviceLevel,
28
28
  autoheal: sys.autoheal,
29
29
  facts: {
30
+ dmi: {
31
+ memory: {
32
+ size: facts['dmi.memory.size']
33
+ }
34
+ },
30
35
  memory: {
31
36
  memtotal: facts['memory.memtotal']
32
37
  },
@@ -3,15 +3,14 @@
3
3
  option.kt-env { margin-left: 0em; }
4
4
  option.kt-cv { margin-left: 1em; }
5
5
  </style>
6
+ <% spinner_path = asset_path('spinner.gif') %>
6
7
 
7
- <% using_hostgroups_page = @host.nil? %>
8
-
9
- <% env_select_id = using_hostgroups_page ? :hostgroup_lifecycle_environment_id : :host_lifecycle_environment_id %>
10
- <% env_select_name = using_hostgroups_page ? 'hostgroup[lifecycle_environment_id]' : 'host[content_facet_attributes][lifecycle_environment_id]' %>
11
- <% env_select_attr = using_hostgroups_page ? 'lifecycle_environment' : 'content_facet.lifecycle_environment' %>
8
+ <% env_select_id = using_hostgroups_page? ? :hostgroup_lifecycle_environment_id : :host_lifecycle_environment_id %>
9
+ <% env_select_name = using_hostgroups_page? ? 'hostgroup[lifecycle_environment_id]' : 'host[content_facet_attributes][lifecycle_environment_id]' %>
10
+ <% env_select_attr = using_hostgroups_page? ? 'lifecycle_environment' : 'content_facet.lifecycle_environment' %>
12
11
 
13
12
  <%= field(f, env_select_attr, {:label => _("Lifecycle Environment")}) do
14
- if using_hostgroups_page
13
+ if using_hostgroups_page?
15
14
  select_tag env_select_id, lifecycle_environment_options(@hostgroup, :include_blank => blank_or_inherit_with_id(f, :lifecycle_environment)),
16
15
  :class => 'form-control', :name => env_select_name
17
16
  else
@@ -19,16 +18,15 @@
19
18
  end
20
19
  end %>
21
20
 
22
-
23
- <% cv_select_id = using_hostgroups_page ? :hostgroup_content_view_id : :host_content_view_id %>
24
- <% cv_select_name = using_hostgroups_page ? 'hostgroup[content_view_id]' : 'host[content_facet_attributes][content_view_id]' %>
25
- <% cv_select_attr = using_hostgroups_page ? 'content_view' : 'content_facet.content_view' %>
21
+ <% cv_select_id = using_hostgroups_page? ? :hostgroup_content_view_id : :host_content_view_id %>
22
+ <% cv_select_name = using_hostgroups_page? ? 'hostgroup[content_view_id]' : 'host[content_facet_attributes][content_view_id]' %>
23
+ <% cv_select_attr = using_hostgroups_page? ? 'content_view' : 'content_facet.content_view' %>
26
24
  <%= field(f, cv_select_attr, {:label => _("Content View")}) do
27
- if using_hostgroups_page
28
- select_tag cv_select_id, content_views_for_host(@hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_view)),
25
+ if using_hostgroups_page?
26
+ select_tag cv_select_id, content_views_for_host(@hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_view)), :data => {"spinner_path" => spinner_path},
29
27
  :class => 'form-control', :name => cv_select_name
30
28
  else
31
- select_tag cv_select_id, content_views_for_host(@host, :selected_host_group => @hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_view)), :class => 'form-control', :name => cv_select_name
29
+ select_tag cv_select_id, content_views_for_host(@host, :selected_host_group => @hostgroup, :include_blank => blank_or_inherit_with_id(f, :content_view)), :data => {"spinner_path" => spinner_path}, :class => 'form-control', :name => cv_select_name
32
30
  end
33
31
  end %>
34
32
 
@@ -36,7 +34,7 @@ end %>
36
34
  <input type="hidden" name="host[content_facet_attributes][id]" value="<%= @host.content_facet.try(:id) %>">
37
35
  <% end %>
38
36
 
39
- <% data_url = using_hostgroups_page ? environment_selected_hostgroups_path : hostgroup_or_environment_selected_hosts_path %>
37
+ <% data_url = using_hostgroups_page? ? environment_selected_hostgroups_path : hostgroup_or_environment_selected_hosts_path %>
40
38
  <%= select_f f, :environment_id, Environment.all, :id, :to_label, {:include_blank => blank_or_inherit_f(f, :environment)},
41
39
  {:label => _("Puppet Environment"), :onchange => 'update_puppetclasses(this);', 'data-url'=> data_url,
42
40
  'data-content_puppet_match' => (@host || @hostgroup).new_record? || (@host || @hostgroup).content_and_puppet_match?,
@@ -0,0 +1,26 @@
1
+ <% media_selection = using_hostgroups_page? ? use_install_media(@hostgroup) : use_install_media(@host, :selected_host_group => @hostgroup)
2
+ install_media_radio = media_selection ? 'checked="checked"':''
3
+ synced_content_radio = media_selection ? '' : 'checked="checked"'
4
+ install_media_disabled = os_media.empty? ? 'disabled = true' : ''
5
+
6
+ kickstart_options = using_hostgroups_page? ? kickstart_repository_options(@hostgroup) : kickstart_repository_options(@host, :selected_host_group => @hostgroup)
7
+ synced_content_disabled = kickstart_options.empty? ? 'disabled = true' : ''
8
+ %>
9
+
10
+ <div class="clear-fix" id="media_selection_section">
11
+ <div class="form-group ">
12
+ <label class="col-md-2 control-label" for="use_install_media">Media Selection</label>
13
+ <div class="col-md-4">
14
+ <label class="radio-inline">
15
+ <input data-media-selector="true" id="host_use_synced_content" name="media_selector" value="synced_content" type="radio" <%= synced_content_radio %> <%= synced_content_disabled %>/> <%= _('Synced Content') %>
16
+ </label>
17
+ <label class="radio-inline">
18
+ <input data-media-selector="true" id="host_use_install_media" name="media_selector" value="install_media" type="radio" <%= install_media_radio %> <%= install_media_disabled %>/> <%= _('All Media') %>
19
+ </label>
20
+ <span class="help-block">
21
+ <%= _("Select the installation media that will be used to provision this host. Choose 'Synced Content' for Synced Kickstart Repositories or 'All Media' for other media.") %>
22
+ </span>
23
+ </div>
24
+ <span class="help-block help-inline"></span>
25
+ </div>
26
+ </div>
@@ -0,0 +1,24 @@
1
+ <%
2
+ kickstart_repo_id = using_hostgroups_page? ? kickstart_repository_id(@hostgroup) : kickstart_repository_id(@host, :selected_host_group => @hostgroup)
3
+ host = using_hostgroups_page? ? @hostgroup : @host
4
+ kickstart_options = kickstart_repository_options(host, :selected_host_group => @hostgroup)
5
+ ks_repo_select_id = using_hostgroups_page? ? :host_group_kickstart_repository_id : :host_kickstart_repository_id
6
+ ks_repo_select_name = using_hostgroups_page? ? 'hostgroup[kickstart_repository_id]' : 'host[content_facet_attributes][kickstart_repository_id]'
7
+ ks_repo_select_attr = using_hostgroups_page? ? 'kickstart_repository' : 'content_facet.kickstart_repository'
8
+ %>
9
+
10
+ <% spinner_path = asset_path('spinner.gif') %>
11
+
12
+ <%= field(f, ks_repo_select_attr, {:label => _("Synced Content")}) do
13
+ if using_hostgroups_page?
14
+ select_tag ks_repo_select_id, view_to_options(kickstart_options, kickstart_repo_id, blank_or_inherit_with_id(f, :kickstart_repository)), :data => {"spinner_path" => spinner_path, "kickstart-repository-id" => kickstart_repo_id},
15
+ :class => 'form-control', :name => ks_repo_select_name, :disabled => kickstart_options.empty?
16
+ else
17
+ select_tag ks_repo_select_id, view_to_options(kickstart_options, kickstart_repo_id, blank_or_inherit_with_id(f, :kickstart_repository)), :data => {"spinner_path" => spinner_path, "kickstart-repository-id" => kickstart_repo_id}, :class => 'form-control', :name => ks_repo_select_name, :disabled => kickstart_options.empty?
18
+ end
19
+ end %>
20
+
21
+ <script>
22
+ KT.hosts.set_media_selection_bindings();
23
+ KT.hosts.update_media_enablement();
24
+ </script>
@@ -1,6 +1,6 @@
1
1
  module Katello
2
2
  class WhitelistConstraint
3
- PATHS = [%r{\A/api/v2/organizations/\S+/parameters}]
3
+ PATHS ||= [%r{\A/api/v2/organizations/\S+/parameters}]
4
4
 
5
5
  def matches?(request)
6
6
  PATHS.map { |path| request.env["REQUEST_PATH"].match(path) }.any? ? false : true
@@ -17,15 +17,11 @@ Foreman::Application.routes.draw do
17
17
 
18
18
  match "/api/v1/organizations/:id", via: :delete, to: proc { [404, {}, [override_message]] }
19
19
 
20
- resources :operatingsystems, :only => [] do
21
- get 'available_kickstart_repo', :on => :member
22
- end
23
-
24
20
  resources :hosts, :only => [] do
25
21
  get 'puppet_environment_for_content_view', :on => :collection
26
22
  end
27
23
 
28
- resources :smart_proxies do
24
+ resources :smart_proxies, :only => [] do
29
25
  member do
30
26
  get :pulp_storage
31
27
  get :pulp_status
@@ -292,6 +292,11 @@ class MigrateContentHosts < ActiveRecord::Migration
292
292
 
293
293
  User.current = User.anonymous_api_admin
294
294
 
295
+ ping = ::Katello::Ping.ping
296
+ if ping[:status] != ::Katello::Ping::OK_RETURN_CODE
297
+ fail _("Some backend services are not running: %s") % ping.inspect
298
+ end
299
+
295
300
  ensure_one_system_per_hostname(MigrateContentHosts::System.all)
296
301
 
297
302
  systems = get_systems_with_facts(MigrateContentHosts::System.all)
@@ -0,0 +1,9 @@
1
+ class AddKickstartRepositoryToHostsAndHostgroups < ActiveRecord::Migration
2
+ def change
3
+ add_column :katello_content_facets, :kickstart_repository_id, :integer, :null => true
4
+ add_foreign_key :katello_content_facets, :katello_repositories, :column => :kickstart_repository_id
5
+
6
+ add_column :hostgroups, :kickstart_repository_id, :integer, :null => true
7
+ add_foreign_key :hostgroups, :katello_repositories, :column => :kickstart_repository_id
8
+ end
9
+ end
@@ -0,0 +1,27 @@
1
+ class MoveHostDescriptionToHostComment < ActiveRecord::Migration
2
+ class Host < ActiveRecord::Base
3
+ self.table_name = "hosts"
4
+ end
5
+
6
+ def up
7
+ Host.find_each do |host|
8
+ new_comment = nil
9
+ if host.comment.blank?
10
+ new_comment = host.description
11
+ else
12
+ new_comment = [host.comment, host.description].join("\n") unless host.description.empty?
13
+ end
14
+ host.update_column(:comment, new_comment) if new_comment
15
+ end
16
+
17
+ remove_column :hosts, :description
18
+ end
19
+
20
+ def down
21
+ add_column :hosts, :description, :text
22
+
23
+ Host.find_each do |host|
24
+ host.update_columns(:comment => nil, :description => host.comment)
25
+ end
26
+ end
27
+ end
@@ -19,5 +19,6 @@ BASTION_MODULES.push(
19
19
  'Bastion.sync-plans',
20
20
  'Bastion.host-collections',
21
21
  'Bastion.content-hosts',
22
- 'Bastion.tasks'
22
+ 'Bastion.tasks',
23
+ 'Bastion.settings'
23
24
  );
@@ -73,5 +73,8 @@
73
73
  //= require "bastion_katello/activation-keys/activation-keys.module.js"
74
74
  //= require_tree "./activation-keys"
75
75
 
76
+ //= require "bastion_katello/settings/settings.module.js"
77
+ //= require_tree "./settings"
78
+
76
79
  //= require "bastion_katello/bastion-katello-bootstrap.js"
77
80
  //= require "bastion_katello/katello-features.run.js"
@@ -19,7 +19,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostBaseSubscriptions
19
19
  function success() {
20
20
  $scope.subscription.workingMode = false;
21
21
  $scope.$parent.successMessages = [translate('Successfully updated subscriptions.')];
22
- $scope.contentHost.$get();
22
+ $scope.host.$get();
23
23
  }
24
24
 
25
25
  function failure() {
@@ -33,7 +33,7 @@ angular.module('Bastion.content-hosts').controller('ContentHostBaseSubscriptions
33
33
 
34
34
  $scope.autoAttachSubscriptions = function () {
35
35
  $scope.subscription.workingMode = true;
36
- HostSubscription.autoAttach({id: $scope.contentHost.host.id}, success, failure);
36
+ HostSubscription.autoAttach({id: $scope.host.id}, success, failure);
37
37
  };
38
38
 
39
39
  }]
@@ -10,7 +10,7 @@
10
10
 
11
11
  <a class="fr btn btn-default"
12
12
  ui-sref="environments.new({priorId: library.id})"
13
- ng-hide="denied('create_lifecycle_environments')">
13
+ ng-hide="denied('create_lifecycle_environments', library)">
14
14
  <i class="fa fa-plus"></i>
15
15
  {{ "New Environment Path" | translate }}
16
16
  </a>
@@ -42,20 +42,19 @@
42
42
  <div class="col-sm-12 environment" ng-repeat="path in paths">
43
43
  <div class="row">
44
44
  <div class="col-sm-12">
45
- <a ui-sref="environments.new({priorId: lastEnvironment(path).id})" class="btn btn-default fr">
45
+ <a ng-hide="denied('create_lifecycle_environments', path['environments'][0])" ui-sref="environments.new({priorId: lastEnvironment(path).id})" class="btn btn-default fr">
46
46
  <i class="fa fa-plus inline-icon"></i>
47
47
  <span translate>Add New Environment</span>
48
48
  </a>
49
49
  </div>
50
50
  </div>
51
51
 
52
- <table class="table table-bordered environment-table">
52
+ <table class="table table-bordered environment-table" ng-hide="denied('view_lifecycle_environments', path.environments[0])">
53
53
  <thead>
54
54
  <tr>
55
55
  <th></th>
56
56
  <th ng-repeat="environment in path.environments">
57
- <a ui-sref="environments.environment.details({environmentId: environment.id})"
58
- ng-hide="denied('create_lifecycle_environments')">
57
+ <a ui-sref="environments.environment.details({environmentId: environment.id})">
59
58
  {{ environment.name }}
60
59
  </a>
61
60
  </th>
@@ -22,7 +22,7 @@ angular.module('Bastion.packages').controller('PackageDetailsRepositoriesControl
22
22
  'organization_id': CurrentOrganization
23
23
  };
24
24
 
25
- repositoriesNutupane = new Nutupane(Repository, params, 'repositories');
25
+ repositoriesNutupane = new Nutupane(Repository, params);
26
26
  $scope.detailsTable = repositoriesNutupane.table;
27
27
  $scope.detailsTable.initialLoad = false;
28
28
  repositoriesNutupane.masterOnly = true;