katello 3.0.1 → 3.0.2

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8e6baaee12047d7f51cd5aa22e459cea411aa0bb
4
- data.tar.gz: 0bbb1ba25154c5aa74c0ee4321b61a3d075c74e0
3
+ metadata.gz: 92f949b0b3a9201bd9163f2fca7c3898feafc2b2
4
+ data.tar.gz: 790bcd11ac29bad1d2053314424187189b71afce
5
5
  SHA512:
6
- metadata.gz: f422c50425a46b7289e2c639a0e594e9e618ee894630eb9c76bef90e0eb49e0ad0efa2a08c3b5929c98a9723c5a17336456918e53dad909de251fe187bce5749
7
- data.tar.gz: e790f13972a9c05578189375093f3854ed5158518869da5bc78fa70bfed6cb6ec7afc2efa96548b1dab84aaada62c5faa1aaa5c5fba1bcdb840ecec3a2eaa309
6
+ metadata.gz: cf154c344d10d11683890b9463293f69647f049cfa52dae6c92e33321473cc4b89b55bb3680c1d77a173d3038e6bf19f2258dd2abe6903bf701d12ade2bace6a
7
+ data.tar.gz: 04e68a24437d862d0a6fd5632c61669019795f6abb8305b5fe37229004250a91ba2599810d95793b9bceb28c927b60869aae772262ab754b7b4927f3dd8ac527
@@ -132,7 +132,7 @@ module Katello
132
132
  #param :id, String, :desc => N_("UUID of the consumer"), :required => true
133
133
  def upload_package_profile
134
134
  User.as_anonymous_admin do
135
- sync_task(::Actions::Katello::Host::UploadPackageProfile, @host, params[:_json])
135
+ async_task(::Actions::Katello::Host::UploadPackageProfile, @host, params[:_json])
136
136
  end
137
137
  render :json => Resources::Candlepin::Consumer.get(@host.subscription_facet.uuid)
138
138
  end
@@ -49,10 +49,12 @@ module Katello
49
49
  includes = options.fetch(:includes, [])
50
50
  group = options.fetch(:group, nil)
51
51
 
52
- total = query.count
52
+ total = scoped_search_total(query, group)
53
+
53
54
  query = resource.search_for(*search_options).where("#{resource.table_name}.id" => query)
54
55
 
55
- sub_total = scoped_search_sub_total(query, total, group)
56
+ query = query.select(group).group(group) if group
57
+ sub_total = total.zero? ? 0 : scoped_search_total(query, group)
56
58
 
57
59
  sort_attr = params[:sort_by] || default_sort_by
58
60
 
@@ -73,7 +75,6 @@ module Katello
73
75
  end
74
76
  page = params[:page] || 1
75
77
  per_page = params[:per_page] || ::Setting::General.entries_per_page
76
-
77
78
  query = (total.zero? || sub_total.zero?) ? [] : query
78
79
 
79
80
  scoped_search_results(query, sub_total, total, page, per_page)
@@ -83,14 +84,12 @@ module Katello
83
84
 
84
85
  protected
85
86
 
86
- def scoped_search_sub_total(query, total, group)
87
- if group.present?
88
- query = query.select(group).group(group)
89
- sub_total = total.zero? ? 0 : query.count.length
87
+ def scoped_search_total(query, group)
88
+ if group
89
+ query.select(group).group(group).length
90
90
  else
91
- sub_total = total.zero? ? 0 : query.count
91
+ query.count
92
92
  end
93
- sub_total
94
93
  end
95
94
 
96
95
  def scoped_search_results(query, sub_total, total, page, per_page, error = nil)
@@ -78,7 +78,7 @@ module Katello
78
78
  param_group :host_collection
79
79
  def update
80
80
  @host_collection.update_attributes!(host_collection_params_with_host_ids)
81
- respond
81
+ respond_for_show(:resource => @host_collection)
82
82
  end
83
83
 
84
84
  api :PUT, "/host_collections/:id/add_hosts", N_("Add host to the host collection")
@@ -154,7 +154,14 @@ module Katello
154
154
  end
155
155
 
156
156
  def host_collection_params
157
- attrs = [:name, :description, :max_hosts, :unlimited_hosts, { :host_ids => [] }]
157
+ attrs = [:name,
158
+ :description,
159
+ :max_hosts,
160
+ :unlimited_hosts,
161
+ # For deep_munge; Remove for Rails 5
162
+ :host_ids,
163
+ { :host_ids => [] }
164
+ ]
158
165
  params.fetch(:host_collection).permit(*attrs)
159
166
  end
160
167
 
@@ -27,6 +27,15 @@ module Katello
27
27
  }
28
28
  end
29
29
 
30
+ def interfaces
31
+ virtual_interface_regexp = /\A([^.]*?)\.(\d+)\z/
32
+ super.tap do |interfaces|
33
+ interfaces.each do |name, attributes|
34
+ attributes[:virtual] = true if name =~ virtual_interface_regexp
35
+ end
36
+ end
37
+ end
38
+
30
39
  # rubocop:disable Style/AccessorMethodName:
31
40
  def get_interfaces
32
41
  mac_keys = facts.keys.select { |f| f =~ /net\.interface\..*\.mac_address/ }
@@ -325,7 +325,7 @@ class MigrateContentHosts < ActiveRecord::Migration
325
325
  if hostname.nil?
326
326
  logger.warn("Content host #{system.uuid} does not have a hostname, removing.")
327
327
  unregister_system(system)
328
- break
328
+ next
329
329
  end
330
330
 
331
331
  MigrateContentHosts::Host.reset_column_information
@@ -0,0 +1,41 @@
1
+ class FixViewerRole < ActiveRecord::Migration
2
+ class Role < ActiveRecord::Base
3
+ has_many :filters
4
+ end
5
+
6
+ class Filter < ActiveRecord::Base
7
+ belongs_to :role
8
+ has_many :filterings, :dependent => :destroy
9
+ has_many :permissions, :through => :filterings
10
+
11
+ scope :unlimited, -> { where(:search => nil, :taxonomy_search => nil) }
12
+
13
+ def resource_type
14
+ type = @resource_type || permissions.first.try(:resource_type)
15
+ type.blank? ? nil : type
16
+ end
17
+ end
18
+
19
+ class Filtering < ActiveRecord::Base
20
+ belongs_to :filter
21
+ belongs_to :permission
22
+ end
23
+
24
+ class Permission < ActiveRecord::Base
25
+ end
26
+
27
+ def change
28
+ viewer = Role.find_by name: 'Viewer'
29
+ view_permission = Permission.find_by name: 'view_content_views'
30
+
31
+ unless viewer.nil?
32
+ filters = viewer.filters.unlimited.select { |filter| filter.resource_type == 'Katello::ContentView' }
33
+ unless filters.empty?
34
+ filters.each do |filter|
35
+ unwanted_filterings = filter.filterings.select { |filtering| filtering.permission_id != view_permission.id }
36
+ filter.filterings.delete(unwanted_filterings)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -10,16 +10,27 @@
10
10
  * Provides functionality to the puppet modules name list.
11
11
  */
12
12
  angular.module('Bastion.content-views').controller('ContentViewPuppetModuleNamesController',
13
- ['$scope', 'Nutupane', 'ContentView', function ($scope, Nutupane, ContentView) {
13
+ ['$scope', 'Nutupane', 'ContentView', 'CurrentOrganization', 'PuppetModule',
14
+ function ($scope, Nutupane, ContentView, CurrentOrganization, PuppetModule) {
14
15
 
15
16
  var nutupane = new Nutupane(
16
17
  ContentView,
17
18
  {id: $scope.$stateParams.contentViewId},
18
19
  'availablePuppetModuleNames'
19
20
  );
20
-
21
+ nutupane.masterOnly = true;
21
22
  $scope.detailsTable = nutupane.table;
22
23
 
24
+ $scope.detailsTable.fetchAutocomplete = function (term) {
25
+ var promise;
26
+
27
+ promise = PuppetModule.autocomplete({'organization_id': CurrentOrganization, search: term}).$promise;
28
+
29
+ return promise.then(function (data) {
30
+ return data;
31
+ });
32
+ };
33
+
23
34
  $scope.selectVersion = function (moduleName) {
24
35
  $scope.transitionTo('content-views.details.puppet-modules.versions',
25
36
  {
@@ -22,14 +22,24 @@
22
22
  <span data-block="header" translate>Select A New Puppet Module To Add</span>
23
23
  <span data-block="messages"></span>
24
24
  <div data-block="search">
25
+ <div class="input-group input-group">
25
26
  <input type="text"
26
27
  class="form-control"
27
- placeholder="{{ 'Filter' | translate }}"
28
- ng-model="filterTerm"/>
28
+ placeholder="{{ 'Search...' | translate }}"
29
+ ng-model="detailsTable.searchTerm"
30
+ bst-on-enter="detailsTable.search(detailsTable.searchTerm)"
31
+ ng-trim="false"
32
+ typeahead="item.label for item in detailsTable.fetchAutocomplete($viewValue)"
33
+ typeahead-empty
34
+ typeahead-template-url="components/views/autocomplete-scoped-search.html"/>
35
+ <span class="input-group-btn">
36
+ <button ng-click="detailsTable.search(detailsTable.searchTerm)" class="btn btn-default" type="button"><i class="fa fa-search"></i></button>
37
+ </span>
38
+ </div>
29
39
  </div>
30
40
 
31
41
  <span data-block="selection-summary"></span>
32
-
42
+ <span data-block="no-rows-message" translate>No puppet modules found</span>
33
43
  <div data-block="table">
34
44
  <table class="table table-striped table-bordered">
35
45
  <thead>
@@ -87,7 +87,14 @@ module Katello
87
87
  require 'katello/apipie/validators'
88
88
  end
89
89
 
90
- initializer "katello.register_actions", :before => 'foreman_tasks.initialize_dynflow' do |_app|
90
+ # make sure the Katello plugin is initialized before `after_initialize`
91
+ # hook so that the resumed Dynflow tasks can rely on everything ready.
92
+ initializer 'katello.register_plugin', :before => :finisher_hook do
93
+ require 'katello/plugin'
94
+ require 'katello/permissions'
95
+ end
96
+
97
+ initializer "katello.register_actions", :before => :finisher_hook do |_app|
91
98
  ForemanTasks.dynflow.require!
92
99
  action_paths = %W(#{Katello::Engine.root}/app/lib/actions
93
100
  #{Katello::Engine.root}/app/lib/headpin/actions
@@ -95,7 +102,7 @@ module Katello
95
102
  ForemanTasks.dynflow.config.eager_load_paths.concat(action_paths)
96
103
  end
97
104
 
98
- initializer "katello.set_dynflow_middlewares", :before => 'foreman_tasks.initialize_dynflow' do |_app|
105
+ initializer "katello.set_dynflow_middlewares", :before => :finisher_hook do |_app|
99
106
  # We don't enable this in test env, as it adds the new field into the actions input
100
107
  # that we are not interested in tests
101
108
  unless Rails.env.test?
@@ -105,7 +112,7 @@ module Katello
105
112
  end
106
113
  end
107
114
 
108
- initializer "katello.initialize_cp_listener", after: "foreman_tasks.initialize_dynflow" do
115
+ initializer "katello.initialize_cp_listener", :before => :finisher_hook do
109
116
  unless ForemanTasks.dynflow.config.remote? || File.basename($PROGRAM_NAME) == 'rake' || Rails.env.test?
110
117
  ForemanTasks.dynflow.config.on_init do |world|
111
118
  ::Actions::Candlepin::ListenOnCandlepinEvents.ensure_running(world)
@@ -234,11 +241,6 @@ module Katello
234
241
  load 'katello/repository_types.rb'
235
242
  end
236
243
 
237
- config.after_initialize do
238
- require 'katello/plugin'
239
- require 'katello/permissions'
240
- end
241
-
242
244
  rake_tasks do
243
245
  load "#{Katello::Engine.root}/lib/katello/tasks/test.rake"
244
246
  load "#{Katello::Engine.root}/lib/katello/tasks/jenkins.rake"
@@ -1,3 +1,3 @@
1
1
  module Katello
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katello
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - N/A
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-17 00:00:00.000000000 Z
11
+ date: 2016-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.7.1
89
+ version: 0.7.18
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.7.1
96
+ version: 0.7.18
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: foreman_docker
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -1337,6 +1337,7 @@ files:
1337
1337
  - db/migrate/20160413230128_add_kickstart_repository_to_hosts_and_hostgroups.rb
1338
1338
  - db/migrate/20160426145517_move_host_description_to_host_comment.rb
1339
1339
  - db/migrate/20160530184400_add_repo_id_indexes.rb
1340
+ - db/migrate/20160619223332_fix_viewer_role.rb
1340
1341
  - db/seeds.d/101-locations.rb
1341
1342
  - db/seeds.d/102-organizations.rb
1342
1343
  - db/seeds.d/103-provisioning_templates.rb