foreman_remote_execution 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/foreign_input_sets_controller.rb +3 -2
- data/app/controllers/api/v2/job_templates_controller.rb +3 -1
- data/app/controllers/api/v2/remote_execution_features_controller.rb +2 -1
- data/app/controllers/api/v2/template_inputs_controller.rb +3 -2
- data/app/controllers/concerns/foreman/controller/parameters/foreign_input_set.rb +16 -0
- data/app/controllers/concerns/foreman/controller/parameters/job_template.rb +31 -0
- data/app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb +15 -0
- data/app/controllers/concerns/foreman/controller/parameters/targeting.rb +11 -0
- data/app/controllers/concerns/foreman/controller/parameters/template_input.rb +17 -0
- data/app/controllers/job_invocations_controller.rb +3 -2
- data/app/controllers/job_templates_controller.rb +2 -0
- data/app/controllers/remote_execution_features_controller.rb +2 -1
- data/app/models/concerns/foreman_remote_execution/nic_extensions.rb +0 -1
- data/app/models/concerns/foreman_remote_execution/subnet_extensions.rb +0 -1
- data/app/models/concerns/foreman_remote_execution/template_extensions.rb +0 -1
- data/app/models/foreign_input_set.rb +0 -1
- data/app/models/job_template.rb +0 -1
- data/app/models/job_template_effective_user.rb +0 -2
- data/app/models/remote_execution_feature.rb +0 -2
- data/app/models/targeting.rb +0 -2
- data/app/models/template_input.rb +2 -5
- data/app/views/api/v2/job_invocations/base.json.rabl +1 -1
- data/app/views/overrides/subnets/_rex_tab_pane.html.erb +1 -1
- data/foreman_remote_execution.gemspec +1 -1
- data/lib/foreman_remote_execution/engine.rb +4 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/lib/tasks/foreman_remote_execution_tasks.rake +1 -0
- metadata +10 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cf728e4ad2b40152dbac2f4f9db31707da17ed6
|
4
|
+
data.tar.gz: 0a74247993db625f0f22321d917569a9073b55ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c0893d6c932bb942f330dd37f43bc8edc5bb9d37f0de1baec580e7e73d13b36f35b53349bda05fbe29c72db42419e9bdcdbf30deb27f8945e0fbaeb0521df1f
|
7
|
+
data.tar.gz: 102c655a3149a5b5ce5f3372ba384e6a9bf5dc83adbd926b98f960f1cef674e937ce4f8953ef198d95b3d22f27be73762d177f1b863db8d05348c6cca4d3f4fe
|
@@ -3,6 +3,7 @@ module Api
|
|
3
3
|
class ForeignInputSetsController < ::Api::V2::BaseController
|
4
4
|
include ::Api::Version2
|
5
5
|
include ::Foreman::Renderer
|
6
|
+
include ::Foreman::Controller::Parameters::ForeignInputSet
|
6
7
|
|
7
8
|
before_filter :find_required_nested_object
|
8
9
|
before_filter :find_resource, :only => %w{show update destroy}
|
@@ -34,7 +35,7 @@ module Api
|
|
34
35
|
param :template_id, :identifier, :required => true
|
35
36
|
param_group :foreign_input_set, :as => :create
|
36
37
|
def create
|
37
|
-
@foreign_input_set = resource_class.new(
|
38
|
+
@foreign_input_set = resource_class.new(foreign_input_set_params.merge(:template_id => @nested_obj.id))
|
38
39
|
process_response @foreign_input_set.save
|
39
40
|
end
|
40
41
|
|
@@ -50,7 +51,7 @@ module Api
|
|
50
51
|
param :id, :identifier, :required => true
|
51
52
|
param_group :foreign_input_set
|
52
53
|
def update
|
53
|
-
process_response @foreign_input_set.update_attributes(
|
54
|
+
process_response @foreign_input_set.update_attributes(foreign_input_set_params)
|
54
55
|
end
|
55
56
|
|
56
57
|
def resource_name(nested_resource = nil)
|
@@ -5,6 +5,7 @@ module Api
|
|
5
5
|
include ::Api::TaxonomyScope
|
6
6
|
include ::Foreman::Renderer
|
7
7
|
include ::Foreman::Controller::ProvisioningTemplates
|
8
|
+
include ::Foreman::Controller::Parameters::JobTemplate
|
8
9
|
|
9
10
|
before_filter :find_optional_nested_object
|
10
11
|
before_filter :find_resource, :only => %w{show update destroy clone export}
|
@@ -118,9 +119,10 @@ module Api
|
|
118
119
|
private
|
119
120
|
|
120
121
|
def job_template_params
|
121
|
-
job_template_params = params[:job_template]
|
122
|
+
job_template_params = params[:job_template]
|
122
123
|
effective_user_attributes = (job_template_params.delete(:ssh) || {}).fetch(:effective_user, {})
|
123
124
|
job_template_params.merge(:effective_user_attributes => effective_user_attributes)
|
125
|
+
super
|
124
126
|
end
|
125
127
|
|
126
128
|
def action_permission
|
@@ -2,6 +2,7 @@ module Api
|
|
2
2
|
module V2
|
3
3
|
class RemoteExecutionFeaturesController < ::Api::V2::BaseController
|
4
4
|
include ::Api::Version2
|
5
|
+
include ::Foreman::Controller::Parameters::RemoteExecutionFeature
|
5
6
|
|
6
7
|
before_filter :find_resource, :only => %w{show update}
|
7
8
|
|
@@ -25,7 +26,7 @@ module Api
|
|
25
26
|
param :id, :identifier, :required => true
|
26
27
|
param_group :remote_execution_feature
|
27
28
|
def update
|
28
|
-
process_response @remote_execution_feature.update_attributes(
|
29
|
+
process_response @remote_execution_feature.update_attributes(remote_execution_feature_params)
|
29
30
|
end
|
30
31
|
|
31
32
|
private
|
@@ -3,6 +3,7 @@ module Api
|
|
3
3
|
class TemplateInputsController < ::Api::V2::BaseController
|
4
4
|
include ::Api::Version2
|
5
5
|
include ::Foreman::Renderer
|
6
|
+
include ::Foreman::Controller::Parameters::TemplateInput
|
6
7
|
|
7
8
|
before_filter :find_required_nested_object
|
8
9
|
before_filter :find_resource, :only => %w{show update destroy}
|
@@ -40,7 +41,7 @@ module Api
|
|
40
41
|
param :template_id, :identifier, :required => true
|
41
42
|
param_group :template_input, :as => :create
|
42
43
|
def create
|
43
|
-
@template_input = resource_class.new(
|
44
|
+
@template_input = resource_class.new(template_input_params.merge(:template_id => @nested_obj.id))
|
44
45
|
process_response @template_input.save
|
45
46
|
end
|
46
47
|
|
@@ -56,7 +57,7 @@ module Api
|
|
56
57
|
param :id, :identifier, :required => true
|
57
58
|
param_group :template_input
|
58
59
|
def update
|
59
|
-
process_response @template_input.update_attributes(
|
60
|
+
process_response @template_input.update_attributes(template_input_params)
|
60
61
|
end
|
61
62
|
|
62
63
|
def resource_name(nested_resource = nil)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ::Foreman::Controller::Parameters::ForeignInputSet
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
class_methods do
|
5
|
+
def foreign_input_set_params_filter
|
6
|
+
Foreman::ParameterFilter.new(::ForeignInputSet).tap do |filter|
|
7
|
+
filter.permit_by_context(:id, :_destroy, :template_id, :target_template_id, :include_all, :include, :exclude,
|
8
|
+
:nested => true)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def foreign_input_set_params
|
14
|
+
self.class.foreign_input_set_params_filter.filter_params(params, parameter_filter_context, :foreign_input_set)
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Foreman::Controller::Parameters::JobTemplate
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
include Foreman::Controller::Parameters::Taxonomix
|
4
|
+
include Foreman::Controller::Parameters::Template
|
5
|
+
include Foreman::Controller::Parameters::TemplateInput
|
6
|
+
include Foreman::Controller::Parameters::ForeignInputSet
|
7
|
+
|
8
|
+
class_methods do
|
9
|
+
def job_template_effective_user_filter
|
10
|
+
Foreman::ParameterFilter.new(::JobTemplateEffectiveUser).tap do |filter|
|
11
|
+
filter.permit_by_context(:value, :current_user, :overridable,
|
12
|
+
:nested => true)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def job_template_params_filter
|
17
|
+
Foreman::ParameterFilter.new(::TemplateInput).tap do |filter|
|
18
|
+
filter.permit :job_category, :provider_type, :description_format,
|
19
|
+
:effective_user_attributes => [job_template_effective_user_filter],
|
20
|
+
:template_inputs_attributes => [template_input_params_filter],
|
21
|
+
:foreign_input_sets_attributes => [foreign_input_set_params_filter]
|
22
|
+
add_template_params_filter(filter)
|
23
|
+
add_taxonomix_params_filter(filter)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def job_template_params
|
29
|
+
self.class.job_template_params_filter.filter_params(params, parameter_filter_context, :job_template)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Foreman::Controller::Parameters::RemoteExecutionFeature
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
class_methods do
|
5
|
+
def remote_execution_feature_params_filter
|
6
|
+
::Foreman::ParameterFilter.new(::RemoteExecutionFeature).tap do |filter|
|
7
|
+
filter.permit :label, :name, :provided_input_names, :description, :job_template_id
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def remote_execution_feature_params
|
13
|
+
self.class.remote_execution_feature_params_filter.filter_params(params, parameter_filter_context, :remote_execution_feature)
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Foreman::Controller::Parameters::Targeting
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
class_methods do
|
5
|
+
def targeting_params_filter
|
6
|
+
Foreman::ParameterFilter.new(::Targeting).tap do |filter|
|
7
|
+
filter.permit_by_context :targeting_type, :bookmark_id, :user, :search_query, :nested => true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Foreman::Controller::Parameters::TemplateInput
|
2
|
+
extend ActiveSupport::Concern
|
3
|
+
|
4
|
+
class_methods do
|
5
|
+
def template_input_params_filter
|
6
|
+
Foreman::ParameterFilter.new(::TemplateInput).tap do |filter|
|
7
|
+
filter.permit_by_context :id, :_destroy, :name, :required, :input_type, :fact_name,
|
8
|
+
:variable_name, :puppet_class_name, :puppet_parameter_name, :description, :template_id,
|
9
|
+
:options, :advanced, :nested => true
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def template_input_params
|
15
|
+
self.class.template_input_params_filter.filter_params(params, parameter_filter_context, :template_input)
|
16
|
+
end
|
17
|
+
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class JobInvocationsController < ApplicationController
|
2
|
-
include Foreman::Controller::AutoCompleteSearch
|
2
|
+
include ::Foreman::Controller::AutoCompleteSearch
|
3
|
+
include ::ForemanTasks::Concerns::Parameters::Triggering
|
3
4
|
|
4
5
|
def new
|
5
6
|
ui_params = {
|
@@ -34,7 +35,7 @@ class JobInvocationsController < ApplicationController
|
|
34
35
|
end
|
35
36
|
|
36
37
|
def create
|
37
|
-
@composer = JobInvocationComposer.from_ui_params(params)
|
38
|
+
@composer = JobInvocationComposer.from_ui_params(params.merge(:triggering => triggering_params))
|
38
39
|
if @composer.trigger
|
39
40
|
redirect_to job_invocation_path(@composer.job_invocation)
|
40
41
|
else
|
@@ -1,5 +1,6 @@
|
|
1
1
|
class RemoteExecutionFeaturesController < ::ApplicationController
|
2
2
|
before_filter :find_resource, :only => [:show, :update]
|
3
|
+
include ::Foreman::Controller::Parameters::RemoteExecutionFeature
|
3
4
|
|
4
5
|
def index
|
5
6
|
@remote_execution_features = resource_base.all
|
@@ -9,7 +10,7 @@ class RemoteExecutionFeaturesController < ::ApplicationController
|
|
9
10
|
end
|
10
11
|
|
11
12
|
def update
|
12
|
-
if @remote_execution_feature.update_attributes(
|
13
|
+
if @remote_execution_feature.update_attributes(remote_execution_feature_params)
|
13
14
|
process_success :object => @remote_execution_feature
|
14
15
|
else
|
15
16
|
process_error :object => @remote_execution_feature
|
@@ -5,7 +5,6 @@ module ForemanRemoteExecution
|
|
5
5
|
included do
|
6
6
|
has_many :target_remote_execution_proxies, :as => :target
|
7
7
|
has_many :remote_execution_proxies, :dependent => :destroy, :through => :target_remote_execution_proxies
|
8
|
-
attr_accessible :remote_execution_proxies, :remote_execution_proxy_ids
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
@@ -12,7 +12,6 @@ module ForemanRemoteExecution
|
|
12
12
|
end
|
13
13
|
accepts_nested_attributes_for :template_inputs, :allow_destroy => true
|
14
14
|
accepts_nested_attributes_for :foreign_input_sets, :allow_destroy => true
|
15
|
-
attr_accessible :template_inputs_attributes, :foreign_input_sets_attributes
|
16
15
|
end
|
17
16
|
|
18
17
|
# create or overwrite instance methods...
|
@@ -4,7 +4,6 @@ class ForeignInputSet < ActiveRecord::Base
|
|
4
4
|
class CircularDependencyError < Foreman::Exception
|
5
5
|
end
|
6
6
|
|
7
|
-
attr_accessible :template_id, :target_template_id, :include_all, :include, :exclude
|
8
7
|
attr_exportable :exclude, :include, :include_all, :template => ->(input_set) { input_set.template.name }
|
9
8
|
|
10
9
|
belongs_to :template
|
data/app/models/job_template.rb
CHANGED
@@ -4,7 +4,6 @@ class JobTemplate < ::Template
|
|
4
4
|
class NonUniqueInputsError < Foreman::Exception
|
5
5
|
end
|
6
6
|
|
7
|
-
attr_accessible :job_category, :provider_type, :description_format, :effective_user_attributes
|
8
7
|
attr_exportable :name, :job_category, :description_format, :snippet, :template_inputs,
|
9
8
|
:foreign_input_sets, :provider_type, :kind => ->(template) { template.class.name.underscore }
|
10
9
|
|
data/app/models/targeting.rb
CHANGED
@@ -16,8 +16,6 @@ class Targeting < ActiveRecord::Base
|
|
16
16
|
validates :targeting_type, :presence => true, :inclusion => Targeting::TYPES.keys
|
17
17
|
validate :bookmark_or_query_is_present
|
18
18
|
|
19
|
-
attr_accessible :targeting_type, :bookmark_id, :user, :search_query
|
20
|
-
|
21
19
|
before_create :assign_search_query, :if => :static?
|
22
20
|
|
23
21
|
def clone
|
@@ -9,11 +9,8 @@ class TemplateInput < ActiveRecord::Base
|
|
9
9
|
TYPES = { :user => N_('User input'), :fact => N_('Fact value'), :variable => N_('Variable'),
|
10
10
|
:puppet_parameter => N_('Puppet parameter') }.with_indifferent_access
|
11
11
|
|
12
|
-
|
13
|
-
:
|
14
|
-
:options, :advanced
|
15
|
-
|
16
|
-
attr_exportable(*self.accessible_attributes - %w(template_id))
|
12
|
+
attr_exportable(:name, :required, :input_type, :fact_name, :variable_name, :puppet_class_name,
|
13
|
+
:puppet_parameter_name, :description, :options, :advanced)
|
17
14
|
|
18
15
|
belongs_to :template
|
19
16
|
has_many :template_invocation_input_values, :dependent => :destroy
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<div class="tab-pane" id="rex_proxies">
|
2
2
|
<%= fields_for :subnet do |f| %>
|
3
|
-
<%= multiple_selects f, :remote_execution_proxies, SmartProxy.authorized.with_features(RemoteExecutionProvider.provider_names), @subnet.remote_execution_proxy_ids, {:label => _("Proxies"), :help_inline => _("Select as many remote execution proxies as applicable for this subnet. When multiple proxies with the same provider are added, actions will be load balanced among them.")} %>
|
3
|
+
<%= multiple_selects f, :remote_execution_proxies, SmartProxy.authorized.with_features(*RemoteExecutionProvider.provider_names), @subnet.remote_execution_proxy_ids, {:label => _("Proxies"), :help_inline => _("Select as many remote execution proxies as applicable for this subnet. When multiple proxies with the same provider are added, actions will be load balanced among them.")} %>
|
4
4
|
<% end %>
|
5
5
|
</div>
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
|
21
21
|
s.add_dependency 'deface'
|
22
22
|
s.add_dependency 'dynflow', '~> 0.8.10'
|
23
|
-
s.add_dependency 'foreman-tasks', '~> 0.
|
23
|
+
s.add_dependency 'foreman-tasks', '~> 0.8.0'
|
24
24
|
|
25
25
|
s.add_development_dependency 'rubocop'
|
26
26
|
s.add_development_dependency 'rdoc'
|
@@ -29,7 +29,7 @@ module ForemanRemoteExecution
|
|
29
29
|
|
30
30
|
initializer 'foreman_remote_execution.register_plugin', before: :finisher_hook do |_app|
|
31
31
|
Foreman::Plugin.register :foreman_remote_execution do
|
32
|
-
requires_foreman '>= 1.
|
32
|
+
requires_foreman '>= 1.13'
|
33
33
|
|
34
34
|
apipie_documented_controllers ["#{ForemanRemoteExecution::Engine.root}/app/controllers/api/v2/*.rb"]
|
35
35
|
|
@@ -103,6 +103,9 @@ module ForemanRemoteExecution
|
|
103
103
|
register_custom_status HostStatus::ExecutionStatus
|
104
104
|
# add dashboard widget
|
105
105
|
# widget 'foreman_remote_execution_widget', name: N_('Foreman plugin template widget'), sizex: 4, sizey: 1
|
106
|
+
|
107
|
+
parameter_filter Subnet, :remote_execution_proxies, :remote_execution_proxy_ids
|
108
|
+
parameter_filter Nic, :execution
|
106
109
|
end
|
107
110
|
end
|
108
111
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_remote_execution
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Foreman Remote Execution team
|
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
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rubocop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -147,6 +147,11 @@ files:
|
|
147
147
|
- app/controllers/api/v2/job_templates_controller.rb
|
148
148
|
- app/controllers/api/v2/remote_execution_features_controller.rb
|
149
149
|
- app/controllers/api/v2/template_inputs_controller.rb
|
150
|
+
- app/controllers/concerns/foreman/controller/parameters/foreign_input_set.rb
|
151
|
+
- app/controllers/concerns/foreman/controller/parameters/job_template.rb
|
152
|
+
- app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb
|
153
|
+
- app/controllers/concerns/foreman/controller/parameters/targeting.rb
|
154
|
+
- app/controllers/concerns/foreman/controller/parameters/template_input.rb
|
150
155
|
- app/controllers/job_invocations_controller.rb
|
151
156
|
- app/controllers/job_templates_controller.rb
|
152
157
|
- app/controllers/remote_execution_features_controller.rb
|
@@ -394,7 +399,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
394
399
|
version: '0'
|
395
400
|
requirements: []
|
396
401
|
rubyforge_project:
|
397
|
-
rubygems_version: 2.4.
|
402
|
+
rubygems_version: 2.4.5
|
398
403
|
signing_key:
|
399
404
|
specification_version: 4
|
400
405
|
summary: A plugin bringing remote execution to the Foreman, completing the config
|