foreman_remote_execution 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +11 -4
- data/app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb +8 -2
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +45 -40
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +8 -2
- data/lib/foreman_remote_execution/engine.rb +4 -4
- data/lib/foreman_remote_execution/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6489b51f165437b41df19831b17dec95a621c62
|
4
|
+
data.tar.gz: b77739a1af35d9b92d0a8127496dae9c28139d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e51d1a704f41a217fb3e55422f371c05ef0e9d1669a8dc07d1bca2f5230a37ed7064f9fa1858b393ad9ccfd1f779e88d97151aa35d5070594536a2c5cc7695e
|
7
|
+
data.tar.gz: 26de9c88504a94dcbac54e4b3b5195500568efd8997f5ee751fe0ca040a7a24fcc76ab7759bc78ed18e4eb2bc3865cc8019a3df660fb6ecd1ba2e72707a3bba3
|
@@ -1,7 +1,14 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module HostsHelperExtensions
|
3
|
-
|
4
|
-
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
alias_method_chain(:host_title_actions, :run_button)
|
7
|
+
alias_method_chain :multiple_actions, :remote_execution
|
8
|
+
end
|
9
|
+
|
10
|
+
def multiple_actions_with_remote_execution
|
11
|
+
multiple_actions_without_remote_execution + [ [_('Schedule Remote Job'), new_job_invocation_path, false] ]
|
5
12
|
end
|
6
13
|
|
7
14
|
def schedule_job_multi_button(*args)
|
@@ -20,9 +27,9 @@ module ForemanRemoteExecution
|
|
20
27
|
link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button, :class => 'btn btn-default')
|
21
28
|
end
|
22
29
|
|
23
|
-
def
|
30
|
+
def host_title_actions_with_run_button(*args)
|
24
31
|
title_actions(button_group(schedule_job_multi_button(*args)))
|
25
|
-
|
32
|
+
host_title_actions_without_run_button(*args)
|
26
33
|
end
|
27
34
|
end
|
28
35
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module JobTemplatesExtensions
|
3
|
-
|
4
|
-
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
alias_method_chain :permitted_actions, :run_button
|
7
|
+
end
|
8
|
+
|
9
|
+
def permitted_actions_with_run_button(template)
|
10
|
+
original = permitted_actions_without_run_button(template)
|
5
11
|
|
6
12
|
if template.is_a?(JobTemplate)
|
7
13
|
original.unshift(display_link_if_authorized(_('Run'), hash_for_new_job_invocation_path(:template_id => template.id).merge(:authorizer => authorizer))) unless template.snippet
|
@@ -1,39 +1,44 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module HostExtensions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
3
5
|
# rubocop:disable Metrics/BlockLength
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
'job_invocation.result' => %(#{ForemanTasks::Task.table_name}.result #{operator} (?))
|
31
|
-
}
|
32
|
-
{
|
33
|
-
:conditions => sanitize_sql_for_conditions([mapping[key], value_to_sql(operator, value)]),
|
34
|
-
:joins => { :template_invocations => [:run_host_job_task] }
|
35
|
-
}
|
6
|
+
included do
|
7
|
+
alias_method_chain :build_required_interfaces, :remote_execution
|
8
|
+
alias_method_chain :reload, :remote_execution
|
9
|
+
alias_method_chain :becomes, :remote_execution
|
10
|
+
alias_method_chain :host_params, :remote_execution
|
11
|
+
|
12
|
+
has_many :targeting_hosts, :dependent => :destroy, :foreign_key => 'host_id'
|
13
|
+
has_many :template_invocations, :dependent => :destroy, :foreign_key => 'host_id'
|
14
|
+
has_one :execution_status_object, :class_name => 'HostStatus::ExecutionStatus', :foreign_key => 'host_id'
|
15
|
+
has_many :run_host_job_tasks, :through => :template_invocations
|
16
|
+
|
17
|
+
scoped_search :relation => :run_host_job_tasks, :on => :result, :rename => 'job_invocation.result',
|
18
|
+
:ext_method => :search_by_job_invocation,
|
19
|
+
:only_explicit => true,
|
20
|
+
:complete_value => TemplateInvocation::TaskResultMap::REVERSE_MAP
|
21
|
+
|
22
|
+
scoped_search :relation => :template_invocations, :on => :job_invocation_id,
|
23
|
+
:rename => 'job_invocation.id', :only_explicit => true, :ext_method => :search_by_job_invocation
|
24
|
+
|
25
|
+
scoped_search :relation => :execution_status_object, :on => :status, :rename => :execution_status,
|
26
|
+
:complete_value => { :ok => HostStatus::ExecutionStatus::OK, :error => HostStatus::ExecutionStatus::ERROR }
|
27
|
+
|
28
|
+
def self.search_by_job_invocation(key, operator, value)
|
29
|
+
if key == 'job_invocation.result'
|
30
|
+
operator = operator == '=' ? 'IN' : 'NOT IN'
|
31
|
+
value = TemplateInvocation::TaskResultMap.status_to_task_result(value)
|
36
32
|
end
|
33
|
+
|
34
|
+
mapping = {
|
35
|
+
'job_invocation.id' => %(#{TemplateInvocation.table_name}.job_invocation_id #{operator} ?),
|
36
|
+
'job_invocation.result' => %(#{ForemanTasks::Task.table_name}.result #{operator} (?))
|
37
|
+
}
|
38
|
+
{
|
39
|
+
:conditions => sanitize_sql_for_conditions([mapping[key], value_to_sql(operator, value)]),
|
40
|
+
:joins => { :template_invocations => [:run_host_job_task] }
|
41
|
+
}
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
@@ -45,8 +50,8 @@ module ForemanRemoteExecution
|
|
45
50
|
@execution_status_label ||= get_status(HostStatus::ExecutionStatus).to_label(options)
|
46
51
|
end
|
47
52
|
|
48
|
-
def
|
49
|
-
params =
|
53
|
+
def host_params_with_remote_execution
|
54
|
+
params = host_params_without_remote_execution
|
50
55
|
keys = remote_execution_ssh_keys
|
51
56
|
params['remote_execution_ssh_keys'] = keys if keys.present?
|
52
57
|
[:remote_execution_ssh_user, :remote_execution_effective_user_method,
|
@@ -88,21 +93,21 @@ module ForemanRemoteExecution
|
|
88
93
|
@execution_interface = nil
|
89
94
|
end
|
90
95
|
|
91
|
-
def
|
92
|
-
became =
|
96
|
+
def becomes_with_remote_execution(*args)
|
97
|
+
became = becomes_without_remote_execution(*args)
|
93
98
|
became.drop_execution_interface_cache if became.respond_to? :drop_execution_interface_cache
|
94
99
|
became
|
95
100
|
end
|
96
101
|
|
97
|
-
def
|
102
|
+
def reload_with_remote_execution(*args)
|
98
103
|
drop_execution_interface_cache
|
99
|
-
|
104
|
+
reload_without_remote_execution(*args)
|
100
105
|
end
|
101
106
|
|
102
107
|
private
|
103
108
|
|
104
|
-
def
|
105
|
-
|
109
|
+
def build_required_interfaces_with_remote_execution(attrs = {})
|
110
|
+
build_required_interfaces_without_remote_execution(attrs)
|
106
111
|
self.primary_interface.execution = true if self.execution_interface.nil?
|
107
112
|
end
|
108
113
|
end
|
@@ -1,5 +1,11 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module SmartProxyExtensions
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
alias_method_chain :refresh, :remote_execution
|
7
|
+
end
|
8
|
+
|
3
9
|
def pubkey
|
4
10
|
self[:pubkey] || update_pubkey
|
5
11
|
end
|
@@ -11,8 +17,8 @@ module ForemanRemoteExecution
|
|
11
17
|
key
|
12
18
|
end
|
13
19
|
|
14
|
-
def
|
15
|
-
errors =
|
20
|
+
def refresh_with_remote_execution
|
21
|
+
errors = refresh_without_remote_execution
|
16
22
|
update_pubkey
|
17
23
|
errors
|
18
24
|
end
|
@@ -148,7 +148,7 @@ module ForemanRemoteExecution
|
|
148
148
|
|
149
149
|
User.send(:include, ForemanRemoteExecution::UserExtensions)
|
150
150
|
|
151
|
-
Host::Managed.send(:
|
151
|
+
Host::Managed.send(:include, ForemanRemoteExecution::HostExtensions)
|
152
152
|
Host::Managed.send(:include, ForemanTasks::Concerns::HostActionSubject)
|
153
153
|
|
154
154
|
(Nic::Base.descendants + [Nic::Base]).each do |klass|
|
@@ -156,10 +156,10 @@ module ForemanRemoteExecution
|
|
156
156
|
end
|
157
157
|
|
158
158
|
Bookmark.send(:include, ForemanRemoteExecution::BookmarkExtensions)
|
159
|
-
HostsHelper.send(:
|
160
|
-
ProvisioningTemplatesHelper.send(:
|
159
|
+
HostsHelper.send(:include, ForemanRemoteExecution::HostsHelperExtensions)
|
160
|
+
ProvisioningTemplatesHelper.send(:include, ForemanRemoteExecution::JobTemplatesExtensions)
|
161
161
|
|
162
|
-
SmartProxy.send(:
|
162
|
+
SmartProxy.send(:include, ForemanRemoteExecution::SmartProxyExtensions)
|
163
163
|
Subnet.send(:include, ForemanRemoteExecution::SubnetExtensions)
|
164
164
|
|
165
165
|
# We need to explicitly force to load the Task model due to Rails loader
|
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.3.
|
4
|
+
version: 1.3.5
|
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: 2017-10-
|
11
|
+
date: 2017-10-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|