foreman_remote_execution 1.3.7 → 1.4.1
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 +4 -11
- data/app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb +2 -8
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +40 -45
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +2 -8
- 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: abc43eab1a70a711a3ecb5ea217d164d1e41b796
|
4
|
+
data.tar.gz: 0763324144fef57d8a5c146f0d28de18f3f88f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c3d790c35b20ba1fa1e4ab3fe123f64c590661b14106aa4d002467175d58920c7149b8ed53c28fe33a9c1c44604a9aec0e7c379e763b69ccba5f0e030b328ea
|
7
|
+
data.tar.gz: 4259ae34af58ffcf160d48614eb542198488b07f3095f34498c9b70c8c2087c831398f3f227e250b6596fbf8dccf96c1510f797ebd1ecce0144025467d6a2ed2
|
@@ -1,14 +1,7 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module HostsHelperExtensions
|
3
|
-
|
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] ]
|
3
|
+
def multiple_actions
|
4
|
+
super + [ [_('Schedule Remote Job'), new_job_invocation_path, false] ]
|
12
5
|
end
|
13
6
|
|
14
7
|
def schedule_job_multi_button(*args)
|
@@ -27,9 +20,9 @@ module ForemanRemoteExecution
|
|
27
20
|
link_to(_('Schedule Remote Job'), new_job_invocation_path(:host_ids => [args.first.id]), :id => :run_button, :class => 'btn btn-default')
|
28
21
|
end
|
29
22
|
|
30
|
-
def
|
23
|
+
def host_title_actions(*args)
|
31
24
|
title_actions(button_group(schedule_job_multi_button(*args)))
|
32
|
-
|
25
|
+
super(*args)
|
33
26
|
end
|
34
27
|
end
|
35
28
|
end
|
@@ -1,13 +1,7 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module JobTemplatesExtensions
|
3
|
-
|
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)
|
3
|
+
def permitted_actions(template)
|
4
|
+
original = super(template)
|
11
5
|
|
12
6
|
if template.is_a?(JobTemplate)
|
13
7
|
original.unshift(display_link_if_authorized(_('Run'), hash_for_new_job_invocation_path(:template_id => template.id).merge(:authorizer => authorizer))) unless template.snippet
|
@@ -1,44 +1,39 @@
|
|
1
1
|
module ForemanRemoteExecution
|
2
2
|
module HostExtensions
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
3
|
# rubocop:disable Metrics/BlockLength
|
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
|
-
|
31
|
-
|
4
|
+
def self.prepended(base)
|
5
|
+
base.instance_eval do
|
6
|
+
has_many :targeting_hosts, :dependent => :destroy, :foreign_key => 'host_id'
|
7
|
+
has_many :template_invocations, :dependent => :destroy, :foreign_key => 'host_id'
|
8
|
+
has_one :execution_status_object, :class_name => 'HostStatus::ExecutionStatus', :foreign_key => 'host_id'
|
9
|
+
has_many :run_host_job_tasks, :through => :template_invocations
|
10
|
+
|
11
|
+
scoped_search :relation => :run_host_job_tasks, :on => :result, :rename => 'job_invocation.result',
|
12
|
+
:ext_method => :search_by_job_invocation,
|
13
|
+
:only_explicit => true,
|
14
|
+
:complete_value => TemplateInvocation::TaskResultMap::REVERSE_MAP
|
15
|
+
|
16
|
+
scoped_search :relation => :template_invocations, :on => :job_invocation_id,
|
17
|
+
:rename => 'job_invocation.id', :only_explicit => true, :ext_method => :search_by_job_invocation
|
18
|
+
|
19
|
+
scoped_search :relation => :execution_status_object, :on => :status, :rename => :execution_status,
|
20
|
+
:complete_value => { :ok => HostStatus::ExecutionStatus::OK, :error => HostStatus::ExecutionStatus::ERROR }
|
21
|
+
|
22
|
+
def search_by_job_invocation(key, operator, value)
|
23
|
+
if key == 'job_invocation.result'
|
24
|
+
operator = operator == '=' ? 'IN' : 'NOT IN'
|
25
|
+
value = TemplateInvocation::TaskResultMap.status_to_task_result(value)
|
26
|
+
end
|
27
|
+
|
28
|
+
mapping = {
|
29
|
+
'job_invocation.id' => %(#{TemplateInvocation.table_name}.job_invocation_id #{operator} ?),
|
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
|
+
}
|
32
36
|
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
|
-
}
|
42
37
|
end
|
43
38
|
end
|
44
39
|
|
@@ -50,8 +45,8 @@ module ForemanRemoteExecution
|
|
50
45
|
@execution_status_label ||= get_status(HostStatus::ExecutionStatus).to_label(options)
|
51
46
|
end
|
52
47
|
|
53
|
-
def
|
54
|
-
params =
|
48
|
+
def host_params
|
49
|
+
params = super
|
55
50
|
keys = remote_execution_ssh_keys
|
56
51
|
params['remote_execution_ssh_keys'] = keys if keys.present?
|
57
52
|
[:remote_execution_ssh_user, :remote_execution_effective_user_method,
|
@@ -93,21 +88,21 @@ module ForemanRemoteExecution
|
|
93
88
|
@execution_interface = nil
|
94
89
|
end
|
95
90
|
|
96
|
-
def
|
97
|
-
became =
|
91
|
+
def becomes(*args)
|
92
|
+
became = super(*args)
|
98
93
|
became.drop_execution_interface_cache if became.respond_to? :drop_execution_interface_cache
|
99
94
|
became
|
100
95
|
end
|
101
96
|
|
102
|
-
def
|
97
|
+
def reload(*args)
|
103
98
|
drop_execution_interface_cache
|
104
|
-
|
99
|
+
super(*args)
|
105
100
|
end
|
106
101
|
|
107
102
|
private
|
108
103
|
|
109
|
-
def
|
110
|
-
|
104
|
+
def build_required_interfaces(attrs = {})
|
105
|
+
super(attrs)
|
111
106
|
self.primary_interface.execution = true if self.execution_interface.nil?
|
112
107
|
end
|
113
108
|
end
|
@@ -1,11 +1,5 @@
|
|
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
|
-
|
9
3
|
def pubkey
|
10
4
|
self[:pubkey] || update_pubkey
|
11
5
|
end
|
@@ -17,8 +11,8 @@ module ForemanRemoteExecution
|
|
17
11
|
key
|
18
12
|
end
|
19
13
|
|
20
|
-
def
|
21
|
-
errors =
|
14
|
+
def refresh
|
15
|
+
errors = super
|
22
16
|
update_pubkey
|
23
17
|
errors
|
24
18
|
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(:prepend, 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(:prepend, ForemanRemoteExecution::HostsHelperExtensions)
|
160
|
+
ProvisioningTemplatesHelper.send(:prepend, ForemanRemoteExecution::JobTemplatesExtensions)
|
161
161
|
|
162
|
-
SmartProxy.send(:
|
162
|
+
SmartProxy.send(:prepend, 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.
|
4
|
+
version: 1.4.1
|
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-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|