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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 459e92464d713529b6eda8dd33fa924c5ccdde44
4
- data.tar.gz: a55e090cc66b55664b4b2f628b83c209cb0c0f3f
3
+ metadata.gz: abc43eab1a70a711a3ecb5ea217d164d1e41b796
4
+ data.tar.gz: 0763324144fef57d8a5c146f0d28de18f3f88f65
5
5
  SHA512:
6
- metadata.gz: 282e5f81bf714aab0e020f35e6fe14c7cb82743d7ea77ced55f03322029a370769bb6f254bb9f729a2d7385ed54b10d91bf959fff5e89c764654c6b8ad27d9b5
7
- data.tar.gz: 88989286761baae23ecba6f6b6242d4648f2ce01cd22af1aad6fc7a6e734a9ca07ce8463fd8318120e4c68f6949aa4c47c24df2defe9ae5407fbba6e1bd980d9
6
+ metadata.gz: 6c3d790c35b20ba1fa1e4ab3fe123f64c590661b14106aa4d002467175d58920c7149b8ed53c28fe33a9c1c44604a9aec0e7c379e763b69ccba5f0e030b328ea
7
+ data.tar.gz: 4259ae34af58ffcf160d48614eb542198488b07f3095f34498c9b70c8c2087c831398f3f227e250b6596fbf8dccf96c1510f797ebd1ecce0144025467d6a2ed2
@@ -1,14 +1,7 @@
1
1
  module ForemanRemoteExecution
2
2
  module HostsHelperExtensions
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] ]
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 host_title_actions_with_run_button(*args)
23
+ def host_title_actions(*args)
31
24
  title_actions(button_group(schedule_job_multi_button(*args)))
32
- host_title_actions_without_run_button(*args)
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
- 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)
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
- 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)
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 host_params_with_remote_execution
54
- params = host_params_without_remote_execution
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 becomes_with_remote_execution(*args)
97
- became = becomes_without_remote_execution(*args)
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 reload_with_remote_execution(*args)
97
+ def reload(*args)
103
98
  drop_execution_interface_cache
104
- reload_without_remote_execution(*args)
99
+ super(*args)
105
100
  end
106
101
 
107
102
  private
108
103
 
109
- def build_required_interfaces_with_remote_execution(attrs = {})
110
- build_required_interfaces_without_remote_execution(attrs)
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 refresh_with_remote_execution
21
- errors = refresh_without_remote_execution
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(:include, ForemanRemoteExecution::HostExtensions)
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(:include, ForemanRemoteExecution::HostsHelperExtensions)
160
- ProvisioningTemplatesHelper.send(:include, ForemanRemoteExecution::JobTemplatesExtensions)
159
+ HostsHelper.send(:prepend, ForemanRemoteExecution::HostsHelperExtensions)
160
+ ProvisioningTemplatesHelper.send(:prepend, ForemanRemoteExecution::JobTemplatesExtensions)
161
161
 
162
- SmartProxy.send(:include, ForemanRemoteExecution::SmartProxyExtensions)
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
@@ -1,3 +1,3 @@
1
1
  module ForemanRemoteExecution
2
- VERSION = '1.3.7'.freeze
2
+ VERSION = '1.4.1'.freeze
3
3
  end
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.7
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-24 00:00:00.000000000 Z
11
+ date: 2017-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deface