foreman_patch 1.1.6.alpha4 → 1.2.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/foreman_patch/api/v2/invocations_controller.rb +1 -23
  3. data/app/controllers/foreman_patch/concerns/hosts_controller_extensions.rb +41 -35
  4. data/app/lib/actions/foreman_patch/cycle/complete.rb +41 -0
  5. data/app/lib/actions/foreman_patch/cycle/create.rb +1 -5
  6. data/app/lib/actions/foreman_patch/cycle/initiate.rb +1 -5
  7. data/app/lib/actions/foreman_patch/cycle/plan.rb +66 -0
  8. data/app/lib/actions/foreman_patch/invocation/action.rb +29 -23
  9. data/app/lib/actions/foreman_patch/invocation/patch.rb +8 -16
  10. data/app/lib/actions/foreman_patch/invocation/wait_for_host.rb +29 -4
  11. data/app/lib/actions/foreman_patch/round/patch.rb +1 -5
  12. data/app/lib/actions/foreman_patch/round/plan.rb +33 -0
  13. data/app/lib/actions/foreman_patch/window/plan.rb +43 -0
  14. data/app/lib/actions/foreman_patch/window/publish.rb +1 -5
  15. data/app/lib/actions/foreman_patch/window/resolve_hosts.rb +1 -5
  16. data/app/models/foreman_patch/invocation.rb +4 -4
  17. data/app/models/foreman_patch/round.rb +23 -4
  18. data/app/models/setting/patching.rb +57 -0
  19. data/app/services/foreman_patch/ticket/api.rb +1 -2
  20. data/app/views/foreman_patch/api/v2/invocations/base.json.rabl +1 -1
  21. data/app/views/foreman_patch/api/v2/invocations/phase.json.rabl +7 -0
  22. data/app/views/foreman_patch/api/v2/invocations/show.json.rabl +2 -2
  23. data/app/views/foreman_patch/api/v2/rounds/base.json.rabl +1 -1
  24. data/app/views/foreman_patch/api/v2/rounds/status.json.rabl +8 -2
  25. data/app/views/foreman_patch/groups/index.html.erb +1 -1
  26. data/app/views/foreman_patch/layouts/react.html.erb +1 -1
  27. data/app/views/templates/ensure_services.erb +4 -7
  28. data/config/api_routes.rb +24 -28
  29. data/config/routes/mount_engine.rb +3 -0
  30. data/config/routes/overrides.rb +10 -0
  31. data/config/routes.rb +29 -40
  32. data/db/seeds.d/100-assign_features_with_templates.rb +12 -6
  33. data/lib/foreman_patch/engine.rb +46 -11
  34. data/lib/foreman_patch/plugin.rb +47 -0
  35. data/lib/foreman_patch/version.rb +1 -1
  36. data/lib/foreman_patch.rb +2 -3
  37. data/locale/en/foreman_patch.po +1 -1
  38. data/locale/foreman_patch.pot +1 -1
  39. data/locale/gemspec.rb +1 -1
  40. data/package.json +9 -20
  41. data/public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss.gz +0 -0
  42. data/public/assets/foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss.gz +0 -0
  43. data/public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css +1 -0
  44. data/public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css.gz +0 -0
  45. data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css +1 -0
  46. data/public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css.gz +0 -0
  47. data/public/assets/foreman_patch/foreman_patch.json +1 -1
  48. data/public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js +1 -0
  49. data/public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js.gz +0 -0
  50. data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js +1 -0
  51. data/public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js.gz +0 -0
  52. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css.gz +0 -0
  53. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js +6 -0
  54. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.gz +0 -0
  55. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map +1 -0
  56. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map.gz +0 -0
  57. data/public/webpack/foreman_patch/{foreman_patch.css → foreman_patch-4a4e1a59d74af09c4b8b.css} +1 -1
  58. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css.gz +0 -0
  59. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js +6 -0
  60. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.gz +0 -0
  61. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map +1 -0
  62. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map.gz +0 -0
  63. data/public/webpack/foreman_patch/manifest.json +14 -13
  64. data/public/webpack/foreman_patch/manifest.json.gz +0 -0
  65. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js +2 -0
  66. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz +0 -0
  67. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map +1 -0
  68. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz +0 -0
  69. data/webpack/components/Invocation/Invocation.js +47 -0
  70. data/webpack/{src/Components → components}/Invocation/InvocationSelectors.js +3 -0
  71. data/webpack/components/Invocation/index.js +36 -0
  72. data/webpack/components/Invocations/Invocations.js +16 -48
  73. data/webpack/components/Invocations/InvocationsPage.js +1 -24
  74. data/webpack/components/Invocations/InvocationsSelectors.js +1 -1
  75. data/webpack/components/Invocations/components/{InvocationActions.js → InvocationItem.js} +16 -4
  76. data/webpack/components/Invocations/index.js +12 -95
  77. data/webpack/components/RoundProgress/AggregateStatus.js +5 -6
  78. data/webpack/components/RoundProgress/RoundProgress.js +6 -7
  79. data/webpack/components/RoundProgress/RoundProgressSelectors.js +2 -3
  80. data/webpack/components/common/Calendar/Calendar.js +4 -5
  81. data/webpack/components/common/Terminal/OutputLine.js +26 -0
  82. data/webpack/components/common/Terminal/Terminal.js +115 -0
  83. data/webpack/components/common/Terminal/Terminal.scss +47 -0
  84. data/webpack/index.js +0 -3
  85. metadata +92 -49
  86. data/app/controllers/foreman_patch/react_controller.rb +0 -12
  87. data/app/lib/actions/foreman_patch/invocation/process_logging.rb +0 -44
  88. data/app/lib/actions/foreman_patch/invocation/proxy_action.rb +0 -52
  89. data/app/models/foreman_patch/event.rb +0 -13
  90. data/app/views/foreman_patch/api/v2/invocations/event.json.rabl +0 -3
  91. data/db/migrate/20230706092400_nullify_group_on_delete.rb +0 -11
  92. data/db/migrate/20230707102800_create_invocation_events.rb +0 -16
  93. data/lib/foreman_patch/register.rb +0 -119
  94. data/public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss.gz +0 -0
  95. data/public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css +0 -11
  96. data/public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css.gz +0 -0
  97. data/public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css +0 -11
  98. data/public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css.gz +0 -0
  99. data/public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css +0 -82
  100. data/public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css.gz +0 -0
  101. data/public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js +0 -9
  102. data/public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js.gz +0 -0
  103. data/public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js +0 -9
  104. data/public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js.gz +0 -0
  105. data/public/webpack/foreman_patch/bundle.js +0 -34173
  106. data/public/webpack/foreman_patch/foreman_patch.js +0 -34366
  107. data/public/webpack/foreman_patch/foreman_patch:global.css +0 -1
  108. data/public/webpack/foreman_patch/foreman_patch:global.js +0 -32098
  109. data/public/webpack/foreman_patch/vendor.js +0 -5201
  110. data/webpack/components/common/Calendar/Calendar.css +0 -76
  111. data/webpack/components/common/Table/index.js +0 -28
  112. data/webpack/global_index.js +0 -16
  113. data/webpack/src/Components/Invocation/Invocation.js +0 -67
  114. data/webpack/src/Components/Invocation/InvocationLogFooter.js +0 -30
  115. data/webpack/src/Components/Invocation/InvocationLogToolbar.js +0 -80
  116. data/webpack/src/Components/Invocation/index.js +0 -62
  117. data/webpack/src/Components/InvocationStatus.js +0 -50
  118. data/webpack/src/Components/Loading.js +0 -51
  119. data/webpack/src/Extends/index.js +0 -15
  120. data/webpack/src/Router/routes.js +0 -5
  121. data/webpack/src/reducers.js +0 -7
  122. /data/public/webpack/foreman_patch/{bundle.css → bundle-e45c4bb530e40506f2da.css} +0 -0
  123. /data/webpack/{src/Components → components}/Invocation/InvocationActions.js +0 -0
  124. /data/webpack/{src/Components → components}/Invocation/InvocationConsts.js +0 -0
  125. /data/webpack/components/Invocations/{Invocations.css → InvocationsPage.scss} +0 -0
  126. /data/{public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss → webpack/components/common/Calendar/Calendar.scss} +0 -0
@@ -0,0 +1,115 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { Button } from 'patternfly-react';
4
+
5
+ import OutputLine from './OutputLine';
6
+ import './Terminal.scss';
7
+
8
+ class Terminal extends React.Component {
9
+ constructor(props) {
10
+ super(props);
11
+ this._currentColor = 'default';
12
+ this._colorMap = new Proxy({
13
+ '31': 'red',
14
+ '32': 'lightgreen',
15
+ '33': 'orange',
16
+ '34': 'deepskyblue',
17
+ '35': 'mediumpurple',
18
+ '36': 'cyan',
19
+ '37': 'grey',
20
+ '91': 'red',
21
+ '92': 'lightgreen',
22
+ '93': 'yellow',
23
+ '94': 'lightblue',
24
+ '95': 'violet',
25
+ '96': 'turquoise',
26
+ '0': 'default',
27
+ }, {
28
+ get: (target, name) => {
29
+ if name
30
+ return (target.hasOwnProperty(name) ? target[name] : 'default');
31
+ else
32
+ return this._currentColor;
33
+ }
34
+ });
35
+ }
36
+
37
+ scrollToBottom = () => {
38
+ window.scrollTo({
39
+ top: document.documentElement.scrollHeight,
40
+ behavior: 'smooth',
41
+ });
42
+ }
43
+
44
+ scollToTop = () => {
45
+ window.scrollTo({
46
+ top: 0,
47
+ behavior: 'smooth',
48
+ });
49
+ }
50
+
51
+ get lines() {
52
+ const { linesets } = this.props.linesets;
53
+
54
+ return linesets.flatMap(lineset => (
55
+ lineset.output.replace(/\r\n/,"\n").replace(/\n$/,'').split("\n").map(line => (
56
+ { output_type: lineset.output_type, output: line, timestamp: lineset.timestamp }
57
+ ))
58
+ ));
59
+ }
60
+
61
+ colorize(line) {
62
+ const pattern = /(?:\033\[(?:.*?)(?<color>\d+)m)?(?<text>[^\033]+)/g;
63
+
64
+ return (Array.from(line.matchAll(pattern), match => {
65
+ this._currentColor = this._colorMap[match.groups.color];
66
+ return (<span style={`color: ${this._currentColor}`}>{match.groups.text}</span>);
67
+ }));
68
+ }
69
+
70
+ getSnapshotBeforeUpdate(prevProps, prevState) {
71
+ return (window.scrollY + document.documentElement.clientHeight == document.documentElement.scrollHeight);
72
+ }
73
+
74
+ componentDidUpdate(prevProps, prevState, snapshot) {
75
+ if (snapshot) {
76
+ this.scrollToBottom();
77
+ }
78
+ }
79
+
80
+ render() {
81
+ const { lines } = this.props;
82
+
83
+ return (
84
+ <div className="terminal">
85
+ <Button variant="link" className="pull-right scroll-link-bottom" onClick={scrollToBottom}>
86
+ {__('Scroll to bottom')}
87
+ </Button>
88
+ <div className="printable">
89
+ {this.lines.map((line, index) => (
90
+ <OutputLine key={index} index={index} timestamp={line.timestamp} type={line.output_type}>
91
+ {this.colorize(line)}
92
+ </OutputLine>
93
+ ))}
94
+ </div>
95
+ <Button variant="link" className="pull-right scroll-link-top" onClick={scrollToTop}>
96
+ {__('Scroll to top')}
97
+ </Button>
98
+ </div>
99
+ );
100
+ }
101
+ }
102
+
103
+ Terminal.propTypes = {
104
+ linesets: PropTypes.array(PropTypes.shape({
105
+ output_type: PropTypes.string.isRequired,
106
+ output: PropTypes.string.isRequired,
107
+ timestamp: PropTypes.number.isRequired,
108
+ }),
109
+ };
110
+
111
+ Terminal.defaultProps = {
112
+ linesets: [],
113
+ };
114
+
115
+ export default Terminal;
@@ -0,0 +1,47 @@
1
+ div.terminal {
2
+ display: block;
3
+ padding: 9.5px;
4
+ margin: 0 0 10px;
5
+ font-size: 12px;
6
+ word-break: break-all;
7
+ word-wrap: break-word;
8
+ color: rgba(255, 255, 255, 1);
9
+ background-color: rgba(47, 47, 47, 1);
10
+ border: 1px solid #000000;
11
+ border-radius: 0px;
12
+ font-family: Menlo, Monaco, Consolas, monospace;
13
+
14
+ div.printable {
15
+ min-height: 50px;
16
+ }
17
+
18
+ div.line.stderr, div.line.error, div.line.debug {
19
+ color: red;
20
+ }
21
+
22
+ div.line span.counter {
23
+ float: left;
24
+ clear: left;
25
+ }
26
+
27
+ div.line div.content {
28
+ position: relative;
29
+ margin-left: 50px;
30
+ white-space: pre-wrap;
31
+ }
32
+
33
+ a {
34
+ color: #FFFFFF;
35
+ }
36
+
37
+ a.scroll-link-top {
38
+ position: relative;
39
+ bottom: 10px;
40
+ }
41
+
42
+ a.scroll-link-bottom {
43
+ position: relative;
44
+ z-index: 5;
45
+ }
46
+
47
+ }
data/webpack/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  /* eslint import/no-unresolved: [2, { ignore: [foremanReact/*] }] */
2
2
  /* eslint-disable import/no-extraneous-dependencies */
3
3
  /* eslint-disable import/extensions */
4
- /* eslint-disable import/no-unresolved */
5
4
  import componentRegistry from 'foremanReact/components/componentRegistry';
6
5
 
7
6
  import Rounds from './components/Rounds';
8
7
  import Plan from './components/Plan';
9
- import Invocation from './src/Components/Invocation';
10
8
  import Invocations from './components/Invocations';
11
9
  import RoundProgress from './components/RoundProgress';
12
10
  import Cycle from './components/Cycle';
@@ -17,7 +15,6 @@ const components = [
17
15
  { name: 'Invocations', type: Invocations },
18
16
  { name: 'Cycle', type: Cycle },
19
17
  { name: 'RoundProgress', type: RoundProgress },
20
- { name: 'Invocation', type: Invocation },
21
18
  ];
22
19
 
23
20
  components.forEach(component => componentRegistry.register(component));
metadata CHANGED
@@ -1,15 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_patch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6.alpha4
4
+ version: 1.2.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Galens
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-19 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: katello
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: foreman-tasks
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 5.2.3
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 5.2.3
41
+ - !ruby/object:Gem::Dependency
42
+ name: foreman_remote_execution
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 5.0.8
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 5.0.8
13
55
  description: Foreman Plugin for Managing Patching.
14
56
  email:
15
57
  - bogey.jlg@gmail.com
@@ -39,7 +81,6 @@ files:
39
81
  - app/controllers/foreman_patch/groups_controller.rb
40
82
  - app/controllers/foreman_patch/invocations_controller.rb
41
83
  - app/controllers/foreman_patch/plans_controller.rb
42
- - app/controllers/foreman_patch/react_controller.rb
43
84
  - app/controllers/foreman_patch/rounds_controller.rb
44
85
  - app/controllers/foreman_patch/ticket_fields_controller.rb
45
86
  - app/controllers/foreman_patch/window_plans_controller.rb
@@ -53,22 +94,24 @@ files:
53
94
  - app/helpers/foreman_patch/window_patching_helper.rb
54
95
  - app/helpers/foreman_patch/window_plans_helper.rb
55
96
  - app/helpers/foreman_patch/windows_helper.rb
97
+ - app/lib/actions/foreman_patch/cycle/complete.rb
56
98
  - app/lib/actions/foreman_patch/cycle/create.rb
57
99
  - app/lib/actions/foreman_patch/cycle/initiate.rb
100
+ - app/lib/actions/foreman_patch/cycle/plan.rb
58
101
  - app/lib/actions/foreman_patch/cycle/prepare_content.rb
59
102
  - app/lib/actions/foreman_patch/host/reschedule.rb
60
103
  - app/lib/actions/foreman_patch/invocation/action.rb
61
104
  - app/lib/actions/foreman_patch/invocation/patch.rb
62
- - app/lib/actions/foreman_patch/invocation/process_logging.rb
63
- - app/lib/actions/foreman_patch/invocation/proxy_action.rb
64
105
  - app/lib/actions/foreman_patch/invocation/reschedule.rb
65
106
  - app/lib/actions/foreman_patch/invocation/wait_for_host.rb
66
107
  - app/lib/actions/foreman_patch/round/add_missing_hosts.rb
67
108
  - app/lib/actions/foreman_patch/round/create.rb
68
109
  - app/lib/actions/foreman_patch/round/patch.rb
110
+ - app/lib/actions/foreman_patch/round/plan.rb
69
111
  - app/lib/actions/foreman_patch/round/resolve_hosts.rb
70
112
  - app/lib/actions/foreman_patch/window/create.rb
71
113
  - app/lib/actions/foreman_patch/window/patch.rb
114
+ - app/lib/actions/foreman_patch/window/plan.rb
72
115
  - app/lib/actions/foreman_patch/window/publish.rb
73
116
  - app/lib/actions/foreman_patch/window/resolve_hosts.rb
74
117
  - app/lib/actions/middleware/check_exit_status.rb
@@ -78,7 +121,6 @@ files:
78
121
  - app/models/foreman_patch/concerns/group_facet_host_extensions.rb
79
122
  - app/models/foreman_patch/concerns/host_managed_extensions.rb
80
123
  - app/models/foreman_patch/cycle.rb
81
- - app/models/foreman_patch/event.rb
82
124
  - app/models/foreman_patch/group.rb
83
125
  - app/models/foreman_patch/host/group_facet.rb
84
126
  - app/models/foreman_patch/invocation.rb
@@ -89,6 +131,7 @@ files:
89
131
  - app/models/foreman_patch/window.rb
90
132
  - app/models/foreman_patch/window_plan.rb
91
133
  - app/models/foreman_patch/window_task_group.rb
134
+ - app/models/setting/patching.rb
92
135
  - app/services/foreman_patch/cycle_name_generator.rb
93
136
  - app/services/foreman_patch/ticket.rb
94
137
  - app/services/foreman_patch/ticket/affected_items.rb
@@ -111,8 +154,8 @@ files:
111
154
  - app/views/foreman_patch/api/v2/groups/show.json.rabl
112
155
  - app/views/foreman_patch/api/v2/groups/update.json.rabl
113
156
  - app/views/foreman_patch/api/v2/invocations/base.json.rabl
114
- - app/views/foreman_patch/api/v2/invocations/event.json.rabl
115
157
  - app/views/foreman_patch/api/v2/invocations/index.json.rabl
158
+ - app/views/foreman_patch/api/v2/invocations/phase.json.rabl
116
159
  - app/views/foreman_patch/api/v2/invocations/show.json.rabl
117
160
  - app/views/foreman_patch/api/v2/plans/base.json.rabl
118
161
  - app/views/foreman_patch/api/v2/plans/create.json.rabl
@@ -193,6 +236,8 @@ files:
193
236
  - config/initializers/pagelets.rb
194
237
  - config/initializers/safemode_jail.rb
195
238
  - config/routes.rb
239
+ - config/routes/mount_engine.rb
240
+ - config/routes/overrides.rb
196
241
  - db/migrate/20210202161304_create_foreman_patch_plans.rb
197
242
  - db/migrate/20210202163323_create_foreman_patch_cycles.rb
198
243
  - db/migrate/20210202164301_create_foreman_patch_groups.rb
@@ -215,14 +260,12 @@ files:
215
260
  - db/migrate/20220406110705_add_window_state.rb
216
261
  - db/migrate/20220407161120_add_round_status.rb
217
262
  - db/migrate/20220902134800_add_invocation_status.rb
218
- - db/migrate/20230706092400_nullify_group_on_delete.rb
219
- - db/migrate/20230707102800_create_invocation_events.rb
220
263
  - db/seeds.d/100-assign_features_with_templates.rb
221
264
  - db/seeds.d/160-mail_notifications.rb
222
265
  - db/seeds.d/75-job_templates.rb
223
266
  - lib/foreman_patch.rb
224
267
  - lib/foreman_patch/engine.rb
225
- - lib/foreman_patch/register.rb
268
+ - lib/foreman_patch/plugin.rb
226
269
  - lib/foreman_patch/version.rb
227
270
  - lib/tasks/foreman_patch_tasks.rake
228
271
  - locale/Makefile
@@ -230,31 +273,37 @@ files:
230
273
  - locale/foreman_patch.pot
231
274
  - locale/gemspec.rb
232
275
  - package.json
233
- - public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss
234
- - public/assets/foreman_patch/calendar-b5391efda77239c4a4894e9f03f34610f6c8e2e748b2a147febfea814b857cdc.scss.gz
235
276
  - public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss
236
277
  - public/assets/foreman_patch/cycle_plans-e5667e178ba389908f5c815b24ec0ea77c340849d56bc39c5ce72bb626bd446a.scss.gz
237
278
  - public/assets/foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss
238
279
  - public/assets/foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss.gz
239
- - public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css
240
- - public/assets/foreman_patch/foreman_patch-410cf04bf9b09e65fee034cc3f2dd74acf2524abf881c6d6e559d5c62a615faf.css.gz
241
- - public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css
242
- - public/assets/foreman_patch/foreman_patch-84845e54f06d3a11189828e656432d587c7312358cdf694753da7b78b7dabcee.css.gz
243
- - public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css
244
- - public/assets/foreman_patch/foreman_patch-a76c5fd10a5795e97c5ae4c222bfdf4ab88da49d6a7659175dba79f8fc62ab47.css.gz
280
+ - public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css
281
+ - public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css.gz
282
+ - public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css
283
+ - public/assets/foreman_patch/foreman_patch-ce5805a60c0d5f896f557ff5246e5a09172043004c850b39bea54e618df1c485.css.gz
245
284
  - public/assets/foreman_patch/foreman_patch.json
246
- - public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js
247
- - public/assets/foreman_patch/plan_edit_windows-2eb04c7e83fa62797b0a14364d3ff5b3c4336983603fdc5a276b5464eeba7e60.js.gz
248
- - public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js
249
- - public/assets/foreman_patch/plan_edit_windows-ddedd3e70fb6ef761f636be2b7b35286e86d68e126bfc37294f9365a5171a928.js.gz
250
- - public/webpack/foreman_patch/bundle.css
251
- - public/webpack/foreman_patch/bundle.js
252
- - public/webpack/foreman_patch/foreman_patch.css
253
- - public/webpack/foreman_patch/foreman_patch.js
254
- - public/webpack/foreman_patch/foreman_patch:global.css
255
- - public/webpack/foreman_patch/foreman_patch:global.js
285
+ - public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js
286
+ - public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js.gz
287
+ - public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js
288
+ - public/assets/foreman_patch/plan_edit_windows-e656ba411642a7f983b51958ab30ac49c056322d19295a603cff4d5e6c71c8ed.js.gz
289
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css
290
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css.gz
291
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js
292
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.gz
293
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map
294
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map.gz
295
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css
296
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css.gz
297
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js
298
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.gz
299
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map
300
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map.gz
256
301
  - public/webpack/foreman_patch/manifest.json
257
- - public/webpack/foreman_patch/vendor.js
302
+ - public/webpack/foreman_patch/manifest.json.gz
303
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js
304
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz
305
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map
306
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz
258
307
  - test/factories/foreman_patch_factories.rb
259
308
  - test/test_plugin_helper.rb
260
309
  - test/unit/foreman_patch_test.rb
@@ -269,13 +318,18 @@ files:
269
318
  - webpack/components/Groups/Groups.js
270
319
  - webpack/components/Groups/GroupsHelpers.js
271
320
  - webpack/components/Groups/Priority.js
272
- - webpack/components/Invocations/Invocations.css
321
+ - webpack/components/Invocation/Invocation.js
322
+ - webpack/components/Invocation/InvocationActions.js
323
+ - webpack/components/Invocation/InvocationConsts.js
324
+ - webpack/components/Invocation/InvocationSelectors.js
325
+ - webpack/components/Invocation/index.js
273
326
  - webpack/components/Invocations/Invocations.js
274
327
  - webpack/components/Invocations/InvocationsConstants.js
275
328
  - webpack/components/Invocations/InvocationsHelpers.js
276
329
  - webpack/components/Invocations/InvocationsPage.js
330
+ - webpack/components/Invocations/InvocationsPage.scss
277
331
  - webpack/components/Invocations/InvocationsSelectors.js
278
- - webpack/components/Invocations/components/InvocationActions.js
332
+ - webpack/components/Invocations/components/InvocationItem.js
279
333
  - webpack/components/Invocations/components/InvocationStatus.js
280
334
  - webpack/components/Invocations/index.js
281
335
  - webpack/components/Plan/Plan.js
@@ -299,8 +353,8 @@ files:
299
353
  - webpack/components/Rounds/components/RoundItem.js
300
354
  - webpack/components/Rounds/components/RoundStatus.js
301
355
  - webpack/components/Rounds/index.js
302
- - webpack/components/common/Calendar/Calendar.css
303
356
  - webpack/components/common/Calendar/Calendar.js
357
+ - webpack/components/common/Calendar/Calendar.scss
304
358
  - webpack/components/common/Calendar/CalendarConstants.js
305
359
  - webpack/components/common/Calendar/CalendarHelpers.js
306
360
  - webpack/components/common/Calendar/Day/index.js
@@ -312,21 +366,10 @@ files:
312
366
  - webpack/components/common/Calendar/View.js
313
367
  - webpack/components/common/Calendar/Week/index.js
314
368
  - webpack/components/common/Calendar/index.js
315
- - webpack/components/common/Table/index.js
316
- - webpack/global_index.js
369
+ - webpack/components/common/Terminal/OutputLine.js
370
+ - webpack/components/common/Terminal/Terminal.js
371
+ - webpack/components/common/Terminal/Terminal.scss
317
372
  - webpack/index.js
318
- - webpack/src/Components/Invocation/Invocation.js
319
- - webpack/src/Components/Invocation/InvocationActions.js
320
- - webpack/src/Components/Invocation/InvocationConsts.js
321
- - webpack/src/Components/Invocation/InvocationLogFooter.js
322
- - webpack/src/Components/Invocation/InvocationLogToolbar.js
323
- - webpack/src/Components/Invocation/InvocationSelectors.js
324
- - webpack/src/Components/Invocation/index.js
325
- - webpack/src/Components/InvocationStatus.js
326
- - webpack/src/Components/Loading.js
327
- - webpack/src/Extends/index.js
328
- - webpack/src/Router/routes.js
329
- - webpack/src/reducers.js
330
373
  homepage: https://github.com/ludovicus3/foreman_patch
331
374
  licenses:
332
375
  - GPL-3.0
@@ -337,9 +380,9 @@ require_paths:
337
380
  - lib
338
381
  required_ruby_version: !ruby/object:Gem::Requirement
339
382
  requirements:
340
- - - ">="
383
+ - - "~>"
341
384
  - !ruby/object:Gem::Version
342
- version: '0'
385
+ version: '2.5'
343
386
  required_rubygems_version: !ruby/object:Gem::Requirement
344
387
  requirements:
345
388
  - - ">"
@@ -1,12 +0,0 @@
1
- module ForemanPatch
2
- class ReactController < ::ApplicationController
3
- skip_before_action :authorize
4
-
5
- include Rails.application.routes.url_helpers
6
-
7
- def index
8
- render 'foreman_patch/layouts/react', layout: false
9
- end
10
- end
11
- end
12
-
@@ -1,44 +0,0 @@
1
- module Actions
2
- module ForemanPatch
3
- module Invocation
4
- module ProcessLogging
5
-
6
- def invocation
7
- @invocation ||= ::ForemanPatch::Invocation.find_by(task_id: task.id)
8
- end
9
-
10
- def log_invocation_event(event, type = 'debug', timestamp = Time.zone.now)
11
- last = invocation.events.order(:sequence).last
12
- sequence = last ? last.sequence + 1 : 0
13
- invocation.events.create!(
14
- event_type: type,
15
- event: event,
16
- timestamp: timestamp,
17
- sequence: sequence
18
- )
19
- end
20
-
21
- def log_invocation_exception(exception)
22
- last = invocation.events.order(:sequence).last
23
- sequence = last ? last.sequence + 1 : 0
24
- invocation.events.create!(
25
- event_type: 'debug',
26
- event: "#{exception.class}: #{exception.message}",
27
- timestamp: Time.zone.now,
28
- sequence: sequence
29
- )
30
- end
31
-
32
- def with_invocation_error_logging
33
- unless catch(::Dynflow::Action::ERROR) { yield || true }
34
- log_invocation_exception(error.exception)
35
- throw ::Dynflow::Action::ERROR
36
- end
37
- rescue => e
38
- log_invocation_exception(e)
39
- raise e
40
- end
41
- end
42
- end
43
- end
44
- end
@@ -1,52 +0,0 @@
1
- module Actions
2
- module ForemanPatch
3
- module Invocation
4
- class ProxyAction < ::Actions::ProxyAction
5
- include Actions::ForemanPatch::Invocation::ProcessLogging
6
-
7
- def on_data(data, meta = {})
8
- super
9
- process_proxy_data(output[:proxy_output])
10
- end
11
-
12
- def run(event = nil)
13
- with_invocation_error_logging { super }
14
- end
15
-
16
- private
17
-
18
- def get_proxy_data(response)
19
- data = super
20
- process_proxy_data(data)
21
- data
22
- end
23
-
24
- def process_proxy_data(data)
25
- events = data['result'].each_with_index.map do |update, idx|
26
- {
27
- sequence: update['sequence'] || idx,
28
- invocation_id: invocation.id,
29
- event: update['output'],
30
- timestamp: Time.at(update['timestamp']).getlocal,
31
- event_type: update['output_type'],
32
- }
33
- end
34
- if data['exit_status']
35
- last = events.last || { sequence: -1, timestamp: Time.zone.now }
36
- events << {
37
- sequence: last[:sequence] + 1,
38
- invocation_id: invocation.id,
39
- event: data['exit_status'],
40
- timestamp: last[:timestamp],
41
- event_type: 'exit',
42
- }
43
- end
44
- events.each_slice(1000) do |batch|
45
- ::ForemanPatch::Event.upsert_all(batch, unique_by: [:invocation_id, :sequence])
46
- end
47
- end
48
-
49
- end
50
- end
51
- end
52
- end
@@ -1,13 +0,0 @@
1
- module ForemanPatch
2
- class Event < ::ApplicationRecord
3
- belongs_to :invocation, class_name: 'ForemanPatch::Invocation'
4
-
5
- def as_raw_continuous_output
6
- raw = attibutes
7
- raw['output_type'] = raw.delete('event_type')
8
- raw['output'] = raw.delete('event')
9
- raw['timestamp'] = raw['timestamp'].to_f
10
- raw
11
- end
12
- end
13
- end
@@ -1,3 +0,0 @@
1
- object @event
2
-
3
- attributes :sequence, :event_type, :event, :meta, :timestamp
@@ -1,11 +0,0 @@
1
- class NullifyGroupOnDelete < ActiveRecord::Migration[6.0]
2
- def up
3
- remove_foreign_key :foreman_patch_rounds, name: :foreman_patch_rounds_by_group
4
- add_foreign_key :foreman_patch_rounds, :foreman_patch_groups, column: :group_id, name: :foreman_patch_rounds_by_group, on_delete: :nullify
5
- end
6
-
7
- def down
8
- remove_foreign_key :foreman_patch_rounds, name: :foreman_patch_rounds_by_group
9
- add_foreign_key :foreman_patch_rounds, :foreman_patch_groups, column: :group_id, name: :foreman_patch_rounds_by_group
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- class CreateInvocationEvents < ActiveRecord::Migration[6.0]
2
- def change
3
- create_table :foreman_patch_events do |t|
4
- t.bigint :invocation_id, null: false
5
- t.integer :sequence, null: false
6
- t.timestamp :timestamp, null: false
7
- t.string :event_type, null: false
8
- t.string :event, null: false
9
- t.string :meta
10
-
11
- t.index [:invocation_id, :sequence], unique: true, name: :foreman_patch_events_index
12
- end
13
-
14
- add_foreign_key :foreman_patch_events, :foreman_patch_invocations, column: :invocation_id, name: :foreman_patch_events_for_invocation, on_delete: :cascade
15
- end
16
- end