foreman_ansible 10.0.0 → 10.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (23) hide show
  1. checksums.yaml +4 -4
  2. data/app/graphql/types/ansible_variable_override.rb +1 -1
  3. data/app/helpers/foreman_ansible/smart_proxies_helper.rb +38 -0
  4. data/app/views/foreman/smart_proxies/_update_smart_proxy.html.erb +1 -0
  5. data/app/views/foreman_ansible/job_templates/capsule_upgrade_-_ansible_default.erb +39 -3
  6. data/db/migrate/20221031114720_rename_capsule_upgrade_playbook.rb +21 -0
  7. data/lib/foreman_ansible/register.rb +14 -1
  8. data/lib/foreman_ansible/version.rb +1 -1
  9. data/test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb +7 -7
  10. data/test/graphql/queries/host_ansible_roles_query_test.rb +11 -8
  11. data/test/unit/ansible_provider_test.rb +3 -6
  12. data/test/unit/concerns/host_managed_extensions_test.rb +6 -6
  13. data/test/unit/concerns/hostgroup_extensions_test.rb +8 -8
  14. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/AnsibleVariableOverridesTableHelper.js +1 -0
  15. data/webpack/components/AnsibleHostDetail/components/AnsibleVariableOverrides/EditableValue.js +4 -2
  16. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobHelper.js +4 -4
  17. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.js +30 -4
  18. data/webpack/components/AnsibleHostDetail/components/JobsTab/NewRecurringJobModal.scss +9 -2
  19. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/index.js +1 -1
  20. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +1 -1
  21. metadata +14 -15
  22. data/test/unit/actions/run_ansible_job_test.rb +0 -0
  23. data/test/unit/actions/run_proxy_ansible_command_test.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3141b6325f66438c16c630fc728eb9bb7f381ade6987491cbc62fa98d911e83b
4
- data.tar.gz: 68f84c9a0251af1aa1a284c5ae509008d24c9d68802097b50aa700f407d5cabb
3
+ metadata.gz: f66c95bc367d1265d1be106e25a63a8fcfae2b95fd8d209f683c260c8d0d3647
4
+ data.tar.gz: cfad57982a9e2cf39324caf14f656df50148cd451dba92e963cbd54dd22a8875
5
5
  SHA512:
6
- metadata.gz: d62e5e435516a8cef1dc345663d735a767b0b2150ac2c0938fd278e1466d7d1c15428cad48b9313d86902ac10acc00bb34fdadc2337456ed5bf52acb1aaad94e
7
- data.tar.gz: 881639c08f95a3cf8771bbf20d74d3410b2caef5e25c4f000e414faf7d4292f365ed4a22ec8edebc3c357d89efd10f8b3ae41bfbb7eeca4e9ea894867c020b0f
6
+ metadata.gz: 340ab3cb55ecc5c54eb76f483e5e6b24e677831488dad250fd4c4b58ac33f37c7cdd27445246a95594d5f17db091e2df3445f3266c97dbd26dba34ecc88879ab
7
+ data.tar.gz: f50cb95108f5809cc30b8fdb6627b041d3261949c98fe15e149cef799e5e98ddea3955b39d642de6f1625817ce5e2e1e7e3314b3e59c6e6cb7788e8c59ad0fe3
@@ -1,5 +1,5 @@
1
1
  module Types
2
- class AnsibleVariableOverride < GraphQL::Types::Relay::BaseObject
2
+ class AnsibleVariableOverride < GraphQL::Schema::Object
3
3
  description 'Override value for Ansible Variable'
4
4
 
5
5
  field :value, ::Types::RawJson, :null => false
@@ -0,0 +1,38 @@
1
+ module ForemanAnsible
2
+ module SmartProxiesHelper
3
+ def can_update_proxy?(proxy)
4
+ hosts = proxy.smart_proxy_hosts
5
+
6
+ return if !can_schedule_jobs? ||
7
+ hosts.empty? ||
8
+ !hosts.all? { |host| can_execute_on_host?(host) }
9
+
10
+ begin
11
+ version = proxy.statuses[:version].version
12
+ rescue Foreman::Exception
13
+ return false
14
+ end
15
+
16
+ foreman_version = Foreman::Version.new
17
+ proxy_version = Foreman::Version.new(version['version'])
18
+
19
+ foreman_major = foreman_version.major.to_i
20
+ foreman_minor = foreman_version.minor.to_i
21
+
22
+ proxy_major = proxy_version.major.to_i
23
+ proxy_minor = proxy_version.minor.to_i
24
+
25
+ foreman_major > proxy_major ||
26
+ (foreman_major == proxy_major && foreman_minor > proxy_minor)
27
+ end
28
+
29
+ def proxy_update_button(proxy)
30
+ feature = RemoteExecutionFeature.feature(:ansible_run_capsule_upgrade)
31
+ return if feature.nil?
32
+
33
+ path = new_job_invocation_path(:host_ids => proxy.infrastructure_host_facets.pluck(:host_id),
34
+ :feature => feature.label)
35
+ link_to(_('Upgrade'), path)
36
+ end
37
+ end
38
+ end
@@ -0,0 +1 @@
1
+ <%= proxy_update_button(subject) %>
@@ -1,9 +1,9 @@
1
1
  <%#
2
- name: Capsule Upgrade Playbook
2
+ name: Smart Proxy Upgrade Playbook
3
3
  snippet: false
4
4
  template_inputs:
5
5
  - name: target_version
6
- required: true
6
+ required: false
7
7
  input_type: user
8
8
  advanced: false
9
9
  value_type: plain
@@ -24,6 +24,9 @@ feature: ansible_run_capsule_upgrade
24
24
 
25
25
  ---
26
26
  - hosts: all
27
+ vars:
28
+ target_version: "<%= input('target_version').present? ? input('target_version') : product_short_version %>"
29
+ <% if plugin_present?('foreman_theme_satellite') -%>
27
30
  tasks:
28
31
  - name: Gather the rpm package facts
29
32
  package_facts:
@@ -44,7 +47,7 @@ feature: ansible_run_capsule_upgrade
44
47
  "--whitelist=#{input('whitelist_options')}"
45
48
  end -%>
46
49
  - name: Upgrade Capsule server using satellite-maintain
47
- shell: satellite-maintain upgrade run --assumeyes --target-version=<%= input('target_version') %> <%= whitelist_option %>
50
+ shell: satellite-maintain upgrade run --assumeyes --target-version={{ target_version }} <%= whitelist_option %>
48
51
  register: result
49
52
 
50
53
  - name: Re-Gather the rpm package facts after the upgrade
@@ -71,3 +74,36 @@ feature: ansible_run_capsule_upgrade
71
74
  - name: satellite-maintain upgrade return code is non-zero
72
75
  fail:
73
76
  msg: "Failed! Capsule server upgrade failed. See /var/log/foreman-installer/capsule.log in the Capsule server for more information"
77
+ <% else -%>
78
+ tasks:
79
+ - name: Gather the rpm package facts
80
+ package_facts:
81
+ manager: auto
82
+
83
+ - name: Fail if the target server is a Foreman server
84
+ fail:
85
+ msg: "This playbook cannot be executed on a Foreman server. Use only on a Smart Proxy server."
86
+ when: "'foreman' in ansible_facts.packages"
87
+
88
+ - name: Install foreman release gpg key
89
+ rpm_key:
90
+ state: present
91
+ key: http://yum.theforeman.org/releases/{{ target_version }}/RPM-GPG-KEY-foreman
92
+ when: target_version != "nightly"
93
+
94
+ - name: Update foreman repositories
95
+ package:
96
+ name: https://yum.theforeman.org/releases/{{ target_version }}/el{{ ansible_distribution_major_version }}/{{ ansible_architecture }}/foreman-release.rpm
97
+ state: installed
98
+
99
+ - name: Clean yum metadata
100
+ command: yum clean all
101
+
102
+ - name: Update all packages
103
+ package:
104
+ name: '*'
105
+ state: latest
106
+
107
+ - name: Run the installer
108
+ shell: foreman-installer
109
+ <% end -%>
@@ -0,0 +1,21 @@
1
+ class RenameCapsuleUpgradePlaybook < ActiveRecord::Migration[6.0]
2
+ MAPPING = {
3
+ 'Capsule Upgrade Playbook' => 'Smart Proxy Upgrade Playbook'
4
+ }.freeze
5
+
6
+ def up
7
+ rename(MAPPING)
8
+ end
9
+
10
+ def down
11
+ rename(MAPPING.invert)
12
+ end
13
+
14
+ private
15
+
16
+ def rename(mapping)
17
+ mapping.each do |old, new|
18
+ Template.where(name: old).update_all(name: new)
19
+ end
20
+ end
21
+ end
@@ -188,7 +188,7 @@ Foreman::Plugin.register :foreman_ansible do
188
188
  register_global_js_file 'global'
189
189
 
190
190
  extend_graphql_type :type => '::Types::Host' do
191
- field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :method => :present_all_ansible_roles
191
+ field :all_ansible_roles, ::Types::InheritedAnsibleRole.connection_type, :null => true, :resolver_method => :present_all_ansible_roles
192
192
  field :own_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
193
193
  field :available_ansible_roles, ::Types::AnsibleRole.connection_type, :null => true
194
194
  field :ansible_variables_with_overrides, Types::OverridenAnsibleVariable.connection_type, :null => false
@@ -244,4 +244,17 @@ Foreman::Plugin.register :foreman_ansible do
244
244
  describe_hostgroup do
245
245
  hostgroup_actions_provider :ansible_hostgroups_actions
246
246
  end
247
+
248
+ extend_page('smart_proxies/show') do |context|
249
+ context.add_pagelet :smart_proxy_title_actions,
250
+ :name => _('Update Smart Proxy'),
251
+ :partial => 'foreman/smart_proxies/update_smart_proxy',
252
+ :onlyif => ->(proxy, view) { view.can_update_proxy?(proxy) }
253
+ end
254
+ extend_page('smart_proxies/index') do |context|
255
+ context.add_pagelet :smart_proxy_title_actions,
256
+ :name => _('Update Smart Proxy'),
257
+ :partial => 'foreman/smart_proxies/update_smart_proxy',
258
+ :onlyif => ->(proxy, view) { view.can_update_proxy?(proxy) }
259
+ end
247
260
  end
@@ -4,5 +4,5 @@
4
4
  # This way other parts of Foreman can just call ForemanAnsible::VERSION
5
5
  # and detect what version the plugin is running.
6
6
  module ForemanAnsible
7
- VERSION = '10.0.0'
7
+ VERSION = '10.1.0'
8
8
  end
@@ -3,15 +3,15 @@ require 'test_plugin_helper'
3
3
  module Mutations
4
4
  module Hosts
5
5
  class CreateMutationTest < GraphQLQueryTestCase
6
- let(:tax_location) { FactoryBot.create(:location) }
6
+ let(:tax_location) { as_admin { FactoryBot.create(:location) } }
7
7
  let(:location_id) { Foreman::GlobalId.for(tax_location) }
8
- let(:organization) { FactoryBot.create(:organization) }
8
+ let(:organization) { as_admin { FactoryBot.create(:organization) } }
9
9
  let(:organization_id) { Foreman::GlobalId.for(organization) }
10
10
 
11
- let(:role1) { FactoryBot.create(:ansible_role) }
12
- let(:role2) { FactoryBot.create(:ansible_role) }
13
- let(:role3) { FactoryBot.create(:ansible_role) }
14
- let(:host) { FactoryBot.create(:host, :ansible_roles => [role1, role2, role3], :organization => organization, :location => tax_location) }
11
+ let(:role1) { as_admin { FactoryBot.create(:ansible_role) } }
12
+ let(:role2) { as_admin { FactoryBot.create(:ansible_role) } }
13
+ let(:role3) { as_admin { FactoryBot.create(:ansible_role) } }
14
+ let(:host) { as_admin { FactoryBot.create(:host, :ansible_roles => [role1, role2, role3], :organization => organization, :location => tax_location) } }
15
15
 
16
16
  let(:variables) { { id: Foreman::GlobalId.for(host), ansibleRoleIds: [role3.id, role2.id, role1.id] } }
17
17
  let(:query) do
@@ -37,7 +37,7 @@ module Mutations
37
37
  end
38
38
 
39
39
  context 'with admin permissions' do
40
- let(:context_user) { FactoryBot.create(:user, :admin) }
40
+ let(:context_user) { as_admin { FactoryBot.create(:user, :admin) } }
41
41
  let(:data) { result['data']['assignAnsibleRoles']['host'] }
42
42
 
43
43
  it 'reorderes ansible roles' do
@@ -37,13 +37,15 @@ module Queries
37
37
  let(:data) { result['data']['host']['allAnsibleRoles'] }
38
38
 
39
39
  it 'allows to fetch inherited roles' do
40
- value(data['totalCount']).must_equal(2)
40
+ assert_equal 2, data['totalCount']
41
+
41
42
  r1_data = data['nodes'].first
42
43
  r2_data = data['nodes'].second
43
- value(r1_data['name']).must_equal(role1.name)
44
- value(r1_data['inherited']).must_equal(true)
45
- value(r2_data['name']).must_equal(role2.name)
46
- value(r2_data['inherited']).must_equal(false)
44
+
45
+ assert_equal role1.name, r1_data['name']
46
+ assert r1_data['inherited']
47
+ assert_equal role2.name, r2_data['name']
48
+ assert_not r2_data['inherited']
47
49
  end
48
50
 
49
51
  it 'allow fetching variables' do
@@ -52,9 +54,10 @@ module Queries
52
54
  FactoryBot.create(:ansible_variable, ansible_role: role2, override: true)
53
55
  r1_vars = data['nodes'].first['ansibleVariables']
54
56
  r2_vars = data['nodes'].second['ansibleVariables']
55
- value(r1_vars['totalCount']).must_equal(2)
56
- value(r2_vars['totalCount']).must_equal(1)
57
- value(r1_vars['nodes'].first['key']).must_equal(var1.key)
57
+
58
+ assert_equal 2, r1_vars['totalCount']
59
+ assert_equal 1, r2_vars['totalCount']
60
+ assert_equal var1.key, r1_vars['nodes'].first['key']
58
61
  end
59
62
  end
60
63
  end
@@ -19,11 +19,8 @@ class AnsibleProviderTest < ActiveSupport::TestCase
19
19
  end
20
20
 
21
21
  context 'when it is using the ansible_run_host feature' do
22
- let(:rex_feature) do
23
- RemoteExecutionFeature.where(:label => 'ansible_run_host').first
24
- end
25
-
26
22
  it 'has remote_execution_command false' do
23
+ rex_feature = RemoteExecutionFeature.where(:label => 'ansible_run_host', :name => 'Run Ansible roles').first_or_create
27
24
  template_invocation.template.remote_execution_features << rex_feature
28
25
  assert_not command_options[:remote_execution_command]
29
26
  end
@@ -51,12 +48,12 @@ class AnsibleProviderTest < ActiveSupport::TestCase
51
48
  describe '#proxy_batch_size' do
52
49
  it 'returns integer if setting is string' do
53
50
  Setting.expects(:[]).with('foreman_ansible_proxy_batch_size').returns('10')
54
- _(ForemanAnsible::AnsibleProvider.proxy_batch_size).must_equal(10)
51
+ assert_equal 10, ForemanAnsible::AnsibleProvider.proxy_batch_size
55
52
  end
56
53
 
57
54
  it 'returns nil if setting is empty' do
58
55
  Setting.expects(:[]).with('foreman_ansible_proxy_batch_size').returns('')
59
- _(ForemanAnsible::AnsibleProvider.proxy_batch_size).must_equal(nil)
56
+ assert_nil ForemanAnsible::AnsibleProvider.proxy_batch_size
60
57
  end
61
58
  end
62
59
  end
@@ -18,23 +18,23 @@ class HostManagedExtensionsTest < ActiveSupport::TestCase
18
18
 
19
19
  describe '#all_ansible_roles' do
20
20
  test 'returns assigned roles for host without a hostgroup' do
21
- @host.all_ansible_roles.must_equal [@role1]
21
+ assert_equal [@role1], @host.all_ansible_roles
22
22
  end
23
23
 
24
24
  test 'returns assigned and inherited roles for host with a hostgroup' do
25
25
  @host.hostgroup = @hostgroup
26
- @host.all_ansible_roles.must_equal [@role2, @role1]
26
+ assert_equal [@role2, @role1], @host.all_ansible_roles
27
27
  end
28
28
  end
29
29
 
30
30
  describe '#inherited_ansible_roles' do
31
31
  test 'returns empty array for host without hostgroup' do
32
- @host.inherited_ansible_roles.must_equal []
32
+ assert_equal [], @host.inherited_ansible_roles
33
33
  end
34
34
 
35
35
  test 'returns roles inherited from a hostgroup' do
36
36
  @host.hostgroup = @hostgroup
37
- @host.inherited_ansible_roles.must_equal [@role2]
37
+ assert_equal [@role2], @host.inherited_ansible_roles
38
38
  end
39
39
  end
40
40
 
@@ -54,13 +54,13 @@ class HostManagedExtensionsTest < ActiveSupport::TestCase
54
54
  FactoryBot.create(:host_ansible_role, :ansible_role_id => @role1.id, :position => 1, :host_id => host.id)
55
55
  FactoryBot.create(:host_ansible_role, :ansible_role_id => @role2.id, :position => 2, :host_id => host.id)
56
56
  FactoryBot.create(:host_ansible_role, :ansible_role_id => @role3.id, :position => 0, :host_id => host.id)
57
- host.ansible_roles.must_equal [@role3, @role1, @role2]
57
+ assert_equal [@role3, @role1, @role2], host.ansible_roles
58
58
  end
59
59
 
60
60
  test 'should order hostgroup roles before host roles' do
61
61
  host = FactoryBot.create(:host, :hostgroup => @hostgroup)
62
62
  FactoryBot.create(:host_ansible_role, :ansible_role_id => @role1.id, :position => 0, :host_id => host.id)
63
- host.all_ansible_roles.must_equal [@role2, @role1]
63
+ assert_equal [@role2, @role1], host.all_ansible_roles
64
64
  end
65
65
 
66
66
  test 'should find hosts with role2' do
@@ -20,45 +20,45 @@ class HostgroupExtensionsTest < ActiveSupport::TestCase
20
20
  describe '#all_ansible_roles' do
21
21
  test 'returns assigned roles without any parent hostgroup' do
22
22
  @hostgroup.host_ansible_roles
23
- @hostgroup.all_ansible_roles.must_equal [@role1, @role3]
23
+ assert_equal [@role1, @role3], @hostgroup.all_ansible_roles
24
24
  end
25
25
 
26
26
  test 'returns assigned and inherited roles with from parent hostgroup' do
27
27
  @hostgroup.parent = @hostgroup_parent
28
- @hostgroup.all_ansible_roles.must_equal [@role2, @role1, @role3]
28
+ assert_equal [@role2, @role1, @role3], @hostgroup.all_ansible_roles
29
29
  end
30
30
  end
31
31
 
32
32
  describe '#inherited_ansible_roles' do
33
33
  test 'returns empty array for hostgroup without any parent' do
34
- @hostgroup.inherited_ansible_roles.must_equal []
34
+ assert_equal [], @hostgroup.inherited_ansible_roles
35
35
  end
36
36
 
37
37
  test 'returns roles inherited from a chain of parents' do
38
38
  @hostgroup.parent = @hostgroup_parent
39
- @hostgroup.inherited_ansible_roles.must_equal [@role2]
39
+ assert_equal [@role2], @hostgroup.inherited_ansible_roles
40
40
  end
41
41
  end
42
42
 
43
43
  describe '#inherited_and_own_ansible_roles' do
44
44
  test 'returns only hostgroup roles' do
45
- @hostgroup_parent.inherited_and_own_ansible_roles.must_equal [@role2]
45
+ assert_equal [@role2], @hostgroup_parent.inherited_and_own_ansible_roles
46
46
  end
47
47
 
48
48
  test 'returns only hostgroup roles including inheritance' do
49
49
  @hostgroup.parent = @hostgroup_parent
50
- @hostgroup.inherited_and_own_ansible_roles.must_equal [@role2, @role1]
50
+ assert_equal [@role2, @role1], @hostgroup.inherited_and_own_ansible_roles
51
51
  end
52
52
  end
53
53
 
54
54
  test 'should return ordered roles for hostgroup' do
55
55
  @hostgroup.parent = @hostgroup_parent
56
- @hostgroup.inherited_and_own_ansible_roles.must_equal [@role2, @role1]
56
+ assert_equal [@role2, @role1], @hostgroup.inherited_and_own_ansible_roles
57
57
  end
58
58
 
59
59
  describe '#cloned_ansibe_roles' do
60
60
  test 'clone ansible roles from hostgroup parent' do
61
- @hostgroup_parent.clone.all_ansible_roles.must_equal @hostgroup_parent.all_ansible_roles
61
+ assert_equal @hostgroup_parent.all_ansible_roles, @hostgroup_parent.clone.all_ansible_roles
62
62
  end
63
63
  end
64
64
 
@@ -23,6 +23,7 @@ export const formatValue = variable => {
23
23
  case 'yaml':
24
24
  case 'hash':
25
25
  case 'array':
26
+ case 'json':
26
27
  return JSON.stringify(value);
27
28
  default:
28
29
  return value;
@@ -17,11 +17,12 @@ const EditableValue = props => {
17
17
 
18
18
  const type = props.variable.parameterType;
19
19
 
20
- if (type === 'array' || type === 'hash') {
20
+ if (['json', 'yaml', 'array', 'hash'].includes(type)) {
21
21
  return (
22
22
  <TextAreaField
23
+ aria-label="Edit override field"
23
24
  onChange={props.onChange}
24
- value={props.value}
25
+ value={JSON.stringify(props.value)}
25
26
  validation={props.validation}
26
27
  isDisabled={props.working}
27
28
  />
@@ -31,6 +32,7 @@ const EditableValue = props => {
31
32
  if (type === 'boolean') {
32
33
  return (
33
34
  <SelectField
35
+ aria-label="Edit override field"
34
36
  selectItems={[
35
37
  { id: 'trueSelectOpt', value: true, name: __('true') },
36
38
  { id: 'falseSelectOpt', value: false, name: __('false') },
@@ -19,12 +19,12 @@ export const rangeValidator = date => {
19
19
  };
20
20
 
21
21
  export const createValidationSchema = () => {
22
- const cantBeBlank = __("can't be blank");
22
+ const required = __('Required field');
23
23
 
24
24
  return Yup.object().shape({
25
- repeat: Yup.string().required(cantBeBlank),
26
- startTime: Yup.string().required(cantBeBlank),
27
- startDate: Yup.string().required(cantBeBlank),
25
+ repeat: Yup.string().required(required),
26
+ startTime: Yup.string().required(required),
27
+ startDate: Yup.string().required(required),
28
28
  });
29
29
  };
30
30
 
@@ -1,5 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import { useDispatch } from 'react-redux';
4
+ import { push } from 'connected-react-router';
3
5
  import { Formik, Field as FormikField } from 'formik';
4
6
  import { useMutation } from '@apollo/client';
5
7
  import { translate as __ } from 'foremanReact/common/I18n';
@@ -33,6 +35,7 @@ import jobsQuery from '../../../../graphql/queries/recurringJobs.gql';
33
35
 
34
36
  const NewRecurringJobModal = props => {
35
37
  const { onClose, resourceId, resourceName } = props;
38
+ const dispatch = useDispatch();
36
39
 
37
40
  const [callMutation] = useMutation(createJobInvocation, {
38
41
  refetchQueries: [
@@ -81,10 +84,31 @@ const NewRecurringJobModal = props => {
81
84
  actions.push(<Spinner key="spinner" size="lg" />);
82
85
  }
83
86
 
87
+ const modalDescription = (
88
+ <>
89
+ {__('This job will run all the assigned Ansible roles.')}
90
+ <br />
91
+ {__('For more advanced scheduling options')}{' '}
92
+ <Button
93
+ variant="link"
94
+ isInline
95
+ onClick={() =>
96
+ dispatch(
97
+ push(`/job_invocations/new?host_ids%5B%5D=${resourceId}`)
98
+ )
99
+ }
100
+ key="schedule-job-action"
101
+ >
102
+ {__('view remote execution page.')}
103
+ </Button>
104
+ </>
105
+ );
106
+
84
107
  return (
85
108
  <Modal
86
- variant={ModalVariant.large}
87
- title="Create New Recurring Ansible Run"
109
+ variant={ModalVariant.small}
110
+ title={__('Schedule recurring Ansible roles job')}
111
+ description={modalDescription}
88
112
  ouiaId="modal-recurring-ansible-run"
89
113
  isOpen={props.isOpen}
90
114
  className="foreman-modal modal-high"
@@ -103,14 +127,16 @@ const NewRecurringJobModal = props => {
103
127
  <FormikField
104
128
  name="startTime"
105
129
  component={TimePickerField}
106
- label="Start Time"
130
+ label="Start time"
107
131
  isRequired
108
132
  is24Hour
133
+ width="250px"
134
+ menuAppendTo={() => document.body}
109
135
  />
110
136
  <FormikField
111
137
  name="startDate"
112
138
  component={DatePickerField}
113
- label="Start Date"
139
+ label="Start date"
114
140
  isRequired
115
141
  validators={[rangeValidator]}
116
142
  />
@@ -2,6 +2,13 @@
2
2
  z-index: 1040;
3
3
  }
4
4
 
5
- .modal-high {
6
- height: 70%;
5
+ .foreman-modal.modal-high {
6
+ height: 50vh;
7
+ @media only screen and (max-height: 960px) {
8
+ height: 70vh;
9
+ }
10
+
11
+ .pf-c-form-control, .pf-c-date-picker, .pf-c-date-picker__input {
12
+ width: 250px
13
+ }
7
14
  }
@@ -24,7 +24,7 @@ const AllRolesModal = ({ hostGlobalId, onClose, history }) => {
24
24
  title: __('All assigned Ansible roles'),
25
25
  disableFocusTrap: true,
26
26
  description: __(
27
- 'This list consists of host assigned roles and group assigned roles. Group assigned roles will always be executed prior to host assigned roles'
27
+ 'This list consists of host assigned roles and group assigned roles. Group assigned roles will always be executed prior to host assigned roles.'
28
28
  ),
29
29
  };
30
30
 
@@ -28,7 +28,7 @@ const EditRolesModal = ({
28
28
  title: __('Edit Ansible Roles'),
29
29
  disableFocusTrap: true,
30
30
  description: __(
31
- 'Add, remove or reorder host assigned Ansible roles. This host has also group assigned roles that are not displayed here and will always be executed prior to host assigned roles'
31
+ 'Add, remove or reorder host assigned Ansible roles. This host has also group assigned roles that are not displayed here and will always be executed prior to host assigned roles.'
32
32
  ),
33
33
  };
34
34
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.0
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Lobato Garcia
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-19 00:00:00.000000000 Z
11
+ date: 2022-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -42,30 +42,30 @@ dependencies:
42
42
  name: foreman_remote_execution
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 8.0.0
47
+ version: '8.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 8.0.0
54
+ version: '8.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: foreman-tasks
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 7.0.0
61
+ version: '7.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: 7.0.0
68
+ version: '7.0'
69
69
  description: Ansible integration with Foreman
70
70
  email:
71
71
  - elobatocs@gmail.com
@@ -115,6 +115,7 @@ files:
115
115
  - app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
116
116
  - app/helpers/foreman_ansible/ansible_roles_helper.rb
117
117
  - app/helpers/foreman_ansible/hosts_helper.rb
118
+ - app/helpers/foreman_ansible/smart_proxies_helper.rb
118
119
  - app/jobs/sync_playbooks.rb
119
120
  - app/jobs/sync_roles_and_variables.rb
120
121
  - app/lib/actions/foreman_ansible/helpers/play_roles_description.rb
@@ -171,6 +172,7 @@ files:
171
172
  - app/views/api/v2/ansible_variables/show.json.rabl
172
173
  - app/views/api/v2/hostgroups/ansible_roles.json.rabl
173
174
  - app/views/api/v2/hosts/ansible_roles.json.rabl
175
+ - app/views/foreman/smart_proxies/_update_smart_proxy.html.erb
174
176
  - app/views/foreman_ansible/ansible_roles/_select_tab_content.html.erb
175
177
  - app/views/foreman_ansible/ansible_roles/_select_tab_title.html.erb
176
178
  - app/views/foreman_ansible/api/v2/ansible_roles/import.json.rabl
@@ -215,6 +217,7 @@ files:
215
217
  - db/migrate/20200421201839_update_ansible_inv_template_name.rb
216
218
  - db/migrate/20210120150019_add_position_to_ansible_role.rb
217
219
  - db/migrate/20210818083407_fix_ansible_setting_category_to_dsl.rb
220
+ - db/migrate/20221031114720_rename_capsule_upgrade_playbook.rb
218
221
  - db/seeds.d/100_common_parameters.rb
219
222
  - db/seeds.d/62_ansible_proxy_feature.rb
220
223
  - db/seeds.d/75_job_templates.rb
@@ -290,8 +293,6 @@ files:
290
293
  - test/graphql/queries/host_ansible_roles_query_test.rb
291
294
  - test/integration/hostgroup_js_test.rb
292
295
  - test/test_plugin_helper.rb
293
- - test/unit/actions/run_ansible_job_test.rb
294
- - test/unit/actions/run_proxy_ansible_command_test.rb
295
296
  - test/unit/ansible_provider_test.rb
296
297
  - test/unit/ansible_role_test.rb
297
298
  - test/unit/ansible_variable_test.rb
@@ -487,9 +488,6 @@ test_files:
487
488
  - test/graphql/queries/ansible_roles_query_test.rb
488
489
  - test/graphql/queries/host_ansible_roles_query_test.rb
489
490
  - test/test_plugin_helper.rb
490
- - test/unit/actions/run_ansible_job_test.rb
491
- - test/unit/actions/run_proxy_ansible_command_test.rb
492
- - test/unit/ansible_provider_test.rb
493
491
  - test/unit/ansible_role_test.rb
494
492
  - test/unit/ansible_variable_test.rb
495
493
  - test/unit/concerns/config_reports_extensions_test.rb
@@ -510,4 +508,5 @@ test_files:
510
508
  - test/unit/services/override_resolver_test.rb
511
509
  - test/unit/services/roles_importer_test.rb
512
510
  - test/unit/services/ui_roles_importer_test.rb
511
+ - test/unit/ansible_provider_test.rb
513
512
  - test/integration/hostgroup_js_test.rb
File without changes
File without changes