foreman_patch 1.1.6.alpha5 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) 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/helpers/foreman_patch/hosts_helper.rb +1 -1
  5. data/app/lib/actions/foreman_patch/cycle/complete.rb +41 -0
  6. data/app/lib/actions/foreman_patch/cycle/create.rb +1 -5
  7. data/app/lib/actions/foreman_patch/cycle/initiate.rb +1 -5
  8. data/app/lib/actions/foreman_patch/cycle/plan.rb +66 -0
  9. data/app/lib/actions/foreman_patch/invocation/action.rb +29 -23
  10. data/app/lib/actions/foreman_patch/invocation/patch.rb +8 -16
  11. data/app/lib/actions/foreman_patch/invocation/wait_for_host.rb +29 -4
  12. data/app/lib/actions/foreman_patch/round/patch.rb +1 -5
  13. data/app/lib/actions/foreman_patch/round/plan.rb +33 -0
  14. data/app/lib/actions/foreman_patch/window/plan.rb +43 -0
  15. data/app/lib/actions/foreman_patch/window/publish.rb +1 -5
  16. data/app/lib/actions/foreman_patch/window/resolve_hosts.rb +1 -5
  17. data/app/models/foreman_patch/invocation.rb +4 -4
  18. data/app/models/foreman_patch/round.rb +23 -4
  19. data/app/models/setting/patching.rb +57 -0
  20. data/app/services/foreman_patch/ticket/affected_items.rb +24 -3
  21. data/app/services/foreman_patch/ticket/api.rb +19 -16
  22. data/app/views/foreman_patch/api/v2/invocations/base.json.rabl +1 -1
  23. data/app/views/foreman_patch/api/v2/invocations/phase.json.rabl +7 -0
  24. data/app/views/foreman_patch/api/v2/invocations/show.json.rabl +2 -2
  25. data/app/views/foreman_patch/api/v2/rounds/base.json.rabl +1 -1
  26. data/app/views/foreman_patch/api/v2/rounds/status.json.rabl +8 -2
  27. data/app/views/foreman_patch/groups/index.html.erb +1 -1
  28. data/app/views/foreman_patch/invocations/show.html.erb +26 -1
  29. data/app/views/foreman_patch/layouts/react.html.erb +1 -1
  30. data/app/views/templates/ensure_services.erb +4 -7
  31. data/config/api_routes.rb +24 -28
  32. data/config/routes/mount_engine.rb +3 -0
  33. data/config/routes/overrides.rb +10 -0
  34. data/config/routes.rb +29 -40
  35. data/db/seeds.d/100-assign_features_with_templates.rb +12 -6
  36. data/lib/foreman_patch/engine.rb +46 -11
  37. data/lib/foreman_patch/plugin.rb +47 -0
  38. data/lib/foreman_patch/version.rb +1 -1
  39. data/lib/foreman_patch.rb +2 -3
  40. data/locale/en/foreman_patch.po +1 -1
  41. data/locale/foreman_patch.pot +1 -1
  42. data/locale/gemspec.rb +1 -1
  43. data/package.json +9 -20
  44. data/public/assets/foreman_patch/cycle_plans-ff3d252119622a68828ff70f4a97328303963002237dbf850e92d6a706e93667.scss.gz +0 -0
  45. data/public/assets/foreman_patch/foreman_patch-be2e2ba89548f4a490612e8a6cd1cdebc0473be89f8023a3df7612f05a75d301.css.gz +0 -0
  46. data/public/assets/foreman_patch/foreman_patch.json +1 -1
  47. data/public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js.gz +0 -0
  48. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js +6 -0
  49. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.gz +0 -0
  50. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map +1 -0
  51. data/public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map.gz +0 -0
  52. data/public/webpack/foreman_patch/{foreman_patch-8909c3e06f012a43f769.css → foreman_patch-4a4e1a59d74af09c4b8b.css} +1 -1
  53. data/public/webpack/foreman_patch/{foreman_patch-8909c3e06f012a43f769.css.gz → foreman_patch-4a4e1a59d74af09c4b8b.css.gz} +0 -0
  54. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js +6 -0
  55. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.gz +0 -0
  56. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map +1 -0
  57. data/public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map.gz +0 -0
  58. data/public/webpack/foreman_patch/manifest.json +8 -13
  59. data/public/webpack/foreman_patch/manifest.json.gz +0 -0
  60. data/public/webpack/foreman_patch/{vendor-769bd77f6be96c3c37e1.js → vendor-4b77c91f1e9103179596.js} +2 -2
  61. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz +0 -0
  62. data/public/webpack/foreman_patch/{vendor-769bd77f6be96c3c37e1.js.map → vendor-4b77c91f1e9103179596.js.map} +1 -1
  63. data/public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz +0 -0
  64. data/webpack/components/Invocation/Invocation.js +47 -0
  65. data/webpack/{src/Components → components}/Invocation/InvocationSelectors.js +3 -0
  66. data/webpack/components/Invocation/index.js +36 -0
  67. data/webpack/components/Invocations/Invocations.js +16 -48
  68. data/webpack/components/Invocations/InvocationsPage.js +1 -24
  69. data/webpack/components/Invocations/InvocationsSelectors.js +1 -1
  70. data/webpack/components/Invocations/components/{InvocationActions.js → InvocationItem.js} +16 -4
  71. data/webpack/components/Invocations/index.js +12 -95
  72. data/webpack/components/RoundProgress/AggregateStatus.js +5 -6
  73. data/webpack/components/RoundProgress/RoundProgress.js +6 -7
  74. data/webpack/components/RoundProgress/RoundProgressSelectors.js +2 -3
  75. data/webpack/components/common/Calendar/Calendar.js +4 -5
  76. data/webpack/components/common/Terminal/OutputLine.js +26 -0
  77. data/webpack/components/common/Terminal/Terminal.js +115 -0
  78. data/webpack/components/common/Terminal/Terminal.scss +47 -0
  79. data/webpack/index.js +0 -3
  80. metadata +90 -59
  81. data/app/controllers/foreman_patch/react_controller.rb +0 -12
  82. data/app/lib/actions/foreman_patch/invocation/process_logging.rb +0 -44
  83. data/app/lib/actions/foreman_patch/invocation/proxy_action.rb +0 -52
  84. data/app/models/foreman_patch/event.rb +0 -13
  85. data/app/views/foreman_patch/api/v2/invocations/event.json.rabl +0 -3
  86. data/db/migrate/20230706092400_nullify_group_on_delete.rb +0 -11
  87. data/db/migrate/20230707102800_create_invocation_events.rb +0 -16
  88. data/lib/foreman_patch/register.rb +0 -119
  89. data/public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js +0 -6
  90. data/public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.gz +0 -0
  91. data/public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.map +0 -1
  92. data/public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.map.gz +0 -0
  93. data/public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js +0 -6
  94. data/public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.gz +0 -0
  95. data/public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.map +0 -1
  96. data/public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.map.gz +0 -0
  97. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.css +0 -1
  98. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.css.gz +0 -0
  99. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js +0 -6
  100. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.gz +0 -0
  101. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.map +0 -1
  102. data/public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.map.gz +0 -0
  103. data/public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js.gz +0 -0
  104. data/public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js.map.gz +0 -0
  105. data/webpack/components/common/Table/index.js +0 -28
  106. data/webpack/global_index.js +0 -16
  107. data/webpack/src/Components/Invocation/Invocation.js +0 -67
  108. data/webpack/src/Components/Invocation/InvocationLogFooter.js +0 -30
  109. data/webpack/src/Components/Invocation/InvocationLogToolbar.js +0 -80
  110. data/webpack/src/Components/Invocation/index.js +0 -62
  111. data/webpack/src/Components/InvocationStatus.js +0 -50
  112. data/webpack/src/Components/Loading.js +0 -51
  113. data/webpack/src/Extends/index.js +0 -15
  114. data/webpack/src/Router/routes.js +0 -5
  115. data/webpack/src/reducers.js +0 -7
  116. /data/public/webpack/foreman_patch/{bundle-831173d6ae39953b2409.css → bundle-e45c4bb530e40506f2da.css} +0 -0
  117. /data/public/webpack/foreman_patch/{bundle-831173d6ae39953b2409.css.gz → bundle-e45c4bb530e40506f2da.css.gz} +0 -0
  118. /data/webpack/{src/Components → components}/Invocation/InvocationActions.js +0 -0
  119. /data/webpack/{src/Components → components}/Invocation/InvocationConsts.js +0 -0
  120. /data/webpack/components/Invocations/{Invocations.css → InvocationsPage.scss} +0 -0
  121. /data/webpack/components/common/Calendar/{Calendar.css → 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.alpha5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Galens
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-21 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2024-12-04 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
@@ -237,30 +280,24 @@ files:
237
280
  - public/assets/foreman_patch/foreman_patch.json
238
281
  - public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js
239
282
  - public/assets/foreman_patch/plan_edit_windows-9ba20f84f3ecf2c4eb903acd57d30ee3e16f023a79db30bc614aa22f26442ce3.js.gz
240
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.css
241
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.css.gz
242
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js
243
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.gz
244
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.map
245
- - public/webpack/foreman_patch/bundle-831173d6ae39953b2409.js.map.gz
246
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.css
247
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.css.gz
248
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js
249
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.gz
250
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.map
251
- - public/webpack/foreman_patch/foreman_patch-8909c3e06f012a43f769.js.map.gz
252
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.css
253
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.css.gz
254
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js
255
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.gz
256
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.map
257
- - public/webpack/foreman_patch/foreman_patch:global-d71cc6e1e759f04f631a.js.map.gz
283
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css
284
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.css.gz
285
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js
286
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.gz
287
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map
288
+ - public/webpack/foreman_patch/bundle-e45c4bb530e40506f2da.js.map.gz
289
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css
290
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.css.gz
291
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js
292
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.gz
293
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map
294
+ - public/webpack/foreman_patch/foreman_patch-4a4e1a59d74af09c4b8b.js.map.gz
258
295
  - public/webpack/foreman_patch/manifest.json
259
296
  - public/webpack/foreman_patch/manifest.json.gz
260
- - public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js
261
- - public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js.gz
262
- - public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js.map
263
- - public/webpack/foreman_patch/vendor-769bd77f6be96c3c37e1.js.map.gz
297
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js
298
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.gz
299
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map
300
+ - public/webpack/foreman_patch/vendor-4b77c91f1e9103179596.js.map.gz
264
301
  - test/factories/foreman_patch_factories.rb
265
302
  - test/test_plugin_helper.rb
266
303
  - test/unit/foreman_patch_test.rb
@@ -275,13 +312,18 @@ files:
275
312
  - webpack/components/Groups/Groups.js
276
313
  - webpack/components/Groups/GroupsHelpers.js
277
314
  - webpack/components/Groups/Priority.js
278
- - webpack/components/Invocations/Invocations.css
315
+ - webpack/components/Invocation/Invocation.js
316
+ - webpack/components/Invocation/InvocationActions.js
317
+ - webpack/components/Invocation/InvocationConsts.js
318
+ - webpack/components/Invocation/InvocationSelectors.js
319
+ - webpack/components/Invocation/index.js
279
320
  - webpack/components/Invocations/Invocations.js
280
321
  - webpack/components/Invocations/InvocationsConstants.js
281
322
  - webpack/components/Invocations/InvocationsHelpers.js
282
323
  - webpack/components/Invocations/InvocationsPage.js
324
+ - webpack/components/Invocations/InvocationsPage.scss
283
325
  - webpack/components/Invocations/InvocationsSelectors.js
284
- - webpack/components/Invocations/components/InvocationActions.js
326
+ - webpack/components/Invocations/components/InvocationItem.js
285
327
  - webpack/components/Invocations/components/InvocationStatus.js
286
328
  - webpack/components/Invocations/index.js
287
329
  - webpack/components/Plan/Plan.js
@@ -305,8 +347,8 @@ files:
305
347
  - webpack/components/Rounds/components/RoundItem.js
306
348
  - webpack/components/Rounds/components/RoundStatus.js
307
349
  - webpack/components/Rounds/index.js
308
- - webpack/components/common/Calendar/Calendar.css
309
350
  - webpack/components/common/Calendar/Calendar.js
351
+ - webpack/components/common/Calendar/Calendar.scss
310
352
  - webpack/components/common/Calendar/CalendarConstants.js
311
353
  - webpack/components/common/Calendar/CalendarHelpers.js
312
354
  - webpack/components/common/Calendar/Day/index.js
@@ -318,45 +360,34 @@ files:
318
360
  - webpack/components/common/Calendar/View.js
319
361
  - webpack/components/common/Calendar/Week/index.js
320
362
  - webpack/components/common/Calendar/index.js
321
- - webpack/components/common/Table/index.js
322
- - webpack/global_index.js
363
+ - webpack/components/common/Terminal/OutputLine.js
364
+ - webpack/components/common/Terminal/Terminal.js
365
+ - webpack/components/common/Terminal/Terminal.scss
323
366
  - webpack/index.js
324
- - webpack/src/Components/Invocation/Invocation.js
325
- - webpack/src/Components/Invocation/InvocationActions.js
326
- - webpack/src/Components/Invocation/InvocationConsts.js
327
- - webpack/src/Components/Invocation/InvocationLogFooter.js
328
- - webpack/src/Components/Invocation/InvocationLogToolbar.js
329
- - webpack/src/Components/Invocation/InvocationSelectors.js
330
- - webpack/src/Components/Invocation/index.js
331
- - webpack/src/Components/InvocationStatus.js
332
- - webpack/src/Components/Loading.js
333
- - webpack/src/Extends/index.js
334
- - webpack/src/Router/routes.js
335
- - webpack/src/reducers.js
336
367
  homepage: https://github.com/ludovicus3/foreman_patch
337
368
  licenses:
338
369
  - GPL-3.0
339
370
  metadata: {}
340
- post_install_message:
371
+ post_install_message:
341
372
  rdoc_options: []
342
373
  require_paths:
343
374
  - lib
344
375
  required_ruby_version: !ruby/object:Gem::Requirement
345
376
  requirements:
346
- - - ">="
377
+ - - "~>"
347
378
  - !ruby/object:Gem::Version
348
- version: '0'
379
+ version: '2.5'
349
380
  required_rubygems_version: !ruby/object:Gem::Requirement
350
381
  requirements:
351
- - - ">"
382
+ - - ">="
352
383
  - !ruby/object:Gem::Version
353
- version: 1.3.1
384
+ version: '0'
354
385
  requirements: []
355
386
  rubygems_version: 3.1.6
356
- signing_key:
387
+ signing_key:
357
388
  specification_version: 4
358
389
  summary: Foreman Plugin for Managing Patching
359
390
  test_files:
360
- - test/test_plugin_helper.rb
361
- - test/factories/foreman_patch_factories.rb
362
391
  - test/unit/foreman_patch_test.rb
392
+ - test/factories/foreman_patch_factories.rb
393
+ - test/test_plugin_helper.rb
@@ -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