foreman_salt 6.0.1 → 7.0.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/foreman_salt/api/v2/salt_environments_controller.rb +3 -1
- data/app/controllers/foreman_salt/api/v2/salt_states_controller.rb +2 -1
- data/app/controllers/foreman_salt/concerns/salt_environment_parameters.rb +20 -0
- data/app/controllers/foreman_salt/concerns/salt_module_parameters.rb +20 -0
- data/app/controllers/foreman_salt/minions_controller.rb +1 -0
- data/app/controllers/foreman_salt/salt_environments_controller.rb +3 -3
- data/app/controllers/foreman_salt/salt_modules_controller.rb +3 -2
- data/app/models/foreman_salt/concerns/host_managed_extensions.rb +0 -3
- data/app/models/foreman_salt/concerns/hostgroup_extensions.rb +0 -3
- data/app/models/foreman_salt/fact_name.rb +0 -1
- data/app/models/foreman_salt/salt_environment.rb +0 -2
- data/app/models/foreman_salt/salt_module.rb +0 -4
- data/lib/foreman_salt/engine.rb +1 -1
- data/lib/foreman_salt/plugin.rb +9 -1
- data/lib/foreman_salt/version.rb +1 -1
- metadata +20 -19
- data/db/migrate/20161103104146_add_index_to_join_tables.rb +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6086715f9091869bb9b9e4bf8ce55b07737200f
|
4
|
+
data.tar.gz: d1404318a8da0127688638755d3247a1a0b23964
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f1f0df003e6cb6566e9836ed3161b6c27ef55069b99eb50721c068fa63f6a7e3b45d8617be3ad424454aeeac05485157ae11227c31cf86e18cdf49e6fe21cba
|
7
|
+
data.tar.gz: fe7dc9289fc0f93d234b24e050b60adba1fb215051b9ffee8e7be6cd8ba15949d185991ebd07ac99fb4be4324505f7b77ec11d9a11878e926e2bb64470c9a78b
|
@@ -2,6 +2,8 @@ module ForemanSalt
|
|
2
2
|
module Api
|
3
3
|
module V2
|
4
4
|
class SaltEnvironmentsController < ::ForemanSalt::Api::V2::BaseController
|
5
|
+
include ::ForemanSalt::Concerns::SaltEnvironmentParameters
|
6
|
+
|
5
7
|
before_action :find_resource, :except => [:index, :create]
|
6
8
|
|
7
9
|
api :GET, '/salt_environments', N_('List all Salt environments')
|
@@ -24,7 +26,7 @@ module ForemanSalt
|
|
24
26
|
api :POST, '/salt_environments', N_('Create a Salt environment')
|
25
27
|
param_group :environment, :as => :create
|
26
28
|
def create
|
27
|
-
@salt_environment = SaltEnvironment.new(
|
29
|
+
@salt_environment = SaltEnvironment.new(salt_environment_params)
|
28
30
|
process_response @salt_environment.save
|
29
31
|
end
|
30
32
|
|
@@ -2,6 +2,7 @@ module ForemanSalt
|
|
2
2
|
module Api
|
3
3
|
module V2
|
4
4
|
class SaltStatesController < ::ForemanSalt::Api::V2::BaseController
|
5
|
+
include ::ForemanSalt::Concerns::SaltModuleParameters
|
5
6
|
include StateImporter
|
6
7
|
|
7
8
|
before_action :find_resource, :except => [:index, :create, :import]
|
@@ -35,7 +36,7 @@ module ForemanSalt
|
|
35
36
|
api :POST, '/salt_states', N_('Create a state')
|
36
37
|
param_group :state, :as => :create
|
37
38
|
def create
|
38
|
-
@salt_state = SaltModule.new(
|
39
|
+
@salt_state = SaltModule.new(salt_module_params)
|
39
40
|
process_response @salt_state.save
|
40
41
|
end
|
41
42
|
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ForemanSalt
|
2
|
+
module Concerns
|
3
|
+
module SaltEnvironmentParameters
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
class_methods do
|
7
|
+
def salt_environment_params_filter
|
8
|
+
Foreman::ParameterFilter.new(::ForemanSalt::SaltEnvironment).tap do |filter|
|
9
|
+
filter.permit(:name, :salt_modules => [], :salt_module_ids => [])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def salt_environment_params
|
15
|
+
param_name = parameter_filter_context.api? ? 'environment' : 'foreman_salt_salt_environment'
|
16
|
+
self.class.salt_environment_params_filter.filter_params(params, parameter_filter_context, param_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ForemanSalt
|
2
|
+
module Concerns
|
3
|
+
module SaltModuleParameters
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
class_methods do
|
7
|
+
def salt_module_params_filter
|
8
|
+
Foreman::ParameterFilter.new(::ForemanSalt::SaltEnvironment).tap do |filter|
|
9
|
+
filter.permit(:name, :salt_environments => [], :salt_environment_ids => [])
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def salt_module_params
|
15
|
+
param_name = parameter_filter_context.api? ? 'state' : 'foreman_salt_salt_module'
|
16
|
+
self.class.salt_module_params_filter.filter_params(params, parameter_filter_context, param_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ForemanSalt
|
2
2
|
class MinionsController < ::ForemanSalt::ApplicationController
|
3
3
|
include ::Foreman::Controller::SmartProxyAuth
|
4
|
+
include ::Foreman::Controller::Parameters::Host
|
4
5
|
|
5
6
|
before_action :find_resource, :only => [:node, :run]
|
6
7
|
add_smart_proxy_filters :node, :features => 'Salt'
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ForemanSalt
|
2
2
|
class SaltEnvironmentsController < ::ForemanSalt::ApplicationController
|
3
3
|
include Foreman::Controller::AutoCompleteSearch
|
4
|
+
include ::ForemanSalt::Concerns::SaltEnvironmentParameters
|
4
5
|
|
5
6
|
before_action :find_resource, :only => [:edit, :update, :destroy]
|
6
7
|
|
@@ -13,8 +14,7 @@ module ForemanSalt
|
|
13
14
|
end
|
14
15
|
|
15
16
|
def create
|
16
|
-
|
17
|
-
@salt_environment = SaltEnvironment.new(params[:foreman_salt_salt_environment])
|
17
|
+
@salt_environment = SaltEnvironment.new(salt_environment_params)
|
18
18
|
if @salt_environment.save
|
19
19
|
process_success
|
20
20
|
else
|
@@ -26,7 +26,7 @@ module ForemanSalt
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def update
|
29
|
-
if @salt_environment.update_attributes(
|
29
|
+
if @salt_environment.update_attributes(salt_environment_params)
|
30
30
|
notice _('Successfully updated %s.' % @salt_environment.to_s)
|
31
31
|
redirect_to salt_environments_path
|
32
32
|
else
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module ForemanSalt
|
2
2
|
class SaltModulesController < ::ForemanSalt::ApplicationController
|
3
3
|
include Foreman::Controller::AutoCompleteSearch
|
4
|
+
include ::ForemanSalt::Concerns::SaltModuleParameters
|
4
5
|
include StateImporter
|
5
6
|
|
6
7
|
before_action :find_resource, :only => [:edit, :update, :destroy]
|
@@ -16,7 +17,7 @@ module ForemanSalt
|
|
16
17
|
|
17
18
|
def create
|
18
19
|
logger.info("Params: #{params.inspect}")
|
19
|
-
@salt_module = SaltModule.new(
|
20
|
+
@salt_module = SaltModule.new(salt_module_params)
|
20
21
|
if @salt_module.save
|
21
22
|
process_success
|
22
23
|
else
|
@@ -29,7 +30,7 @@ module ForemanSalt
|
|
29
30
|
end
|
30
31
|
|
31
32
|
def update
|
32
|
-
if @salt_module.update_attributes(
|
33
|
+
if @salt_module.update_attributes(salt_module_params)
|
33
34
|
notice _('Successfully updated %s.' % @salt_module.to_s)
|
34
35
|
redirect_to salt_modules_path
|
35
36
|
else
|
@@ -24,9 +24,6 @@ module ForemanSalt
|
|
24
24
|
after_build :delete_salt_key, :if => ->(host) { host.salt_proxy }
|
25
25
|
before_provision :accept_salt_key, :if => ->(host) { host.salt_proxy }
|
26
26
|
before_destroy :delete_salt_key, :if => ->(host) { host.salt_proxy }
|
27
|
-
|
28
|
-
attr_accessible :salt_proxy_id, :salt_proxy_name, :salt_environment_id,
|
29
|
-
:salt_environment_name, :salt_modules, :salt_module_ids
|
30
27
|
end
|
31
28
|
|
32
29
|
def configuration_with_salt?
|
@@ -13,9 +13,6 @@ module ForemanSalt
|
|
13
13
|
scoped_search :in => :salt_modules, :on => :name, :complete_value => true, :rename => :salt_state
|
14
14
|
scoped_search :in => :salt_environment, :on => :name, :complete_value => true, :rename => :salt_environment
|
15
15
|
scoped_search :in => :salt_proxy, :on => :name, :complete_value => true, :rename => :saltmaster
|
16
|
-
|
17
|
-
attr_accessible :salt_proxy_id, :salt_proxy_name, :salt_environment_id,
|
18
|
-
:salt_environment_name, :salt_modules, :salt_module_ids
|
19
16
|
end
|
20
17
|
|
21
18
|
def all_salt_modules
|
@@ -4,10 +4,6 @@ module ForemanSalt
|
|
4
4
|
extend FriendlyId
|
5
5
|
friendly_id :name
|
6
6
|
|
7
|
-
attr_accessible :name, :salt_environments, :salt_environment_ids
|
8
|
-
|
9
|
-
# before_destroy EnsureNotUsedBy.new(:hosts, :hostgroups)
|
10
|
-
|
11
7
|
has_many :hosts, :through => :host_salt_modules, :class_name => '::Host::Managed'
|
12
8
|
has_many :host_salt_modules, :foreign_key => :salt_module_id
|
13
9
|
|
data/lib/foreman_salt/engine.rb
CHANGED
@@ -4,7 +4,7 @@ module ForemanSalt
|
|
4
4
|
class Engine < ::Rails::Engine
|
5
5
|
engine_name 'foreman_salt'
|
6
6
|
|
7
|
-
config.autoload_paths += Dir["#{config.root}/app/controllers/concerns"]
|
7
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/foreman_salt/concerns"]
|
8
8
|
config.autoload_paths += Dir["#{config.root}/app/helpers/concerns"]
|
9
9
|
config.autoload_paths += Dir["#{config.root}/app/models/concerns"]
|
10
10
|
config.autoload_paths += Dir["#{config.root}/app/overrides"]
|
data/lib/foreman_salt/plugin.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Foreman::Plugin.register :foreman_salt do
|
2
|
-
requires_foreman '>= 1.
|
2
|
+
requires_foreman '>= 1.13'
|
3
3
|
|
4
4
|
apipie_documented_controllers ["#{ForemanSalt::Engine.root}/app/controllers/foreman_salt/api/v2/*.rb"]
|
5
5
|
|
@@ -131,4 +131,12 @@ Foreman::Plugin.register :foreman_salt do
|
|
131
131
|
:create_salt_environments, :view_salt_environments,
|
132
132
|
:edit_salt_environments,
|
133
133
|
:destroy_salt_environments]
|
134
|
+
|
135
|
+
|
136
|
+
# Parameter filters
|
137
|
+
parameter_filter Hostgroup, :salt_proxy_id, :salt_proxy_name, :salt_environment_id,
|
138
|
+
:salt_environment_name, :salt_modules => [], :salt_module_ids => []
|
139
|
+
parameter_filter Host::Managed, :salt_proxy_id, :salt_proxy_name,
|
140
|
+
:salt_environment_id, :salt_environment_name, :salt_modules => [],
|
141
|
+
:salt_module_ids => []
|
134
142
|
end
|
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: 7.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: 2016-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.8.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.8.0
|
41
41
|
description: Foreman Plug-in for Salt
|
42
42
|
email:
|
43
43
|
- stephen@redhat.com
|
@@ -59,6 +59,8 @@ files:
|
|
59
59
|
- app/controllers/foreman_salt/application_controller.rb
|
60
60
|
- app/controllers/foreman_salt/concerns/hostgroups_controller_extensions.rb
|
61
61
|
- app/controllers/foreman_salt/concerns/hosts_controller_extensions.rb
|
62
|
+
- app/controllers/foreman_salt/concerns/salt_environment_parameters.rb
|
63
|
+
- app/controllers/foreman_salt/concerns/salt_module_parameters.rb
|
62
64
|
- app/controllers/foreman_salt/minions_controller.rb
|
63
65
|
- app/controllers/foreman_salt/salt_autosign_controller.rb
|
64
66
|
- app/controllers/foreman_salt/salt_environments_controller.rb
|
@@ -134,7 +136,6 @@ files:
|
|
134
136
|
- db/migrate/20150411003302_add_environments_to_modules.rb
|
135
137
|
- db/migrate/20150509094409_rename_join_tables.rb
|
136
138
|
- db/migrate/20150509101505_add_primary_keys.rb
|
137
|
-
- db/migrate/20161103104146_add_index_to_join_tables.rb
|
138
139
|
- db/seeds.d/75-salt_seeds.rb
|
139
140
|
- lib/foreman_salt.rb
|
140
141
|
- lib/foreman_salt/engine.rb
|
@@ -186,22 +187,22 @@ signing_key:
|
|
186
187
|
specification_version: 4
|
187
188
|
summary: Foreman Plug-in for Salt
|
188
189
|
test_files:
|
189
|
-
- test/
|
190
|
-
- test/functional/api/v2/salt_autosign_controller_test.rb
|
191
|
-
- test/functional/api/v2/salt_environments_controller_test.rb
|
192
|
-
- test/functional/api/v2/salt_keys_controller_test.rb
|
193
|
-
- test/functional/api/v2/salt_states_controller_test.rb
|
194
|
-
- test/functional/minions_controller_test.rb
|
195
|
-
- test/integration/salt_autosign_test.rb
|
190
|
+
- test/integration/salt_module_test.rb
|
196
191
|
- test/integration/salt_environment_test.rb
|
192
|
+
- test/integration/salt_autosign_test.rb
|
197
193
|
- test/integration/salt_keys_test.rb
|
198
|
-
- test/
|
194
|
+
- test/test_plugin_helper.rb
|
195
|
+
- test/unit/grains_importer_test.rb
|
199
196
|
- test/unit/grains_centos.json
|
197
|
+
- test/unit/host_extensions_test.rb
|
198
|
+
- test/unit/report_importer_test.rb
|
199
|
+
- test/unit/hostgroup_extensions_test.rb
|
200
|
+
- test/unit/salt_modules_test.rb
|
200
201
|
- test/unit/highstate.json
|
201
202
|
- test/unit/salt_keys_test.rb
|
202
|
-
- test/
|
203
|
-
- test/
|
204
|
-
- test/
|
205
|
-
- test/
|
206
|
-
- test/
|
207
|
-
- test/
|
203
|
+
- test/functional/minions_controller_test.rb
|
204
|
+
- test/functional/api/v2/salt_autosign_controller_test.rb
|
205
|
+
- test/functional/api/v2/salt_states_controller_test.rb
|
206
|
+
- test/functional/api/v2/salt_keys_controller_test.rb
|
207
|
+
- test/functional/api/v2/salt_environments_controller_test.rb
|
208
|
+
- test/factories/foreman_salt_factories.rb
|
@@ -1,8 +0,0 @@
|
|
1
|
-
class AddIndexToJoinTables < ActiveRecord::Migration
|
2
|
-
def change
|
3
|
-
add_index :host_salt_modules, :host_id
|
4
|
-
add_index :host_salt_modules, :salt_module_id
|
5
|
-
add_index :hostgroup_salt_modules, :hostgroup_id
|
6
|
-
add_index :hostgroup_salt_modules, :salt_module_id
|
7
|
-
end
|
8
|
-
end
|