foreman_remote_execution 4.5.0 → 4.5.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/job_invocations_controller.rb +1 -1
- data/app/controllers/ui_job_wizard_controller.rb +7 -0
- data/app/helpers/concerns/foreman_remote_execution/hosts_helper_extensions.rb +5 -1
- data/app/helpers/remote_execution_helper.rb +9 -3
- data/app/lib/actions/remote_execution/run_host_job.rb +5 -1
- data/app/lib/actions/remote_execution/run_hosts_job.rb +1 -1
- data/app/models/concerns/foreman_remote_execution/host_extensions.rb +2 -0
- data/app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb +6 -0
- data/app/models/host_proxy_invocation.rb +4 -0
- data/app/models/host_status/execution_status.rb +3 -3
- data/app/models/job_invocation.rb +9 -6
- data/app/models/job_invocation_composer.rb +4 -4
- data/app/models/remote_execution_feature.rb +5 -1
- data/app/models/remote_execution_provider.rb +1 -1
- data/app/models/setting/remote_execution.rb +2 -2
- data/app/models/targeting.rb +5 -1
- data/app/views/job_invocations/index.html.erb +1 -1
- data/app/views/templates/ssh/module_action.erb +1 -0
- data/app/views/templates/ssh/power_action.erb +2 -0
- data/app/views/templates/ssh/puppet_run_once.erb +1 -0
- data/db/migrate/2021051713291621250977_add_host_proxy_invocations.rb +12 -0
- data/lib/foreman_remote_execution/engine.rb +0 -2
- data/lib/foreman_remote_execution/version.rb +1 -1
- data/test/unit/job_invocation_composer_test.rb +14 -1
- data/test/unit/job_invocation_test.rb +1 -1
- data/webpack/JobWizard/JobWizard.js +28 -8
- data/webpack/JobWizard/JobWizard.scss +39 -0
- data/webpack/JobWizard/JobWizardConstants.js +10 -0
- data/webpack/JobWizard/JobWizardSelectors.js +9 -0
- data/webpack/JobWizard/__tests__/fixtures.js +104 -2
- data/webpack/JobWizard/__tests__/integration.test.js +13 -85
- data/webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js +21 -4
- data/webpack/JobWizard/steps/AdvancedFields/DescriptionField.js +67 -0
- data/webpack/JobWizard/steps/AdvancedFields/Fields.js +73 -59
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js +135 -16
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js +23 -0
- data/webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js +122 -51
- data/webpack/JobWizard/steps/Schedule/QueryType.js +48 -0
- data/webpack/JobWizard/steps/Schedule/RepeatOn.js +61 -0
- data/webpack/JobWizard/steps/Schedule/ScheduleType.js +25 -0
- data/webpack/JobWizard/steps/Schedule/StartEndDates.js +51 -0
- data/webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js +22 -0
- data/webpack/JobWizard/steps/Schedule/index.js +41 -0
- data/webpack/JobWizard/steps/form/FormHelpers.js +1 -0
- data/webpack/JobWizard/steps/form/Formatter.js +149 -0
- data/webpack/JobWizard/steps/form/NumberInput.js +33 -0
- data/webpack/JobWizard/steps/form/SelectField.js +14 -2
- data/webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example +76 -0
- data/webpack/__mocks__/foremanReact/components/SearchBar.js +18 -1
- data/webpack/react_app/components/TargetingHosts/__tests__/__snapshots__/TargetingHostsPage.test.js.snap +1 -0
- metadata +15 -13
- data/app/models/concerns/foreman_remote_execution/orchestration/ssh.rb +0 -70
- data/test/models/orchestration/ssh_test.rb +0 -56
- data/webpack/JobWizard/__tests__/JobWizard.test.js +0 -13
- data/webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap +0 -32
- data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap +0 -249
- data/webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap +0 -113
- data/webpack/JobWizard/steps/form/__tests__/GroupedSelectField.test.js +0 -38
- data/webpack/JobWizard/steps/form/__tests__/SelectField.test.js +0 -23
- data/webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap +0 -37
- data/webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap +0 -23
@@ -8,6 +8,8 @@ export const SelectField = ({
|
|
8
8
|
options,
|
9
9
|
value,
|
10
10
|
setValue,
|
11
|
+
labelIcon,
|
12
|
+
isRequired,
|
11
13
|
...props
|
12
14
|
}) => {
|
13
15
|
const onSelect = (event, selection) => {
|
@@ -16,7 +18,12 @@ export const SelectField = ({
|
|
16
18
|
};
|
17
19
|
const [isOpen, setIsOpen] = useState(false);
|
18
20
|
return (
|
19
|
-
<FormGroup
|
21
|
+
<FormGroup
|
22
|
+
label={label}
|
23
|
+
fieldId={fieldId}
|
24
|
+
labelIcon={labelIcon}
|
25
|
+
isRequired={isRequired}
|
26
|
+
>
|
20
27
|
<Select
|
21
28
|
selections={value}
|
22
29
|
onSelect={onSelect}
|
@@ -35,14 +42,19 @@ export const SelectField = ({
|
|
35
42
|
);
|
36
43
|
};
|
37
44
|
SelectField.propTypes = {
|
38
|
-
label: PropTypes.string
|
45
|
+
label: PropTypes.string,
|
39
46
|
fieldId: PropTypes.string.isRequired,
|
40
47
|
options: PropTypes.array,
|
41
48
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
42
49
|
setValue: PropTypes.func.isRequired,
|
50
|
+
labelIcon: PropTypes.node,
|
51
|
+
isRequired: PropTypes.bool,
|
43
52
|
};
|
44
53
|
|
45
54
|
SelectField.defaultProps = {
|
55
|
+
label: null,
|
46
56
|
options: [],
|
57
|
+
labelIcon: null,
|
47
58
|
value: null,
|
59
|
+
isRequired: false,
|
48
60
|
};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { Provider } from 'react-redux';
|
3
|
+
import configureMockStore from 'redux-mock-store';
|
4
|
+
import * as patternfly from '@patternfly/react-core';
|
5
|
+
import { mount, shallow } from '@theforeman/test';
|
6
|
+
import { formatter } from '../Formatter';
|
7
|
+
|
8
|
+
jest.spyOn(patternfly, 'Select');
|
9
|
+
jest.spyOn(patternfly, 'SelectOption');
|
10
|
+
jest.spyOn(patternfly, 'FormGroup');
|
11
|
+
patternfly.Select.mockImplementation(props => <div props={props} />);
|
12
|
+
patternfly.SelectOption.mockImplementation(props => <div props={props} />);
|
13
|
+
patternfly.FormGroup.mockImplementation(props => <div props={props} />);
|
14
|
+
const mockStore = configureMockStore([]);
|
15
|
+
const store = mockStore({});
|
16
|
+
|
17
|
+
describe('formatter', () => {
|
18
|
+
it('render date input', () => {
|
19
|
+
const props = {
|
20
|
+
name: 'date adv',
|
21
|
+
required: false,
|
22
|
+
options: '',
|
23
|
+
advanced: true,
|
24
|
+
value_type: 'date',
|
25
|
+
resource_type: 'ansible_roles',
|
26
|
+
default: '',
|
27
|
+
hidden_value: false,
|
28
|
+
};
|
29
|
+
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
30
|
+
});
|
31
|
+
it('render text input', () => {
|
32
|
+
const props = {
|
33
|
+
name: 'plain adv hidden',
|
34
|
+
required: true,
|
35
|
+
description: 'some Description',
|
36
|
+
options: '',
|
37
|
+
advanced: true,
|
38
|
+
value_type: 'plain',
|
39
|
+
resource_type: 'ansible_roles',
|
40
|
+
default: 'Default val',
|
41
|
+
hidden_value: true,
|
42
|
+
};
|
43
|
+
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
44
|
+
});
|
45
|
+
it('render select input', () => {
|
46
|
+
const props = {
|
47
|
+
name: 'adv plain search',
|
48
|
+
required: false,
|
49
|
+
input_type: 'user',
|
50
|
+
options: 'option 1\r\noption 2\r\noption 3\r\noption 4',
|
51
|
+
advanced: true,
|
52
|
+
value_type: 'plain',
|
53
|
+
resource_type: 'ansible_roles',
|
54
|
+
default: '',
|
55
|
+
hidden_value: false,
|
56
|
+
};
|
57
|
+
expect(shallow(formatter(props, {}, jest.fn()))).toMatchSnapshot();
|
58
|
+
});
|
59
|
+
it('render search input', () => {
|
60
|
+
const props = {
|
61
|
+
name: 'search adv',
|
62
|
+
required: false,
|
63
|
+
options: '',
|
64
|
+
advanced: true,
|
65
|
+
value_type: 'search',
|
66
|
+
resource_type: 'foreman_tasks/tasks',
|
67
|
+
default: '',
|
68
|
+
hidden_value: false,
|
69
|
+
};
|
70
|
+
expect(
|
71
|
+
mount(
|
72
|
+
<Provider store={store}>{formatter(props, {}, jest.fn())}</Provider>
|
73
|
+
)
|
74
|
+
).toMatchSnapshot();
|
75
|
+
});
|
76
|
+
});
|
@@ -1,2 +1,19 @@
|
|
1
|
-
|
1
|
+
import React from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
|
4
|
+
const SearchBar = ({ onChange }) => (
|
5
|
+
<input
|
6
|
+
className="foreman-search"
|
7
|
+
onChange={onChange}
|
8
|
+
placeholder="Filter..."
|
9
|
+
/>
|
10
|
+
);
|
2
11
|
export default SearchBar;
|
12
|
+
|
13
|
+
SearchBar.propTypes = {
|
14
|
+
onChange: PropTypes.func,
|
15
|
+
};
|
16
|
+
|
17
|
+
SearchBar.defaultProps = {
|
18
|
+
onChange: () => null,
|
19
|
+
};
|
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: 4.5.
|
4
|
+
version: 4.5.4
|
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: 2021-
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -171,7 +171,6 @@ files:
|
|
171
171
|
- app/models/concerns/foreman_remote_execution/foreman_tasks_triggering_extensions.rb
|
172
172
|
- app/models/concerns/foreman_remote_execution/host_extensions.rb
|
173
173
|
- app/models/concerns/foreman_remote_execution/nic_extensions.rb
|
174
|
-
- app/models/concerns/foreman_remote_execution/orchestration/ssh.rb
|
175
174
|
- app/models/concerns/foreman_remote_execution/smart_proxy_extensions.rb
|
176
175
|
- app/models/concerns/foreman_remote_execution/subnet_extensions.rb
|
177
176
|
- app/models/concerns/foreman_remote_execution/taxonomy_extensions.rb
|
@@ -180,6 +179,7 @@ files:
|
|
180
179
|
- app/models/concerns/foreman_remote_execution/template_overrides.rb
|
181
180
|
- app/models/concerns/foreman_remote_execution/user_extensions.rb
|
182
181
|
- app/models/foreign_input_set.rb
|
182
|
+
- app/models/host_proxy_invocation.rb
|
183
183
|
- app/models/host_status/execution_status.rb
|
184
184
|
- app/models/input_template_renderer.rb
|
185
185
|
- app/models/invocation_provider_input_value.rb
|
@@ -324,6 +324,7 @@ files:
|
|
324
324
|
- db/migrate/20200623073022_rename_sudo_password_to_effective_user_password.rb
|
325
325
|
- db/migrate/20200820122057_add_proxy_selector_override_to_remote_execution_feature.rb
|
326
326
|
- db/migrate/20210312074713_add_provider_inputs.rb
|
327
|
+
- db/migrate/2021051713291621250977_add_host_proxy_invocations.rb
|
327
328
|
- db/seeds.d/100-assign_features_with_templates.rb
|
328
329
|
- db/seeds.d/20-permissions.rb
|
329
330
|
- db/seeds.d/50-notification_blueprints.rb
|
@@ -380,7 +381,6 @@ files:
|
|
380
381
|
- test/functional/job_templates_controller_test.rb
|
381
382
|
- test/functional/ui_job_wizard_controller_test.rb
|
382
383
|
- test/helpers/remote_execution_helper_test.rb
|
383
|
-
- test/models/orchestration/ssh_test.rb
|
384
384
|
- test/support/remote_execution_helper.rb
|
385
385
|
- test/test_plugin_helper.rb
|
386
386
|
- test/unit/actions/run_host_job_test.rb
|
@@ -404,27 +404,30 @@ files:
|
|
404
404
|
- webpack/JobWizard/JobWizard.scss
|
405
405
|
- webpack/JobWizard/JobWizardConstants.js
|
406
406
|
- webpack/JobWizard/JobWizardSelectors.js
|
407
|
-
- webpack/JobWizard/__tests__/JobWizard.test.js
|
408
|
-
- webpack/JobWizard/__tests__/__snapshots__/JobWizard.test.js.snap
|
409
407
|
- webpack/JobWizard/__tests__/__snapshots__/integration.test.js.snap
|
410
408
|
- webpack/JobWizard/__tests__/fixtures.js
|
411
409
|
- webpack/JobWizard/__tests__/integration.test.js
|
412
410
|
- webpack/JobWizard/index.js
|
413
411
|
- webpack/JobWizard/steps/AdvancedFields/AdvancedFields.js
|
412
|
+
- webpack/JobWizard/steps/AdvancedFields/DescriptionField.js
|
414
413
|
- webpack/JobWizard/steps/AdvancedFields/Fields.js
|
415
414
|
- webpack/JobWizard/steps/AdvancedFields/__tests__/AdvancedFields.test.js
|
416
|
-
- webpack/JobWizard/steps/AdvancedFields/__tests__/
|
415
|
+
- webpack/JobWizard/steps/AdvancedFields/__tests__/DescriptionField.test.js
|
417
416
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.js
|
418
417
|
- webpack/JobWizard/steps/CategoryAndTemplate/CategoryAndTemplate.test.js
|
419
|
-
- webpack/JobWizard/steps/CategoryAndTemplate/__snapshots__/CategoryAndTemplate.test.js.snap
|
420
418
|
- webpack/JobWizard/steps/CategoryAndTemplate/index.js
|
419
|
+
- webpack/JobWizard/steps/Schedule/QueryType.js
|
420
|
+
- webpack/JobWizard/steps/Schedule/RepeatOn.js
|
421
|
+
- webpack/JobWizard/steps/Schedule/ScheduleType.js
|
422
|
+
- webpack/JobWizard/steps/Schedule/StartEndDates.js
|
423
|
+
- webpack/JobWizard/steps/Schedule/__tests__/StartEndDates.test.js
|
424
|
+
- webpack/JobWizard/steps/Schedule/index.js
|
421
425
|
- webpack/JobWizard/steps/form/FormHelpers.js
|
426
|
+
- webpack/JobWizard/steps/form/Formatter.js
|
422
427
|
- webpack/JobWizard/steps/form/GroupedSelectField.js
|
428
|
+
- webpack/JobWizard/steps/form/NumberInput.js
|
423
429
|
- webpack/JobWizard/steps/form/SelectField.js
|
424
|
-
- webpack/JobWizard/steps/form/__tests__/
|
425
|
-
- webpack/JobWizard/steps/form/__tests__/SelectField.test.js
|
426
|
-
- webpack/JobWizard/steps/form/__tests__/__snapshots__/GroupedSelectField.test.js.snap
|
427
|
-
- webpack/JobWizard/steps/form/__tests__/__snapshots__/SelectField.test.js.snap
|
430
|
+
- webpack/JobWizard/steps/form/__tests__/Formatter.test.js.example
|
428
431
|
- webpack/Routes/routes.js
|
429
432
|
- webpack/__mocks__/foremanReact/common/I18n.js
|
430
433
|
- webpack/__mocks__/foremanReact/common/helpers.js
|
@@ -518,7 +521,6 @@ test_files:
|
|
518
521
|
- test/functional/job_templates_controller_test.rb
|
519
522
|
- test/functional/ui_job_wizard_controller_test.rb
|
520
523
|
- test/helpers/remote_execution_helper_test.rb
|
521
|
-
- test/models/orchestration/ssh_test.rb
|
522
524
|
- test/support/remote_execution_helper.rb
|
523
525
|
- test/test_plugin_helper.rb
|
524
526
|
- test/unit/actions/run_host_job_test.rb
|
@@ -1,70 +0,0 @@
|
|
1
|
-
module ForemanRemoteExecution
|
2
|
-
module Orchestration::SSH
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
before_destroy :ssh_destroy
|
7
|
-
after_validation :queue_ssh_destroy
|
8
|
-
register_rebuild(:queue_ssh_destroy, N_("SSH_#{self.to_s.split('::').first}"))
|
9
|
-
end
|
10
|
-
|
11
|
-
def drop_from_known_hosts(proxy_id)
|
12
|
-
_, _, target = host_kind_target
|
13
|
-
return true if target.nil?
|
14
|
-
|
15
|
-
proxy = ::SmartProxy.find(proxy_id)
|
16
|
-
begin
|
17
|
-
proxy.drop_host_from_known_hosts(target)
|
18
|
-
rescue ::ProxyAPI::ProxyException => e
|
19
|
-
if e.wrapped_exception.is_a?(RestClient::NotFound)
|
20
|
-
# ignore 404 when known_hosts entry is missing or the module was not enabled
|
21
|
-
Foreman::Logging.exception "Proxy failed to delete SSH known_hosts for #{name}, #{ip}", e, :level => :error
|
22
|
-
else
|
23
|
-
raise e
|
24
|
-
end
|
25
|
-
rescue => e
|
26
|
-
Rails.logger.warn e.message
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
true
|
30
|
-
end
|
31
|
-
|
32
|
-
def ssh_destroy
|
33
|
-
logger.debug "Scheduling SSH known_hosts cleanup"
|
34
|
-
|
35
|
-
host, _kind, _target = host_kind_target
|
36
|
-
# #remote_execution_proxies may not be defined on the host object in some case
|
37
|
-
# for example Host::Discovered does not have it defined, even though these hosts
|
38
|
-
# have Nic::Managed interfaces associated with them
|
39
|
-
proxies = (host.try(:remote_execution_proxies, 'SSH') || {}).values
|
40
|
-
proxies.flatten.uniq.each do |proxy|
|
41
|
-
queue.create(id: queue_id(proxy.id), name: _("Remove SSH known hosts for %s") % self,
|
42
|
-
priority: 200, action: [self, :drop_from_known_hosts, proxy.id])
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def queue_ssh_destroy
|
47
|
-
should_drop_from_known_hosts? && ssh_destroy
|
48
|
-
end
|
49
|
-
|
50
|
-
def should_drop_from_known_hosts?
|
51
|
-
host, = host_kind_target
|
52
|
-
host && !host.new_record? && host.build && host.changes.key?('build')
|
53
|
-
end
|
54
|
-
|
55
|
-
private
|
56
|
-
|
57
|
-
def host_kind_target
|
58
|
-
if self.is_a?(::Host::Base)
|
59
|
-
[self, 'host', name]
|
60
|
-
else
|
61
|
-
[self.host, 'interface', ip]
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def queue_id(proxy_id)
|
66
|
-
_, kind, id = host_kind_target
|
67
|
-
"ssh_remove_known_hosts_#{kind}_#{id}_#{proxy_id}"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'test_plugin_helper'
|
2
|
-
|
3
|
-
class SSHOrchestrationTest < ActiveSupport::TestCase
|
4
|
-
let(:host) { FactoryBot.create(:host, :managed, :with_subnet) }
|
5
|
-
let(:proxy) { FactoryBot.create(:smart_proxy, :ssh) }
|
6
|
-
let(:interface) { host.interfaces.first }
|
7
|
-
|
8
|
-
before { interface.subnet.remote_execution_proxies = [proxy] }
|
9
|
-
|
10
|
-
it 'attempts to drop IP address and hostname from smart proxies on destroy' do
|
11
|
-
host.stubs(:skip_orchestration?).returns false
|
12
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(interface.ip)
|
13
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
14
|
-
host.destroy
|
15
|
-
end
|
16
|
-
|
17
|
-
it 'attempts to drop IP address and hostname from smart proxies on rebuild' do
|
18
|
-
host.stubs(:skip_orchestration?).returns false
|
19
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(interface.ip)
|
20
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
21
|
-
|
22
|
-
host.build = true
|
23
|
-
host.save!
|
24
|
-
|
25
|
-
ids = ["ssh_remove_known_hosts_interface_#{interface.ip}_#{proxy.id}",
|
26
|
-
"ssh_remove_known_hosts_host_#{host.name}_#{proxy.id}"]
|
27
|
-
_(host.queue.task_ids).must_equal ids
|
28
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'does not fail on 404 from the smart proxy' do
|
32
|
-
host.stubs(:skip_orchestration?).returns false
|
33
|
-
::ProxyAPI::RemoteExecutionSSH.any_instance.expects(:delete).raises(RestClient::ResourceNotFound).twice
|
34
|
-
host.build = true
|
35
|
-
host.save!
|
36
|
-
ids = ["ssh_remove_known_hosts_interface_#{interface.ip}_#{proxy.id}",
|
37
|
-
"ssh_remove_known_hosts_host_#{host.name}_#{proxy.id}"]
|
38
|
-
_(host.queue.task_ids).must_equal ids
|
39
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'does not trigger the removal when creating a new host' do
|
43
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).never
|
44
|
-
host = Host::Managed.new(:name => 'test', :ip => '127.0.0.1')
|
45
|
-
host.stubs(:skip_orchestration?).returns false
|
46
|
-
_(host.queue.task_ids).must_equal []
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'does not call to the proxy when target is nil' do
|
50
|
-
host.stubs(:skip_orchestration?).returns false
|
51
|
-
SmartProxy.any_instance.expects(:drop_host_from_known_hosts).with(host.name)
|
52
|
-
host.interfaces.first.stubs(:ip)
|
53
|
-
host.destroy
|
54
|
-
_(host.queue.items.map(&:status)).must_equal %w(completed completed)
|
55
|
-
end
|
56
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import * as patternfly from '@patternfly/react-core';
|
3
|
-
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
|
4
|
-
import JobWizardPage from '../index';
|
5
|
-
|
6
|
-
jest.spyOn(patternfly, 'Wizard');
|
7
|
-
patternfly.Wizard.mockImplementation(props => <div>{props.navAriaLabel}</div>);
|
8
|
-
|
9
|
-
const fixtures = {
|
10
|
-
'renders ': {},
|
11
|
-
};
|
12
|
-
describe('JobWizardPage rendering', () =>
|
13
|
-
testComponentSnapshotsWithFixtures(JobWizardPage, fixtures));
|
@@ -1,32 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`JobWizardPage rendering renders 1`] = `
|
4
|
-
<PageLayout
|
5
|
-
breadcrumbOptions={
|
6
|
-
Object {
|
7
|
-
"breadcrumbItems": Array [
|
8
|
-
Object {
|
9
|
-
"caption": "Jobs",
|
10
|
-
"url": "/jobs",
|
11
|
-
},
|
12
|
-
Object {
|
13
|
-
"caption": "Run job",
|
14
|
-
},
|
15
|
-
],
|
16
|
-
}
|
17
|
-
}
|
18
|
-
header="Run job"
|
19
|
-
searchable={false}
|
20
|
-
>
|
21
|
-
<Title
|
22
|
-
headingLevel="h2"
|
23
|
-
size="2xl"
|
24
|
-
>
|
25
|
-
Run job
|
26
|
-
</Title>
|
27
|
-
<Divider
|
28
|
-
component="div"
|
29
|
-
/>
|
30
|
-
<JobWizard />
|
31
|
-
</PageLayout>
|
32
|
-
`;
|
data/webpack/JobWizard/steps/AdvancedFields/__tests__/__snapshots__/AdvancedFields.test.js.snap
DELETED
@@ -1,249 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`AdvancedFields rendring 1`] = `
|
4
|
-
<Provider
|
5
|
-
store={
|
6
|
-
Object {
|
7
|
-
"clearActions": [Function],
|
8
|
-
"dispatch": [Function],
|
9
|
-
"getActions": [Function],
|
10
|
-
"getState": [Function],
|
11
|
-
"replaceReducer": [Function],
|
12
|
-
"subscribe": [Function],
|
13
|
-
}
|
14
|
-
}
|
15
|
-
>
|
16
|
-
<AdvancedFields
|
17
|
-
advancedValues={Object {}}
|
18
|
-
setAdvancedValues={[MockFunction]}
|
19
|
-
>
|
20
|
-
<Title
|
21
|
-
className="advanced-fields-title"
|
22
|
-
headingLevel="h2"
|
23
|
-
>
|
24
|
-
<h2
|
25
|
-
className="pf-c-title pf-m-xl advanced-fields-title"
|
26
|
-
>
|
27
|
-
Advanced Fields
|
28
|
-
</h2>
|
29
|
-
</Title>
|
30
|
-
<Form>
|
31
|
-
<form
|
32
|
-
className="pf-c-form"
|
33
|
-
noValidate={true}
|
34
|
-
>
|
35
|
-
<EffectiveUserField
|
36
|
-
setValue={[Function]}
|
37
|
-
value=""
|
38
|
-
>
|
39
|
-
<mockConstructor
|
40
|
-
fieldId="effective-user"
|
41
|
-
label="Effective user"
|
42
|
-
labelIcon={
|
43
|
-
<Popover
|
44
|
-
aria-label="help-text"
|
45
|
-
bodyContent="A user to be used for executing the script. If it differs from the SSH user, su or sudo is used to switch the accounts."
|
46
|
-
id="effective-user-help"
|
47
|
-
>
|
48
|
-
<button
|
49
|
-
aria-label="open-help-tooltip-button"
|
50
|
-
className="pf-c-form__group-label-help"
|
51
|
-
onClick={[Function]}
|
52
|
-
>
|
53
|
-
<HelpIcon
|
54
|
-
color="currentColor"
|
55
|
-
noVerticalAlign={true}
|
56
|
-
size="sm"
|
57
|
-
/>
|
58
|
-
</button>
|
59
|
-
</Popover>
|
60
|
-
}
|
61
|
-
>
|
62
|
-
<div />
|
63
|
-
</mockConstructor>
|
64
|
-
</EffectiveUserField>
|
65
|
-
<TimeoutToKillField
|
66
|
-
setValue={[Function]}
|
67
|
-
value=""
|
68
|
-
>
|
69
|
-
<mockConstructor
|
70
|
-
fieldId="timeout-to-kill"
|
71
|
-
label="Timeout to kill"
|
72
|
-
labelIcon={
|
73
|
-
<Popover
|
74
|
-
aria-label="help-text"
|
75
|
-
bodyContent="Time in seconds from the start on the remote host after which the job should be killed."
|
76
|
-
id="timeout-to-kill-help"
|
77
|
-
>
|
78
|
-
<button
|
79
|
-
aria-label="open-help-tooltip-button"
|
80
|
-
className="pf-c-form__group-label-help"
|
81
|
-
onClick={[Function]}
|
82
|
-
>
|
83
|
-
<HelpIcon
|
84
|
-
color="currentColor"
|
85
|
-
noVerticalAlign={true}
|
86
|
-
size="sm"
|
87
|
-
/>
|
88
|
-
</button>
|
89
|
-
</Popover>
|
90
|
-
}
|
91
|
-
>
|
92
|
-
<div />
|
93
|
-
</mockConstructor>
|
94
|
-
</TimeoutToKillField>
|
95
|
-
<PasswordField
|
96
|
-
setValue={[Function]}
|
97
|
-
value=""
|
98
|
-
>
|
99
|
-
<mockConstructor
|
100
|
-
fieldId="password"
|
101
|
-
label="Password"
|
102
|
-
labelIcon={
|
103
|
-
<Popover
|
104
|
-
aria-label="help-text"
|
105
|
-
bodyContent="Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
|
106
|
-
id="password-help"
|
107
|
-
>
|
108
|
-
<button
|
109
|
-
aria-label="open-help-tooltip-button"
|
110
|
-
className="pf-c-form__group-label-help"
|
111
|
-
onClick={[Function]}
|
112
|
-
>
|
113
|
-
<HelpIcon
|
114
|
-
color="currentColor"
|
115
|
-
noVerticalAlign={true}
|
116
|
-
size="sm"
|
117
|
-
/>
|
118
|
-
</button>
|
119
|
-
</Popover>
|
120
|
-
}
|
121
|
-
>
|
122
|
-
<div />
|
123
|
-
</mockConstructor>
|
124
|
-
</PasswordField>
|
125
|
-
<KeyPassphraseField
|
126
|
-
setValue={[Function]}
|
127
|
-
value=""
|
128
|
-
>
|
129
|
-
<mockConstructor
|
130
|
-
fieldId="key-passphrase"
|
131
|
-
label="Private key passphrase"
|
132
|
-
labelIcon={
|
133
|
-
<Popover
|
134
|
-
aria-label="help-text"
|
135
|
-
bodyContent="Key passphrase is only applicable for SSH provider. Other providers ignore this field. Passphrase is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
|
136
|
-
id="key-passphrase-help"
|
137
|
-
>
|
138
|
-
<button
|
139
|
-
aria-label="open-help-tooltip-button"
|
140
|
-
className="pf-c-form__group-label-help"
|
141
|
-
onClick={[Function]}
|
142
|
-
>
|
143
|
-
<HelpIcon
|
144
|
-
color="currentColor"
|
145
|
-
noVerticalAlign={true}
|
146
|
-
size="sm"
|
147
|
-
/>
|
148
|
-
</button>
|
149
|
-
</Popover>
|
150
|
-
}
|
151
|
-
>
|
152
|
-
<div />
|
153
|
-
</mockConstructor>
|
154
|
-
</KeyPassphraseField>
|
155
|
-
<EffectiveUserPasswordField
|
156
|
-
setValue={[Function]}
|
157
|
-
value=""
|
158
|
-
>
|
159
|
-
<mockConstructor
|
160
|
-
fieldId="effective-user-password"
|
161
|
-
label="Effective user password"
|
162
|
-
labelIcon={
|
163
|
-
<Popover
|
164
|
-
aria-label="help-text"
|
165
|
-
bodyContent="Effective user password is only applicable for SSH provider. Other providers ignore this field. Password is stored encrypted in DB until the job finishes. For future or recurring executions, it is removed after the last execution."
|
166
|
-
id="effective-user-password-help"
|
167
|
-
>
|
168
|
-
<button
|
169
|
-
aria-label="open-help-tooltip-button"
|
170
|
-
className="pf-c-form__group-label-help"
|
171
|
-
onClick={[Function]}
|
172
|
-
>
|
173
|
-
<HelpIcon
|
174
|
-
color="currentColor"
|
175
|
-
noVerticalAlign={true}
|
176
|
-
size="sm"
|
177
|
-
/>
|
178
|
-
</button>
|
179
|
-
</Popover>
|
180
|
-
}
|
181
|
-
>
|
182
|
-
<div />
|
183
|
-
</mockConstructor>
|
184
|
-
</EffectiveUserPasswordField>
|
185
|
-
<ConcurrencyLevelField
|
186
|
-
setValue={[Function]}
|
187
|
-
value=""
|
188
|
-
>
|
189
|
-
<mockConstructor
|
190
|
-
fieldId="concurrency-level"
|
191
|
-
label="Concurrency level"
|
192
|
-
labelIcon={
|
193
|
-
<Popover
|
194
|
-
aria-label="help-text"
|
195
|
-
bodyContent="Run at most N tasks at a time. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
|
196
|
-
id="concurrency-level-help"
|
197
|
-
>
|
198
|
-
<button
|
199
|
-
aria-label="open-help-tooltip-button"
|
200
|
-
className="pf-c-form__group-label-help"
|
201
|
-
onClick={[Function]}
|
202
|
-
>
|
203
|
-
<HelpIcon
|
204
|
-
color="currentColor"
|
205
|
-
noVerticalAlign={true}
|
206
|
-
size="sm"
|
207
|
-
/>
|
208
|
-
</button>
|
209
|
-
</Popover>
|
210
|
-
}
|
211
|
-
>
|
212
|
-
<div />
|
213
|
-
</mockConstructor>
|
214
|
-
</ConcurrencyLevelField>
|
215
|
-
<TimeSpanLevelField
|
216
|
-
setValue={[Function]}
|
217
|
-
value=""
|
218
|
-
>
|
219
|
-
<mockConstructor
|
220
|
-
fieldId="time-span"
|
221
|
-
label="Time span"
|
222
|
-
labelIcon={
|
223
|
-
<Popover
|
224
|
-
aria-label="help-text"
|
225
|
-
bodyContent="Distribute execution over N seconds. If this is set and proxy batch triggering is enabled, then tasks are triggered on the smart proxy in batches of size 1."
|
226
|
-
id="time-span-help"
|
227
|
-
>
|
228
|
-
<button
|
229
|
-
aria-label="open-help-tooltip-button"
|
230
|
-
className="pf-c-form__group-label-help"
|
231
|
-
onClick={[Function]}
|
232
|
-
>
|
233
|
-
<HelpIcon
|
234
|
-
color="currentColor"
|
235
|
-
noVerticalAlign={true}
|
236
|
-
size="sm"
|
237
|
-
/>
|
238
|
-
</button>
|
239
|
-
</Popover>
|
240
|
-
}
|
241
|
-
>
|
242
|
-
<div />
|
243
|
-
</mockConstructor>
|
244
|
-
</TimeSpanLevelField>
|
245
|
-
</form>
|
246
|
-
</Form>
|
247
|
-
</AdvancedFields>
|
248
|
-
</Provider>
|
249
|
-
`;
|