foreman_ansible 7.1.4 → 8.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_ansible/api/v2/hostgroups_controller_extensions.rb +5 -1
  3. data/app/controllers/foreman_ansible/api/v2/hosts_controller_extensions.rb +3 -1
  4. data/app/helpers/foreman_ansible/hosts_helper.rb +19 -0
  5. data/app/services/foreman_ansible/variables_importer.rb +9 -9
  6. data/app/views/api/v2/hostgroups/ansible_roles.json.rabl +9 -1
  7. data/app/views/api/v2/hosts/ansible_roles.json.rabl +9 -1
  8. data/config/routes.rb +3 -3
  9. data/lib/foreman_ansible/engine.rb +0 -1
  10. data/lib/foreman_ansible/register.rb +5 -1
  11. data/lib/foreman_ansible/version.rb +1 -1
  12. data/locale/action_names.rb +4 -3
  13. data/locale/ca/foreman_ansible.edit.po +0 -0
  14. data/locale/ca/foreman_ansible.po +360 -45
  15. data/locale/ca/foreman_ansible.po.time_stamp +0 -0
  16. data/locale/cs_CZ/foreman_ansible.edit.po +0 -0
  17. data/locale/cs_CZ/foreman_ansible.po +372 -57
  18. data/locale/cs_CZ/foreman_ansible.po.time_stamp +0 -0
  19. data/locale/de/foreman_ansible.edit.po +0 -0
  20. data/locale/de/foreman_ansible.po +355 -40
  21. data/locale/de/foreman_ansible.po.time_stamp +0 -0
  22. data/locale/en/foreman_ansible.edit.po +0 -0
  23. data/locale/en/foreman_ansible.po +355 -40
  24. data/locale/en/foreman_ansible.po.time_stamp +0 -0
  25. data/locale/en_GB/foreman_ansible.edit.po +0 -0
  26. data/locale/en_GB/foreman_ansible.po +357 -42
  27. data/locale/en_GB/foreman_ansible.po.time_stamp +0 -0
  28. data/locale/es/foreman_ansible.edit.po +0 -0
  29. data/locale/es/foreman_ansible.po +355 -40
  30. data/locale/es/foreman_ansible.po.time_stamp +0 -0
  31. data/locale/foreman_ansible.pot +767 -263
  32. data/locale/fr/foreman_ansible.edit.po +0 -0
  33. data/locale/fr/foreman_ansible.po +355 -40
  34. data/locale/fr/foreman_ansible.po.time_stamp +0 -0
  35. data/locale/gl/foreman_ansible.edit.po +0 -0
  36. data/locale/gl/foreman_ansible.po +358 -43
  37. data/locale/gl/foreman_ansible.po.time_stamp +0 -0
  38. data/locale/it/foreman_ansible.edit.po +0 -0
  39. data/locale/it/foreman_ansible.po +355 -40
  40. data/locale/it/foreman_ansible.po.time_stamp +0 -0
  41. data/locale/ja/foreman_ansible.edit.po +0 -0
  42. data/locale/ja/foreman_ansible.po +355 -40
  43. data/locale/ja/foreman_ansible.po.time_stamp +0 -0
  44. data/locale/ko/foreman_ansible.edit.po +0 -0
  45. data/locale/ko/foreman_ansible.po +355 -40
  46. data/locale/ko/foreman_ansible.po.time_stamp +0 -0
  47. data/locale/nl_NL/foreman_ansible.edit.po +0 -0
  48. data/locale/nl_NL/foreman_ansible.po +359 -44
  49. data/locale/nl_NL/foreman_ansible.po.time_stamp +0 -0
  50. data/locale/pl/foreman_ansible.edit.po +0 -0
  51. data/locale/pl/foreman_ansible.po +363 -48
  52. data/locale/pl/foreman_ansible.po.time_stamp +0 -0
  53. data/locale/pt_BR/foreman_ansible.edit.po +0 -0
  54. data/locale/pt_BR/foreman_ansible.po +355 -40
  55. data/locale/pt_BR/foreman_ansible.po.time_stamp +0 -0
  56. data/locale/ru/foreman_ansible.edit.po +0 -0
  57. data/locale/ru/foreman_ansible.po +355 -40
  58. data/locale/ru/foreman_ansible.po.time_stamp +0 -0
  59. data/locale/sv_SE/foreman_ansible.edit.po +0 -0
  60. data/locale/sv_SE/foreman_ansible.po +363 -48
  61. data/locale/sv_SE/foreman_ansible.po.time_stamp +0 -0
  62. data/locale/zh_CN/foreman_ansible.edit.po +0 -0
  63. data/locale/zh_CN/foreman_ansible.po +355 -40
  64. data/locale/zh_CN/foreman_ansible.po.time_stamp +0 -0
  65. data/locale/zh_TW/foreman_ansible.edit.po +0 -0
  66. data/locale/zh_TW/foreman_ansible.po +355 -40
  67. data/locale/zh_TW/foreman_ansible.po.time_stamp +0 -0
  68. data/webpack/components/AnsibleHostDetail/components/JobsTab/PreviousJobsTable.js.orig +0 -0
  69. data/webpack/components/AnsibleHostDetail/components/RolesTab/AllRolesModal/AllRolesTable.js +11 -1
  70. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/EditRolesForm.js +8 -10
  71. data/webpack/components/AnsibleHostDetail/components/RolesTab/EditRolesModal/index.js +1 -1
  72. data/webpack/components/AnsibleHostDetail/components/RolesTab/RolesTable.js +10 -1
  73. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/EditRoles.test.js +1 -2
  74. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.fixtures.js +30 -0
  75. data/webpack/components/AnsibleHostDetail/components/RolesTab/__test__/RolesTab.test.js +1 -3
  76. data/webpack/components/AnsibleHostDetail/components/RolesTab/index.js +2 -26
  77. data/webpack/components/AnsibleRolesSwitcher/components/AnsibleRole.js +3 -12
  78. data/webpack/components/AnsibleRolesSwitcher/components/OrderedRolesTooltip.js +11 -12
  79. data/webpack/components/AnsibleRolesSwitcher/components/__snapshots__/AnsibleRole.test.js.snap +6 -20
  80. data/webpack/graphql/queries/allAnsibleRoles.gql +3 -0
  81. data/webpack/graphql/queries/hostAnsibleRoles.gql +3 -0
  82. data/webpack/testHelper.js +3 -12
  83. metadata +35 -36
  84. data/app/helpers/foreman_ansible/hosts_helper_extensions.rb +0 -30
  85. data/lib/foreman_ansible/register.rb.orig +0 -257
@@ -15,7 +15,7 @@ import Pagination from 'foremanReact/components/Pagination';
15
15
  import withLoading from '../../../../withLoading';
16
16
 
17
17
  const AllRolesTable = ({ allAnsibleRoles, totalCount }) => {
18
- const columns = [__('Name'), __('Source')];
18
+ const columns = [__('Name'), __('Variables'), __('Source')];
19
19
 
20
20
  return (
21
21
  <React.Fragment>
@@ -37,6 +37,16 @@ const AllRolesTable = ({ allAnsibleRoles, totalCount }) => {
37
37
  <Tr key={`${role.id}-all`} id={role.id}>
38
38
  <Td />
39
39
  <Td>{role.name}</Td>
40
+ <Td>
41
+ <a
42
+ href={`/ansible/ansible_variables?search=ansible_role=${role.name}`}
43
+ target="_blank"
44
+ rel="noreferrer"
45
+ >
46
+ {role.ansibleVariables.totalCount}
47
+ </a>
48
+ </Td>
49
+
40
50
  <Td>
41
51
  {role.inherited
42
52
  ? __('Inherited from Hostgroup')
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { translate as __ } from 'foremanReact/common/I18n';
3
3
  import PropTypes from 'prop-types';
4
- import { isEqual } from 'lodash';
4
+
5
5
  import { useMutation } from '@apollo/client';
6
6
 
7
7
  import { Button, Modal, Spinner } from '@patternfly/react-core';
@@ -21,10 +21,12 @@ const EditRolesForm = props => {
21
21
  actions,
22
22
  } = props;
23
23
 
24
- const initAvailableOpt = availableRoles.map(item => item.name);
25
- const initChosenOpt = assignedRoles.map(item => item.name);
26
- const [availableOptions, setAvailableOptions] = useState(initAvailableOpt);
27
- const [chosenOptions, setChosenOptions] = useState(initChosenOpt);
24
+ const [availableOptions, setAvailableOptions] = useState(
25
+ availableRoles.map(item => item.name)
26
+ );
27
+ const [chosenOptions, setChosenOptions] = useState(
28
+ assignedRoles.map(item => item.name)
29
+ );
28
30
 
29
31
  const onListChange = (nextAvailable, nextChosen) => {
30
32
  setAvailableOptions(nextAvailable);
@@ -43,16 +45,12 @@ const EditRolesForm = props => {
43
45
  ansibleRoleIds: roleNamesToIds(allRoles, chosenOptions),
44
46
  };
45
47
 
46
- const didNotModifyOptions = () =>
47
- isEqual(initAvailableOpt.sort(), availableOptions.sort()) &&
48
- isEqual(initChosenOpt, chosenOptions); // The order of the chosen options is important.
49
-
50
48
  const formActions = [
51
49
  <Button
52
50
  key="confirm"
53
51
  variant="primary"
54
52
  onClick={() => callMutation({ variables })}
55
- isDisabled={loading || didNotModifyOptions()}
53
+ isDisabled={loading}
56
54
  aria-label="submit ansible roles"
57
55
  >
58
56
  {__('Confirm')}
@@ -20,7 +20,7 @@ const EditRolesModal = ({
20
20
  canEditHost,
21
21
  }) => {
22
22
  const baseModalProps = {
23
- width: '50%',
23
+ width: '70%',
24
24
  isOpen,
25
25
  className: 'foreman-modal',
26
26
  showClose: false,
@@ -27,7 +27,7 @@ const RolesTable = ({
27
27
  hostGlobalId,
28
28
  canEditHost,
29
29
  }) => {
30
- const columns = [__('Name')];
30
+ const columns = [__('Name'), __('Variables')];
31
31
 
32
32
  const editBtn = canEditHost ? (
33
33
  <FlexItem>
@@ -72,6 +72,15 @@ const RolesTable = ({
72
72
  <Td>
73
73
  <a href={role.path}>{role.name}</a>
74
74
  </Td>
75
+ <Td>
76
+ <a
77
+ href={`/ansible/ansible_variables?search=ansible_role=${role.name}`}
78
+ target="_blank"
79
+ rel="noreferrer"
80
+ >
81
+ {role.ansibleVariables.totalCount}
82
+ </a>
83
+ </Td>
75
84
  </Tr>
76
85
  ))}
77
86
  </Tbody>
@@ -21,8 +21,7 @@ import {
21
21
  assignRolesErrorMock,
22
22
  } from './RolesTab.fixtures';
23
23
 
24
- jest.mock('axios');
25
- const TestComponent = withRedux(withReactRouter(withMockedProvider(RolesTab)));
24
+ const TestComponent = withReactRouter(withRedux(withMockedProvider(RolesTab)));
26
25
 
27
26
  describe('assigning Ansible roles', () => {
28
27
  it('should assign Ansible roles', async () => {
@@ -35,6 +35,9 @@ const role1 = {
35
35
  id: 'MDE6QW5zaWJsZVJvbGUtMw==',
36
36
  name: 'aardvaark.cube',
37
37
  path: '/ansible/ansible_roles/search="name = aardvaark.cube"',
38
+ ansibleVariables: {
39
+ totalCount: 1,
40
+ },
38
41
  };
39
42
 
40
43
  const role2 = {
@@ -42,6 +45,9 @@ const role2 = {
42
45
  id: 'MDE6QW5zaWJsZVJvbGUtNQ==',
43
46
  name: 'aardvaark.sphere',
44
47
  path: '/ansible/ansible_roles/search="name = aardvaark.sphere"',
48
+ ansibleVariables: {
49
+ totalCount: 2,
50
+ },
45
51
  };
46
52
 
47
53
  const role3 = {
@@ -49,6 +55,9 @@ const role3 = {
49
55
  id: 'MDE6QW5zaWJsZVJvbGUtMzA=',
50
56
  name: 'another.role',
51
57
  path: '/ansible/ansible_roles/search="name = another.role"',
58
+ ansibleVariables: {
59
+ totalCount: 3,
60
+ },
52
61
  };
53
62
 
54
63
  const role4 = {
@@ -56,6 +65,9 @@ const role4 = {
56
65
  id: 'MDE6QW5zaWJsZVJvbGUtMzk=',
57
66
  name: 'geerlingguy.ceylon',
58
67
  path: '/ansible/ansible_roles/search="name = geerlingguy.ceylon"',
68
+ ansibleVariables: {
69
+ totalCount: 4,
70
+ },
59
71
  };
60
72
 
61
73
  const ansibleRolesMock = {
@@ -77,30 +89,45 @@ const availableRoles = {
77
89
  name: 'theforeman.foreman_scap_client',
78
90
  path:
79
91
  '/ansible/ansible_roles/search="name = theforeman.foreman_scap_client"',
92
+ ansibleVariables: {
93
+ totalCount: 23,
94
+ },
80
95
  },
81
96
  {
82
97
  __typename: 'AnsibleRole',
83
98
  id: 'MDE6QW5zaWJsZVJvbGUtMg==',
84
99
  name: 'adriagalin.motd',
85
100
  path: '/ansible/ansible_roles/search="name = adriagalin.motd"',
101
+ ansibleVariables: {
102
+ totalCount: 23,
103
+ },
86
104
  },
87
105
  {
88
106
  __typename: 'AnsibleRole',
89
107
  id: 'MDE6QW5zaWJsZVJvbGUtMjI=',
90
108
  name: 'geerlingguy.php',
91
109
  path: '/ansible/ansible_roles/search="name = geerlingguy.php"',
110
+ ansibleVariables: {
111
+ totalCount: 23,
112
+ },
92
113
  },
93
114
  {
94
115
  __typename: 'AnsibleRole',
95
116
  id: 'MDE6QW5zaWJsZVJvbGUtNTc=',
96
117
  name: 'robertdebock.epel',
97
118
  path: '/ansible/ansible_roles/search="name = robertdebock.epel"',
119
+ ansibleVariables: {
120
+ totalCount: 23,
121
+ },
98
122
  },
99
123
  {
100
124
  __typename: 'AnsibleRole',
101
125
  id: 'MDE6QW5zaWJsZVJvbGUtNTg=',
102
126
  name: 'geerlingguy.nfs',
103
127
  path: '/ansible/ansible_roles/search="name = geerlingguy.nfs"',
128
+ ansibleVariables: {
129
+ totalCount: 23,
130
+ },
104
131
  },
105
132
  ],
106
133
  };
@@ -118,6 +145,9 @@ export const allRolesMocks = allAnsibleRolesMockFactory(
118
145
  name: 'adriagalin.motd',
119
146
  path: '/ansible/ansible_roles/search="name = adriagalin.motd"',
120
147
  inherited: true,
148
+ ansibleVariables: {
149
+ totalCount: 23,
150
+ },
121
151
  },
122
152
  { ...role1, inherited: false },
123
153
  { ...role2, inherited: false },
@@ -6,7 +6,6 @@ import {
6
6
  tick,
7
7
  withMockedProvider,
8
8
  withReactRouter,
9
- withRedux,
10
9
  } from '../../../../../testHelper';
11
10
 
12
11
  import {
@@ -19,8 +18,7 @@ import {
19
18
 
20
19
  import RolesTab from '../';
21
20
 
22
- jest.mock('axios');
23
- const TestComponent = withRedux(withReactRouter(withMockedProvider(RolesTab)));
21
+ const TestComponent = withReactRouter(withMockedProvider(RolesTab));
24
22
 
25
23
  describe('RolesTab', () => {
26
24
  it('should load Ansible Roles as admin', async () => {
@@ -2,10 +2,7 @@ import React, { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useQuery } from '@apollo/client';
4
4
  import { Button } from '@patternfly/react-core';
5
- import { Link, Route } from 'react-router-dom';
6
5
  import { translate as __ } from 'foremanReact/common/I18n';
7
- import { foremanUrl } from 'foremanReact/common/helpers';
8
- import { useAPI } from 'foremanReact/common/hooks/API/APIHooks';
9
6
 
10
7
  import ansibleRolesQuery from '../../../../graphql/queries/hostAnsibleRoles.gql';
11
8
  import { encodeId } from '../../../../globalIdHelper';
@@ -15,7 +12,6 @@ import {
15
12
  useCurrentPagination,
16
13
  } from '../../../../helpers/pageParamsHelper';
17
14
  import EditRolesModal from './EditRolesModal';
18
- import AllRolesModal from './AllRolesModal';
19
15
 
20
16
  const RolesTab = ({ hostId, history, canEditHost }) => {
21
17
  const hostGlobalId = encodeId('Host', hostId);
@@ -37,28 +33,9 @@ const RolesTab = ({ hostId, history, canEditHost }) => {
37
33
  onClick={() => setAssignModal(true)}
38
34
  aria-label="edit ansible roles"
39
35
  >
40
- {__('Assign roles directly to the host')}
36
+ {__('Assign Ansible roles')}
41
37
  </Button>
42
38
  ) : null;
43
-
44
- const url = hostId && foremanUrl(`/api/v2/hosts/${hostId}/ansible_roles`);
45
- const { response: allAnsibleRoles } = useAPI('get', url, {
46
- key: 'ANSIBLE_ROLES',
47
- });
48
- const emptyStateDescription = allAnsibleRoles.length > 0 && (
49
- <>
50
- <Route path="/Ansible/roles/all">
51
- <AllRolesModal
52
- onClose={() => history.push('/Ansible/roles')}
53
- isOpen
54
- hostGlobalId={hostGlobalId}
55
- history={history}
56
- />
57
- </Route>
58
- <Link to="/Ansible/roles/all">{__('View inherited roles')}</Link>
59
- </>
60
- );
61
-
62
39
  return (
63
40
  <>
64
41
  <RolesTable
@@ -69,9 +46,8 @@ const RolesTab = ({ hostId, history, canEditHost }) => {
69
46
  history={history}
70
47
  hostGlobalId={hostGlobalId}
71
48
  emptyStateProps={{
72
- header: __('No roles assigned directly to the host'),
49
+ header: __('No Ansible roles assigned'),
73
50
  action: editBtn,
74
- description: emptyStateDescription,
75
51
  }}
76
52
  pagination={pagination}
77
53
  canEditHost={canEditHost}
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
- import { ListView, Tooltip, OverlayTrigger } from 'patternfly-react';
3
+ import { ListView } from 'patternfly-react';
4
+ import { Tooltip } from '@patternfly/react-core';
4
5
  import classNames from 'classnames';
5
6
  import { translate as __ } from 'foremanReact/common/I18n';
6
7
 
@@ -13,12 +14,6 @@ const AnsibleRole = ({ role, icon, onClick, resourceName, index }) => {
13
14
  ? __('This Ansible role is inherited from parent host group')
14
15
  : __('This Ansible role is inherited from host group');
15
16
 
16
- const tooltip = (
17
- <Tooltip id={role.id}>
18
- <span>{text}</span>
19
- </Tooltip>
20
- );
21
-
22
17
  const clickHandler = (onClickFn, ansibleRole) => event => {
23
18
  event.preventDefault();
24
19
  onClickFn(ansibleRole);
@@ -48,11 +43,7 @@ const AnsibleRole = ({ role, icon, onClick, resourceName, index }) => {
48
43
  );
49
44
 
50
45
  if (role.inherited) {
51
- return (
52
- <OverlayTrigger overlay={tooltip} placement="top">
53
- {listItem()}
54
- </OverlayTrigger>
55
- );
46
+ return <Tooltip content={<span>{text}</span>}>{listItem()}</Tooltip>;
56
47
  }
57
48
 
58
49
  return listItem(clickHandler);
@@ -1,22 +1,21 @@
1
1
  import React from 'react';
2
2
  import { translate as __ } from 'foremanReact/common/I18n';
3
- import { Tooltip, Icon, OverlayTrigger } from 'patternfly-react';
3
+ import { Tooltip } from '@patternfly/react-core';
4
+ import { InfoCircleIcon } from '@patternfly/react-icons';
4
5
 
5
6
  const OrderedRolesTooltip = props => {
6
- const tooltip = (
7
- <Tooltip id="assigned-ansible-roles-tooltip">
8
- <span>
9
- {__(
10
- 'Use drag and drop to change order of the roles. Ordering of roles is respected for Ansible runs, inherited roles are always before those assigned directly'
11
- )}
12
- </span>
13
- </Tooltip>
7
+ const content = (
8
+ <span>
9
+ {__(
10
+ 'Use drag and drop to change order of the roles. Ordering of roles is respected for Ansible runs, inherited roles are always before those assigned directly'
11
+ )}
12
+ </span>
14
13
  );
15
14
 
16
15
  return (
17
- <OverlayTrigger overlay={tooltip} trigger={['hover', 'focus']}>
18
- <Icon type="pf" name="info" style={{ 'margin-right': '10px' }} />
19
- </OverlayTrigger>
16
+ <Tooltip content={content}>
17
+ <InfoCircleIcon style={{ marginRight: '10px' }} />
18
+ </Tooltip>
20
19
  );
21
20
  };
22
21
 
@@ -65,25 +65,11 @@ exports[`AnsibleRole should render a role to remove 1`] = `
65
65
  `;
66
66
 
67
67
  exports[`AnsibleRole should render inherited role to remove 1`] = `
68
- <OverlayTrigger
69
- defaultOverlayShown={false}
70
- overlay={
71
- <Tooltip
72
- bsClass="tooltip"
73
- id={5}
74
- placement="right"
75
- >
76
- <span>
77
- This Ansible role is inherited from host group
78
- </span>
79
- </Tooltip>
80
- }
81
- placement="top"
82
- trigger={
83
- Array [
84
- "hover",
85
- "focus",
86
- ]
68
+ <Tooltip
69
+ content={
70
+ <span>
71
+ This Ansible role is inherited from host group
72
+ </span>
87
73
  }
88
74
  >
89
75
  <ListViewItem
@@ -104,5 +90,5 @@ exports[`AnsibleRole should render inherited role to remove 1`] = `
104
90
  onExpandClose={[Function]}
105
91
  stacked={true}
106
92
  />
107
- </OverlayTrigger>
93
+ </Tooltip>
108
94
  `;
@@ -7,6 +7,9 @@ query($id: String!, $first: Int, $last: Int){
7
7
  id
8
8
  name
9
9
  inherited
10
+ ansibleVariables {
11
+ totalCount
12
+ }
10
13
  }
11
14
  }
12
15
  }
@@ -9,6 +9,9 @@ query($id: String!, $first: Int, $last: Int) {
9
9
  id
10
10
  name
11
11
  path
12
+ ansibleVariables {
13
+ totalCount
14
+ }
12
15
  }
13
16
  }
14
17
  }
@@ -1,24 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Provider } from 'react-redux';
3
- import thunk from 'redux-thunk';
4
- import { applyMiddleware, createStore, compose, combineReducers } from 'redux';
5
3
  import { MockedProvider } from '@apollo/react-testing';
6
4
  import { Router, MemoryRouter } from 'react-router-dom';
7
5
  import { createMemoryHistory } from 'history';
8
6
 
9
- import { reducers as apiReducer, APIMiddleware } from 'foremanReact/redux/API';
10
- import ConfirmModal, {
11
- reducers as confirmModalReducers,
12
- } from 'foremanReact/components/ConfirmModal';
7
+ import store from 'foremanReact/redux';
8
+ import ConfirmModal from 'foremanReact/components/ConfirmModal';
13
9
  import { getForemanContext } from 'foremanReact/Root/Context/ForemanContext';
14
10
 
15
- const reducers = combineReducers({ ...apiReducer, ...confirmModalReducers });
16
-
17
- export const generateStore = () =>
18
- createStore(reducers, compose(applyMiddleware(thunk, APIMiddleware)));
19
-
20
11
  export const withRedux = Component => props => (
21
- <Provider store={generateStore()}>
12
+ <Provider store={store}>
22
13
  <Component {...props} />
23
14
  <ConfirmModal />
24
15
  </Provider>
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: 7.1.4
4
+ version: 8.0.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-13 00:00:00.000000000 Z
11
+ date: 2022-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: acts_as_list
@@ -113,7 +113,7 @@ files:
113
113
  - app/helpers/foreman_ansible/ansible_reports_helper.rb
114
114
  - app/helpers/foreman_ansible/ansible_roles_data_preparations.rb
115
115
  - app/helpers/foreman_ansible/ansible_roles_helper.rb
116
- - app/helpers/foreman_ansible/hosts_helper_extensions.rb
116
+ - app/helpers/foreman_ansible/hosts_helper.rb
117
117
  - app/jobs/sync_playbooks.rb
118
118
  - app/jobs/sync_roles_and_variables.rb
119
119
  - app/lib/actions/foreman_ansible/helpers/play_roles_description.rb
@@ -223,7 +223,6 @@ files:
223
223
  - lib/foreman_ansible.rb
224
224
  - lib/foreman_ansible/engine.rb
225
225
  - lib/foreman_ansible/register.rb
226
- - lib/foreman_ansible/register.rb.orig
227
226
  - lib/foreman_ansible/remote_execution.rb
228
227
  - lib/foreman_ansible/version.rb
229
228
  - locale/Makefile
@@ -496,55 +495,55 @@ required_rubygems_version: !ruby/object:Gem::Requirement
496
495
  - !ruby/object:Gem::Version
497
496
  version: '0'
498
497
  requirements: []
499
- rubygems_version: 3.1.6
498
+ rubygems_version: 3.3.7
500
499
  signing_key:
501
500
  specification_version: 4
502
501
  summary: Ansible integration with Foreman (theforeman.org)
503
502
  test_files:
504
- - test/factories/ansible_proxy.rb
505
- - test/factories/ansible_roles.rb
506
- - test/factories/ansible_variables.rb
507
- - test/factories/host_ansible_enhancements.rb
508
- - test/fixtures/insights_playbook.yaml
509
- - test/fixtures/playbooks_example_output.json
510
- - test/fixtures/report.json
511
- - test/fixtures/sample_facts.json
512
- - test/fixtures/sample_playbooks.json
513
- - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
514
- - test/functional/api/v2/ansible_inventories_controller_test.rb
515
503
  - test/functional/api/v2/ansible_playbooks_controller_test.rb
504
+ - test/functional/api/v2/hosts_controller_test.rb
516
505
  - test/functional/api/v2/ansible_roles_controller_test.rb
517
- - test/functional/api/v2/ansible_variables_controller_test.rb
518
506
  - test/functional/api/v2/hostgroups_controller_test.rb
519
- - test/functional/api/v2/hosts_controller_test.rb
507
+ - test/functional/api/v2/ansible_variables_controller_test.rb
508
+ - test/functional/api/v2/ansible_inventories_controller_test.rb
509
+ - test/functional/hosts_controller_test.rb
520
510
  - test/functional/ansible_roles_controller_test.rb
521
511
  - test/functional/ansible_variables_controller_test.rb
522
- - test/functional/hosts_controller_test.rb
523
512
  - test/functional/ui_ansible_roles_controller_test.rb
524
- - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
525
- - test/graphql/queries/ansible_roles_query_test.rb
526
- - test/graphql/queries/host_ansible_roles_query_test.rb
527
- - test/unit/actions/run_ansible_job_test.rb
528
- - test/unit/actions/run_proxy_ansible_command_test.rb
529
- - test/unit/concerns/config_reports_extensions_test.rb
530
- - test/unit/concerns/host_managed_extensions_test.rb
531
- - test/unit/concerns/hostgroup_extensions_test.rb
532
- - test/unit/helpers/ansible_reports_helper_test.rb
533
- - test/unit/lib/proxy_api/ansible_test.rb
513
+ - test/unit/services/inventory_creator_test.rb
534
514
  - test/unit/services/ansible_report_importer_test.rb
515
+ - test/unit/services/ui_roles_importer_test.rb
516
+ - test/unit/services/roles_importer_test.rb
535
517
  - test/unit/services/ansible_variables_importer_test.rb
518
+ - test/unit/services/override_resolver_test.rb
536
519
  - test/unit/services/api_roles_importer_test.rb
537
520
  - test/unit/services/insights_plan_runner_test.rb
538
- - test/unit/services/inventory_creator_test.rb
539
- - test/unit/services/override_resolver_test.rb
540
- - test/unit/services/roles_importer_test.rb
541
- - test/unit/services/ui_roles_importer_test.rb
542
- - test/unit/ansible_provider_test.rb
543
521
  - test/unit/ansible_role_test.rb
544
- - test/unit/ansible_variable_test.rb
545
522
  - test/unit/host_ansible_role_test.rb
523
+ - test/unit/import_playbooks_test.rb
546
524
  - test/unit/hostgroup_ansible_role_test.rb
525
+ - test/unit/helpers/ansible_reports_helper_test.rb
526
+ - test/unit/ansible_provider_test.rb
527
+ - test/unit/concerns/host_managed_extensions_test.rb
528
+ - test/unit/concerns/config_reports_extensions_test.rb
529
+ - test/unit/concerns/hostgroup_extensions_test.rb
547
530
  - test/unit/ignore_roles_test.rb
548
- - test/unit/import_playbooks_test.rb
531
+ - test/unit/ansible_variable_test.rb
549
532
  - test/unit/import_roles_and_variables.rb
533
+ - test/unit/lib/proxy_api/ansible_test.rb
534
+ - test/unit/actions/run_ansible_job_test.rb
535
+ - test/unit/actions/run_proxy_ansible_command_test.rb
536
+ - test/foreman_ansible/helpers/ansible_roles_helper_test.rb
550
537
  - test/test_plugin_helper.rb
538
+ - test/factories/ansible_proxy.rb
539
+ - test/factories/ansible_variables.rb
540
+ - test/factories/host_ansible_enhancements.rb
541
+ - test/factories/ansible_roles.rb
542
+ - test/fixtures/playbooks_example_output.json
543
+ - test/fixtures/report.json
544
+ - test/fixtures/sample_facts.json
545
+ - test/fixtures/insights_playbook.yaml
546
+ - test/fixtures/sample_playbooks.json
547
+ - test/graphql/mutations/hosts/assign_ansible_roles_mutation_test.rb
548
+ - test/graphql/queries/host_ansible_roles_query_test.rb
549
+ - test/graphql/queries/ansible_roles_query_test.rb
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module ForemanAnsible
4
- # Chained methods to extend the hosts menu with Ansible actions
5
- module HostsHelperExtensions
6
- extend ActiveSupport::Concern
7
-
8
- module Overrides
9
- def multiple_actions
10
- actions = super
11
- if User.current.can?(:create_job_invocations) &&
12
- User.current.can?(:play_roles_on_host)
13
- actions += [[_('Run all Ansible roles'),
14
- multiple_play_roles_hosts_path,
15
- false]]
16
- end
17
- actions
18
- end
19
- end
20
-
21
- included do
22
- prepend Overrides
23
- end
24
-
25
- def ansible_roles_present?(host)
26
- host.ansible_roles.present? ||
27
- host.inherited_ansible_roles.present?
28
- end
29
- end
30
- end