foreman_salt 8.0.4 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/controllers/foreman_salt/api/v2/salt_keys_controller.rb +1 -1
- data/app/controllers/foreman_salt/api/v2/salt_minions_controller.rb +1 -1
- data/app/controllers/foreman_salt/api/v2/salt_states_controller.rb +1 -1
- data/app/controllers/foreman_salt/minions_controller.rb +3 -3
- data/app/controllers/foreman_salt/salt_autosign_controller.rb +1 -1
- data/app/controllers/foreman_salt/salt_keys_controller.rb +1 -1
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +4 -4
- data/app/models/foreman_salt/concerns/hostgroup_extensions.rb +4 -4
- data/app/models/foreman_salt/host_salt_module.rb +1 -1
- data/app/models/foreman_salt/hostgroup_salt_module.rb +1 -1
- data/app/models/foreman_salt/salt_environment.rb +4 -4
- data/app/models/foreman_salt/salt_module.rb +7 -7
- data/app/models/foreman_salt/salt_module_environment.rb +1 -1
- data/app/services/foreman_salt/smart_proxies/salt_keys.rb +2 -0
- data/lib/foreman_salt/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: dcb0cd457b3e5c9000833aaa9df08803939fa100
|
4
|
+
data.tar.gz: e3d96bb062af2c2b6b2c67755812227e6c318567
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc4191bdf884bce9b3bb4c19a89ae8b479219fda7b680ce0e3fa2443f3b59f1ae13f1ec3e96ce977bb44e9b6c2b9f621862c239a60d4d25c3d8e6ebac09a7dd
|
7
|
+
data.tar.gz: 7326754f45cd2725fdf075d1c4477bbc5bdc8c629b85a145e5e83bf1805ed0acfe990bc33a07b50b9772b41600a59f2613448c07608f3d481bab023922221cb0
|
@@ -21,7 +21,7 @@ module ForemanSalt
|
|
21
21
|
param :smart_proxy_id, :identifier_dottable, :required => true
|
22
22
|
param :state, String, :required => true, :desc => N_('State can be "accepted" or "rejected"')
|
23
23
|
def update
|
24
|
-
case params[:
|
24
|
+
case params[:key][:state]
|
25
25
|
when 'accepted'
|
26
26
|
@key.accept
|
27
27
|
when 'rejected'
|
@@ -29,7 +29,7 @@ module ForemanSalt
|
|
29
29
|
param_group :minion
|
30
30
|
def update
|
31
31
|
params[:minion][:salt_module_ids] = params[:minion].delete(:salt_state_ids) if params[:minion]
|
32
|
-
process_response @salt_minion.update_attributes(params
|
32
|
+
process_response @salt_minion.update_attributes(params[:minion])
|
33
33
|
end
|
34
34
|
|
35
35
|
def controller_permission
|
@@ -16,12 +16,12 @@ module ForemanSalt
|
|
16
16
|
|
17
17
|
enc['environment'] = env
|
18
18
|
respond_to do |format|
|
19
|
-
format.html { render :
|
20
|
-
format.yml { render :
|
19
|
+
format.html { render :text => "<pre>#{ERB::Util.html_escape(enc.to_yaml)}</pre>" }
|
20
|
+
format.yml { render :text => enc.to_yaml }
|
21
21
|
end
|
22
22
|
rescue
|
23
23
|
logger.warn "Failed to generate external nodes for #{@minion} with #{$ERROR_INFO}"
|
24
|
-
render(:
|
24
|
+
render(:text => _('Unable to generate output, Check log files\n'), :status => 412) && return
|
25
25
|
end
|
26
26
|
|
27
27
|
def run
|
@@ -3,7 +3,7 @@ module ForemanSalt
|
|
3
3
|
def index
|
4
4
|
setup
|
5
5
|
autosign = @api.autosign_list
|
6
|
-
@autosign = autosign.paginate :page => params[:page], :per_page => Setting
|
6
|
+
@autosign = autosign.paginate :page => params[:page], :per_page => Setting[:entries_per_page]
|
7
7
|
end
|
8
8
|
|
9
9
|
def new
|
@@ -9,7 +9,7 @@ module ForemanSalt
|
|
9
9
|
else
|
10
10
|
SmartProxies::SaltKeys.find_by_state @proxy, params[:state].downcase
|
11
11
|
end
|
12
|
-
@keys = keys.sort.paginate :page => params[:page], :per_page => Setting
|
12
|
+
@keys = keys.sort.paginate :page => params[:page], :per_page => Setting[:entries_per_page]
|
13
13
|
end
|
14
14
|
|
15
15
|
def accept
|
@@ -4,8 +4,8 @@ module ForemanSalt
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
has_many :host_salt_modules, :foreign_key => :host_id, :class_name => '::ForemanSalt::HostSaltModule'
|
8
7
|
has_many :salt_modules, :through => :host_salt_modules, :class_name => '::ForemanSalt::SaltModule'
|
8
|
+
has_many :host_salt_modules, :foreign_key => :host_id, :class_name => '::ForemanSalt::HostSaltModule'
|
9
9
|
|
10
10
|
belongs_to :salt_proxy, :class_name => 'SmartProxy'
|
11
11
|
belongs_to :salt_environment, :class_name => 'ForemanSalt::SaltEnvironment'
|
@@ -15,9 +15,9 @@ module ForemanSalt
|
|
15
15
|
alias_method_chain :inherited_attributes, :salt
|
16
16
|
alias_method_chain :configuration?, :salt
|
17
17
|
|
18
|
-
scoped_search :
|
19
|
-
scoped_search :
|
20
|
-
scoped_search :
|
18
|
+
scoped_search :relation => :salt_modules, :on => :name, :complete_value => true, :rename => :salt_state
|
19
|
+
scoped_search :relation => :salt_environment, :on => :name, :complete_value => true, :rename => :salt_environment
|
20
|
+
scoped_search :relation => :salt_proxy, :on => :name, :complete_value => true, :rename => :saltmaster
|
21
21
|
|
22
22
|
validate :salt_modules_in_host_environment
|
23
23
|
|
@@ -4,15 +4,15 @@ module ForemanSalt
|
|
4
4
|
extend ActiveSupport::Concern
|
5
5
|
|
6
6
|
included do
|
7
|
-
has_many :hostgroup_salt_modules, :class_name => '::ForemanSalt::HostgroupSaltModule'
|
8
7
|
has_many :salt_modules, :through => :hostgroup_salt_modules, :class_name => '::ForemanSalt::SaltModule'
|
8
|
+
has_many :hostgroup_salt_modules, :class_name => '::ForemanSalt::HostgroupSaltModule'
|
9
9
|
|
10
10
|
belongs_to :salt_proxy, :class_name => 'SmartProxy'
|
11
11
|
belongs_to :salt_environment, :class_name => 'ForemanSalt::SaltEnvironment'
|
12
12
|
|
13
|
-
scoped_search :
|
14
|
-
scoped_search :
|
15
|
-
scoped_search :
|
13
|
+
scoped_search :relation => :salt_modules, :on => :name, :complete_value => true, :rename => :salt_state
|
14
|
+
scoped_search :relation => :salt_environment, :on => :name, :complete_value => true, :rename => :salt_environment
|
15
|
+
scoped_search :relation => :salt_proxy, :on => :name, :complete_value => true, :rename => :saltmaster
|
16
16
|
end
|
17
17
|
|
18
18
|
def all_salt_modules
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module ForemanSalt
|
2
|
-
class SaltEnvironment <
|
2
|
+
class SaltEnvironment < ApplicationRecord
|
3
3
|
include Authorizable
|
4
4
|
extend FriendlyId
|
5
5
|
friendly_id :name
|
@@ -7,14 +7,14 @@ module ForemanSalt
|
|
7
7
|
has_many :hosts, :class_name => '::Host::Managed'
|
8
8
|
has_many :hostgroups, :class_name => '::Hostgroup'
|
9
9
|
|
10
|
-
has_many :salt_module_environments
|
11
10
|
has_many :salt_modules, :through => :salt_module_environments, :before_remove => :remove_from_hosts
|
11
|
+
has_many :salt_module_environments
|
12
12
|
|
13
13
|
validates :name, :uniqueness => true, :presence => true, :format => { :with => /\A[\w\d\.]+\z/, :message => N_('is alphanumeric and cannot contain spaces') }
|
14
14
|
|
15
15
|
scoped_search :on => :name, :complete_value => true
|
16
|
-
scoped_search :
|
17
|
-
scoped_search :
|
16
|
+
scoped_search :relation => :hostgroups, :on => :name, :complete_value => true, :rename => :hostgroup
|
17
|
+
scoped_search :relation => :hosts, :on => :name, :complete_value => true, :rename => :host
|
18
18
|
|
19
19
|
def self.humanize_class_name(_name = nil)
|
20
20
|
_('Salt environment')
|
@@ -1,17 +1,17 @@
|
|
1
1
|
module ForemanSalt
|
2
|
-
class SaltModule <
|
2
|
+
class SaltModule < ApplicationRecord
|
3
3
|
include Authorizable
|
4
4
|
extend FriendlyId
|
5
5
|
friendly_id :name
|
6
6
|
|
7
|
-
has_many :host_salt_modules, :foreign_key => :salt_module_id
|
8
7
|
has_many :hosts, :through => :host_salt_modules, :class_name => '::Host::Managed'
|
8
|
+
has_many :host_salt_modules, :foreign_key => :salt_module_id
|
9
9
|
|
10
|
-
has_many :hostgroup_salt_modules, :foreign_key => :salt_module_id
|
11
10
|
has_many :hostgroups, :through => :hostgroup_salt_modules
|
11
|
+
has_many :hostgroup_salt_modules, :foreign_key => :salt_module_id
|
12
12
|
|
13
|
-
has_many :salt_module_environments
|
14
13
|
has_many :salt_environments, :through => :salt_module_environments
|
14
|
+
has_many :salt_module_environments
|
15
15
|
|
16
16
|
validates :name, :uniqueness => true, :presence => true, :format => { :with => /\A(?:[\w\d\-]+\.{0,1})+[^\.]\z/, :message => N_('must be alphanumeric, can contain periods, dashes, underscores and must not contain spaces') }
|
17
17
|
|
@@ -22,9 +22,9 @@ module ForemanSalt
|
|
22
22
|
scope :in_environment, ->(environment) { joins(:salt_environments).where('salt_module_environments.salt_environment_id' => environment) }
|
23
23
|
|
24
24
|
scoped_search :on => :name, :complete_value => true
|
25
|
-
scoped_search :
|
26
|
-
scoped_search :
|
27
|
-
scoped_search :
|
25
|
+
scoped_search :relation => :salt_environments, :on => :name, :complete_value => true, :rename => :environment
|
26
|
+
scoped_search :relation => :hostgroups, :on => :name, :complete_value => true, :rename => :hostgroup
|
27
|
+
scoped_search :relation => :hosts, :on => :name, :complete_value => true, :rename => :host
|
28
28
|
|
29
29
|
def self.to_hash
|
30
30
|
states = {}
|
@@ -31,12 +31,14 @@ module ForemanSalt
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def accept
|
34
|
+
fail ::Foreman::Exception.new(N_('unable to re-accept an accepted key')) unless state == 'unaccepted'
|
34
35
|
proxy = SmartProxy.find(smart_proxy_id)
|
35
36
|
Rails.cache.delete("saltkeys_#{proxy.id}") if Rails.env.production?
|
36
37
|
ProxyAPI::Salt.new(:url => proxy.url).key_accept name
|
37
38
|
end
|
38
39
|
|
39
40
|
def reject
|
41
|
+
fail ::Foreman::Exception.new(N_('unable to reject an accepted key')) unless state == 'unaccepted'
|
40
42
|
proxy = SmartProxy.find(smart_proxy_id)
|
41
43
|
Rails.cache.delete("saltkeys_#{proxy.id}") if Rails.env.production?
|
42
44
|
ProxyAPI::Salt.new(:url => proxy.url).key_reject name
|
data/lib/foreman_salt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_salt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Benjamin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -183,14 +183,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: '0'
|
184
184
|
requirements: []
|
185
185
|
rubyforge_project:
|
186
|
-
rubygems_version: 2.
|
186
|
+
rubygems_version: 2.5.2.1
|
187
187
|
signing_key:
|
188
188
|
specification_version: 4
|
189
189
|
summary: Foreman Plug-in for Salt
|
190
190
|
test_files:
|
191
191
|
- test/factories/foreman_salt_factories.rb
|
192
|
-
- test/functional/api/v2/salt_autosign_controller_test.rb
|
193
192
|
- test/functional/api/v2/salt_environments_controller_test.rb
|
193
|
+
- test/functional/api/v2/salt_autosign_controller_test.rb
|
194
194
|
- test/functional/api/v2/salt_keys_controller_test.rb
|
195
195
|
- test/functional/api/v2/salt_states_controller_test.rb
|
196
196
|
- test/functional/minions_controller_test.rb
|