foreman_remote_execution 1.2.2 → 1.3.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/README.md +11 -0
- data/app/assets/javascripts/template_invocation.js +6 -11
- data/app/controllers/api/v2/job_templates_controller.rb +1 -0
- data/app/controllers/concerns/foreman/controller/parameters/remote_execution_feature.rb +1 -1
- data/app/controllers/job_invocations_controller.rb +6 -2
- data/app/controllers/job_templates_controller.rb +0 -5
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +18 -2
- data/app/helpers/concerns/foreman_remote_execution/job_templates_extensions.rb +1 -2
- data/app/helpers/remote_execution_helper.rb +42 -41
- data/app/lib/actions/remote_execution/run_host_job.rb +2 -15
- data/app/lib/actions/remote_execution/run_hosts_job.rb +17 -3
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +7 -6
- data/app/models/input_template_renderer.rb +1 -1
- data/app/models/job_invocation.rb +23 -5
- data/app/models/remote_execution_feature.rb +16 -3
- data/app/models/setting/remote_execution.rb +4 -1
- data/app/models/ssh_execution_provider.rb +33 -2
- data/app/models/targeting.rb +7 -3
- data/app/views/api/v2/remote_execution_features/base.json.rabl +1 -1
- data/app/views/job_invocations/_form.html.erb +1 -4
- data/app/views/job_invocations/_host_name_td.html.erb +2 -1
- data/app/views/job_invocations/index.html.erb +1 -1
- data/app/views/job_invocations/show.html.erb +1 -1
- data/app/views/job_templates/_custom_tabs.html.erb +1 -4
- data/app/views/overrides/nics/_execution_interface.html.erb +2 -3
- data/app/views/remote_execution_features/index.html.erb +1 -1
- data/db/migrate/20170110145641_add_host_action_button_to_remote_execution_feature.rb +5 -0
- data/foreman_remote_execution.gemspec +1 -1
- data/lib/foreman_remote_execution/engine.rb +3 -1
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/locale/action_names.rb +2 -5
- data/locale/de/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/de/foreman_remote_execution.po +13 -23
- data/locale/en/foreman_remote_execution.po +12 -22
- data/locale/en_GB/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/en_GB/foreman_remote_execution.po +12 -22
- data/locale/es/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/es/foreman_remote_execution.po +13 -23
- data/locale/foreman_remote_execution.pot +71 -80
- data/locale/fr/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/fr/foreman_remote_execution.po +13 -23
- data/locale/ja/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ja/foreman_remote_execution.po +13 -23
- data/locale/ko/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ko/foreman_remote_execution.po +13 -23
- data/locale/pt_BR/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/pt_BR/foreman_remote_execution.po +13 -23
- data/locale/ru/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/ru/foreman_remote_execution.po +13 -23
- data/locale/zh_CN/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_CN/foreman_remote_execution.po +13 -23
- data/locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo +0 -0
- data/locale/zh_TW/foreman_remote_execution.po +13 -23
- data/test/benchmark/run_hosts_job_benchmark.rb +70 -0
- data/test/benchmark/targeting_benchmark.rb +31 -0
- data/test/factories/foreman_remote_execution_factories.rb +3 -0
- data/test/functional/api/v2/job_templates_controller_test.rb +1 -1
- data/test/unit/actions/run_hosts_job_test.rb +1 -0
- data/test/unit/concerns/host_extensions_test.rb +1 -4
- data/test/unit/job_invocation_test.rb +28 -1
- data/test/unit/remote_execution_feature_test.rb +40 -0
- data/test/unit/remote_execution_provider_test.rb +55 -1
- metadata +10 -7
- data/test/unit/actions/run_host_job_test.rb +0 -50
@@ -90,7 +90,6 @@ describe RemoteExecutionProvider do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
-
|
94
93
|
describe 'ssh port from settings' do
|
95
94
|
before do
|
96
95
|
Setting[:remote_execution_ssh_port] = '66'
|
@@ -112,5 +111,60 @@ describe RemoteExecutionProvider do
|
|
112
111
|
end
|
113
112
|
end
|
114
113
|
|
114
|
+
describe '#find_ip_or_hostname' do
|
115
|
+
let(:host) do
|
116
|
+
FactoryGirl.create(:host) do |host|
|
117
|
+
host.interfaces = [FactoryGirl.build(:nic_managed, flags.merge(:ip => nil, :name => 'somehost.somedomain.org', :primary => true)),
|
118
|
+
FactoryGirl.build(:nic_managed, flags.merge(:ip => '127.0.0.1'))]
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
let(:flags) do
|
123
|
+
{ :primary => false, :provision => false, :execution => false }
|
124
|
+
end
|
125
|
+
|
126
|
+
it 'gets fqdn from flagged interfaces if not preferring ips' do
|
127
|
+
# falling to primary interface
|
128
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal 'somehost.somedomain.org'
|
129
|
+
|
130
|
+
# execution wins if present
|
131
|
+
execution_interface = FactoryGirl.build(:nic_managed,
|
132
|
+
flags.merge(:execution => true, :name => 'special.somedomain.org'))
|
133
|
+
host.interfaces << execution_interface
|
134
|
+
host.primary_interface.update_attributes(:execution => false)
|
135
|
+
host.interfaces.each(&:save)
|
136
|
+
host.reload
|
137
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal execution_interface.fqdn
|
138
|
+
end
|
139
|
+
|
140
|
+
it 'gets ip from flagged interfaces' do
|
141
|
+
host.params['remote_execution_connect_by_ip'] = true
|
142
|
+
# no ip address set on relevant interface - fallback to fqdn
|
143
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal 'somehost.somedomain.org'
|
144
|
+
|
145
|
+
# provision interface with ip while primary without
|
146
|
+
provision_interface = FactoryGirl.build(:nic_managed,
|
147
|
+
flags.merge(:provision => true, :ip => '10.0.0.1'))
|
148
|
+
host.interfaces << provision_interface
|
149
|
+
host.primary_interface.update_attributes(:provision => false)
|
150
|
+
host.interfaces.each(&:save)
|
151
|
+
host.reload
|
152
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal provision_interface.ip
|
153
|
+
|
154
|
+
# both primary and provision interface have IPs: the primary wins
|
155
|
+
host.primary_interface.update_attributes(:ip => '10.0.0.2', :execution => false)
|
156
|
+
host.reload
|
157
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal host.primary_interface.ip
|
158
|
+
|
159
|
+
# there is an execution interface with IP: it wins
|
160
|
+
execution_interface = FactoryGirl.build(:nic_managed,
|
161
|
+
flags.merge(:execution => true, :ip => '10.0.0.3'))
|
162
|
+
host.interfaces << execution_interface
|
163
|
+
host.primary_interface.update_attributes(:execution => false)
|
164
|
+
host.interfaces.each(&:save)
|
165
|
+
host.reload
|
166
|
+
SSHExecutionProvider.find_ip_or_hostname(host).must_equal execution_interface.ip
|
167
|
+
end
|
168
|
+
end
|
115
169
|
end
|
116
170
|
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.
|
4
|
+
version: 1.3.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:
|
11
|
+
date: 2017-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.9.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.9.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -312,6 +312,7 @@ files:
|
|
312
312
|
- db/migrate/20160127162711_reword_puppet_template_description.rb
|
313
313
|
- db/migrate/20160203104056_add_concurrency_options_to_job_invocation.rb
|
314
314
|
- db/migrate/20160926225841_update_template_input_value.rb
|
315
|
+
- db/migrate/20170110145641_add_host_action_button_to_remote_execution_feature.rb
|
315
316
|
- db/seeds.d/60-ssh_proxy_feature.rb
|
316
317
|
- db/seeds.d/70-job_templates.rb
|
317
318
|
- db/seeds.d/90-bookmarks.rb
|
@@ -383,6 +384,8 @@ files:
|
|
383
384
|
- locale/zh_CN/foreman_remote_execution.po
|
384
385
|
- locale/zh_TW/LC_MESSAGES/foreman_remote_execution.mo
|
385
386
|
- locale/zh_TW/foreman_remote_execution.po
|
387
|
+
- test/benchmark/run_hosts_job_benchmark.rb
|
388
|
+
- test/benchmark/targeting_benchmark.rb
|
386
389
|
- test/factories/foreman_remote_execution_factories.rb
|
387
390
|
- test/functional/api/v2/foreign_input_sets_controller_test.rb
|
388
391
|
- test/functional/api/v2/job_invocations_controller_test.rb
|
@@ -390,7 +393,6 @@ files:
|
|
390
393
|
- test/functional/api/v2/remote_execution_features_controller_test.rb
|
391
394
|
- test/functional/api/v2/template_inputs_controller_test.rb
|
392
395
|
- test/test_plugin_helper.rb
|
393
|
-
- test/unit/actions/run_host_job_test.rb
|
394
396
|
- test/unit/actions/run_hosts_job_test.rb
|
395
397
|
- test/unit/concerns/exportable_test.rb
|
396
398
|
- test/unit/concerns/host_extensions_test.rb
|
@@ -426,12 +428,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
426
428
|
version: '0'
|
427
429
|
requirements: []
|
428
430
|
rubyforge_project:
|
429
|
-
rubygems_version: 2.
|
431
|
+
rubygems_version: 2.5.1
|
430
432
|
signing_key:
|
431
433
|
specification_version: 4
|
432
434
|
summary: A plugin bringing remote execution to the Foreman, completing the config
|
433
435
|
management functionality with remote management functionality.
|
434
436
|
test_files:
|
437
|
+
- test/benchmark/run_hosts_job_benchmark.rb
|
438
|
+
- test/benchmark/targeting_benchmark.rb
|
435
439
|
- test/factories/foreman_remote_execution_factories.rb
|
436
440
|
- test/functional/api/v2/foreign_input_sets_controller_test.rb
|
437
441
|
- test/functional/api/v2/job_invocations_controller_test.rb
|
@@ -439,7 +443,6 @@ test_files:
|
|
439
443
|
- test/functional/api/v2/remote_execution_features_controller_test.rb
|
440
444
|
- test/functional/api/v2/template_inputs_controller_test.rb
|
441
445
|
- test/test_plugin_helper.rb
|
442
|
-
- test/unit/actions/run_host_job_test.rb
|
443
446
|
- test/unit/actions/run_hosts_job_test.rb
|
444
447
|
- test/unit/concerns/exportable_test.rb
|
445
448
|
- test/unit/concerns/host_extensions_test.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'test_plugin_helper'
|
2
|
-
|
3
|
-
module ForemanRemoteExecution
|
4
|
-
class RunHostJobTest < ActiveSupport::TestCase
|
5
|
-
include Dynflow::Testing
|
6
|
-
|
7
|
-
let(:action) do
|
8
|
-
create_action(Actions::RemoteExecution::RunHostJob)
|
9
|
-
end
|
10
|
-
|
11
|
-
describe '#find_ip_or_hostname' do
|
12
|
-
let(:host) { FactoryGirl.create(:host) }
|
13
|
-
let(:flags) do
|
14
|
-
{ :primary => false, :provision => false, :execution => false }
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'finds hostname' do
|
18
|
-
host.expects(:fqdn).returns('somehost.somedomain.org')
|
19
|
-
action.send(:find_ip_or_hostname, host).must_equal 'somehost.somedomain.org'
|
20
|
-
end
|
21
|
-
|
22
|
-
it 'gets ip from unflagged interfaces' do
|
23
|
-
ip = '127.0.0.1'
|
24
|
-
host.interfaces = [FactoryGirl.build(:nic_managed, flags.merge(:ip => nil)),
|
25
|
-
FactoryGirl.build(:nic_managed, flags.merge(:ip => ip))]
|
26
|
-
action.send(:find_ip_or_hostname, host).must_equal ip
|
27
|
-
end
|
28
|
-
|
29
|
-
it 'gets ip from flagged interfaces' do
|
30
|
-
unflagged_interface = FactoryGirl.build(:nic_managed, flags)
|
31
|
-
host.interfaces = [unflagged_interface]
|
32
|
-
action.send(:find_ip_or_hostname, host).must_equal unflagged_interface.ip
|
33
|
-
|
34
|
-
provision_interface = FactoryGirl.build(:nic_managed, flags.merge(:provision => true))
|
35
|
-
host.interfaces << provision_interface
|
36
|
-
action.send(:find_ip_or_hostname, host).must_equal provision_interface.ip
|
37
|
-
|
38
|
-
primary_interface = FactoryGirl.build(:nic_managed, flags.merge(:primary => true))
|
39
|
-
host.interfaces << primary_interface
|
40
|
-
# Workaround, execution flag got enabled when adding the interface to the host
|
41
|
-
host.interfaces.last.execution = false
|
42
|
-
action.send(:find_ip_or_hostname, host).must_equal primary_interface.ip
|
43
|
-
|
44
|
-
execution_interface = FactoryGirl.build(:nic_managed, flags.merge(:execution => true))
|
45
|
-
host.interfaces << execution_interface
|
46
|
-
action.send(:find_ip_or_hostname, host).must_equal execution_interface.ip
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|