foreman_snapshot_management 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +200 -2
  3. data/Rakefile +9 -2
  4. data/app/controllers/api/v2/snapshots_controller.rb +39 -7
  5. data/app/controllers/concerns/foreman/controller/parameters/snapshot.rb +2 -0
  6. data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +10 -7
  7. data/app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb +2 -0
  8. data/app/helpers/foreman_snapshot_management/snapshot_helper.rb +2 -0
  9. data/app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb +24 -0
  10. data/app/models/concerns/fog_extensions/vsphere/snapshots/mock.rb +2 -0
  11. data/app/models/concerns/fog_extensions/vsphere/snapshots/real.rb +4 -2
  12. data/app/models/foreman_snapshot_management/proxmox_extensions.rb +101 -0
  13. data/app/models/foreman_snapshot_management/snapshot.rb +36 -30
  14. data/app/models/foreman_snapshot_management/vmware_extensions.rb +42 -13
  15. data/app/views/api/v2/snapshots/base.json.rabl +4 -0
  16. data/app/views/api/v2/snapshots/create.json.rabl +2 -0
  17. data/app/views/api/v2/snapshots/destroy.json.rabl +2 -0
  18. data/app/views/api/v2/snapshots/index.json.rabl +2 -0
  19. data/app/views/api/v2/snapshots/main.json.rabl +4 -2
  20. data/app/views/api/v2/snapshots/revert.json.rabl +2 -0
  21. data/app/views/api/v2/snapshots/show.json.rabl +2 -0
  22. data/app/views/api/v2/snapshots/update.json.rabl +2 -0
  23. data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +12 -74
  24. data/app/views/{foreman_snapshot_management/hosts/_snapshots_tab_content.html.erb → hosts/_snapshots_tab.html.erb} +8 -0
  25. data/config/routes.rb +2 -0
  26. data/lib/foreman_snapshot_management.rb +2 -0
  27. data/lib/foreman_snapshot_management/engine.rb +56 -17
  28. data/lib/foreman_snapshot_management/version.rb +3 -1
  29. data/lib/tasks/foreman_snapshot_management_tasks.rake +31 -10
  30. data/locale/de/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  31. data/locale/de/foreman_snapshot_management.po +195 -0
  32. data/locale/en/LC_MESSAGES/foreman_snapshot_management.mo +0 -0
  33. data/locale/en/foreman_snapshot_management.edit.po +0 -0
  34. data/locale/en/foreman_snapshot_management.po +179 -11
  35. data/locale/foreman_snapshot_management.pot +259 -8
  36. data/locale/gemspec.rb +3 -1
  37. data/package.json +46 -0
  38. data/test/controllers/api/v2/snapshots_test.rb +252 -39
  39. data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +63 -9
  40. data/test/factories/proxmox_factory.rb +18 -0
  41. data/test/test_plugin_helper.rb +5 -0
  42. data/webpack/components/SnapshotManagement/SnapshotManagement.js +84 -0
  43. data/webpack/components/SnapshotManagement/SnapshotManagementActions.js +212 -0
  44. data/webpack/components/SnapshotManagement/SnapshotManagementConstants.js +9 -0
  45. data/webpack/components/SnapshotManagement/SnapshotManagementReducer.js +100 -0
  46. data/webpack/components/SnapshotManagement/SnapshotManagementSelectors.js +8 -0
  47. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementActions.test.js +123 -0
  48. data/webpack/components/SnapshotManagement/__tests__/SnapshotManagementReducer.test.js +157 -0
  49. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementActions.test.js.snap +314 -0
  50. data/webpack/components/SnapshotManagement/__tests__/__snapshots__/SnapshotManagementReducer.test.js.snap +214 -0
  51. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotForm.js +118 -0
  52. data/webpack/components/SnapshotManagement/components/SnapshotForm/SnapshotFormConstants.js +5 -0
  53. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/SnapshotForm.test.js +26 -0
  54. data/webpack/components/SnapshotManagement/components/SnapshotForm/__tests__/__snapshots__/SnapshotForm.test.js.snap +476 -0
  55. data/webpack/components/SnapshotManagement/components/SnapshotForm/index.js +19 -0
  56. data/webpack/components/SnapshotManagement/components/SnapshotForm/snapshotForm.scss +3 -0
  57. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModal.js +37 -0
  58. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/SnapshotFormModalConstants.js +1 -0
  59. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/SnapshotFormModal.test.js +19 -0
  60. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/__tests__/__snapshots__/SnapshotFormModal.test.js.snap +19 -0
  61. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/index.js +12 -0
  62. data/webpack/components/SnapshotManagement/components/SnapshotFormModal/useSnapshotFormModal.js +7 -0
  63. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotList.js +314 -0
  64. data/webpack/components/SnapshotManagement/components/SnapshotList/SnapshotListHelper.js +70 -0
  65. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/SnapshotList.test.js +88 -0
  66. data/webpack/components/SnapshotManagement/components/SnapshotList/__tests__/__snapshots__/SnapshotList.test.js.snap +1081 -0
  67. data/webpack/components/SnapshotManagement/components/SnapshotList/snapshotList.scss +13 -0
  68. data/webpack/components/SnapshotManagement/index.js +33 -0
  69. data/webpack/components/SnapshotManagement/snapshotManagement.scss +5 -0
  70. data/webpack/global_index.js +7 -0
  71. data/webpack/global_test_setup.js +11 -0
  72. data/webpack/index.js +8 -0
  73. data/webpack/reducers.js +7 -0
  74. data/webpack/test_setup.js +17 -0
  75. metadata +52 -54
  76. data/app/overrides/hosts/add_tab_to_host_overview.rb +0 -11
  77. data/app/views/foreman_snapshot_management/hosts/_snapshots_tab.html.erb +0 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d57bbba1e33d99aefa82a4af43d69810abd02fee0bd56a971083a6d83950bf5f
4
- data.tar.gz: f79a6a83310c1b0ee3f05ea2204cded44d690df624773ad642e88a9a323f372a
3
+ metadata.gz: b21ddce3f89248da10faf11e3c9ed617c68b9500be5ef2f0a4557462e670912c
4
+ data.tar.gz: e345def34460802d4491dded6341ff0089c733cbeb1ce7b925e321f0c8be8caf
5
5
  SHA512:
6
- metadata.gz: 40e538d6c79a89036baa265408dbeecd99ce7fcb2c4cb9693e1bc92111001f592e8ea13d003028160b366ce2332702e0c51fedb2c07ec2a6ecbaab99622d5d91
7
- data.tar.gz: a1c2345211c2d5eb3a2a6d63c74ca952d74351e014ad0f3b1957afcf6a5ba8dc3d3b9ddac69bd52344eeee235676f732f654d7bebfb46d9b69a655b0c904297f
6
+ metadata.gz: 70868762e401d992c5aeeda419491ccbe294f57c20bd87c4eab30c9bb7299da128f6f50a8ab640fcf83058fd62018c1aecd851ccde34b372656fb72b40e3179e
7
+ data.tar.gz: 2542bb32f1efb8ba220b8a63342313e73994990336252529a5496dc3f95dd8e5c8e41da322042042b617bb8f46bd213141821d94ea1cbfc19fdbd0c7b3210de1
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
- [![Build Status](https://travis-ci.org/ATIX-AG/foreman_snapshot_management.svg?branch=master)](https://travis-ci.org/ATIX-AG/foreman_snapshot_management)
1
+ [![React Testing](https://github.com/ATIX-AG/foreman_snapshot_management/actions/workflows/react.yml/badge.svg)](https://github.com/ATIX-AG/foreman_snapshot_management/actions/workflows/react.yml)
2
+ [![Ruby Testing](https://github.com/ATIX-AG/foreman_snapshot_management/actions/workflows/ruby.yml/badge.svg)](https://github.com/ATIX-AG/foreman_snapshot_management/actions/workflows/ruby.yml)
2
3
 
3
4
  # ForemanSnapshotManagement
4
5
 
5
6
  ForemanSnapshotManagement is a Foreman plugin to manage snapshots.
6
- As Hypervisor VMware vSphere is supported.
7
+ As Hypervisor the following systems are supported:
8
+ - VMware vSphere
9
+ - [Proxmox](https://www.proxmox.com/)
7
10
 
8
11
  ## Features
9
12
 
@@ -20,10 +23,205 @@ See [How_to_Install_a_Plugin](http://projects.theforeman.org/projects/foreman/wi
20
23
 
21
24
  | Foreman Version | Plugin Version |
22
25
  | --------------- | -------------- |
26
+ | 2.3 | >= 2.0.0 |
27
+ | 1.24 | >= 1.7.0 |
28
+ | 1.23 | >= 1.7.0 |
29
+ | 1.22 | >= 1.6.0 |
30
+ | 1.21 | >= 1.5.0 |
31
+ | 1.20 | >= 1.5.0 |
23
32
  | 1.19 | >= 1.5.0 |
24
33
  | 1.18 | >= 1.5.0 |
25
34
  | 1.17 | >= 1.5.0 |
26
35
 
36
+ ## Usage
37
+
38
+ You will get a new tab named "Snapshots" in the hosts page in Foreman.
39
+
40
+ Following rights are required to view snapshots:
41
+
42
+ - Snapshot Viewer
43
+ - Viewer
44
+
45
+ Following **additional** rights are required for creating, modifying, deleting and rollback:
46
+
47
+ - Snapshot Manger
48
+ - Site Manager
49
+
50
+ ## API usage examples
51
+
52
+ Documentation for the api v2 endpoints provided by this Plugin can be found at `https://<your.foreman.installation>/apidoc/v2/snapshots.html`.
53
+ Some examples using `curl` and `jq` are given here.
54
+
55
+ The api user requires the same rights as a normal one.
56
+
57
+ ### Environment
58
+
59
+ Environment variables used in this examples, edit to your needs.
60
+
61
+ ```bash
62
+ FOREMAN="foreman.example.lan" # fqdn or ip to foreman
63
+ AUTH="snapper:mysupersecretpassword123" # foreman user
64
+ HOST="vm001.example.lan" # the servers name or id
65
+ ```
66
+
67
+ ### List all snapshots
68
+
69
+ ```bash
70
+ curl -s -u "$AUTH" \
71
+ -H 'Accept: application/json' \
72
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots" \
73
+ | jq
74
+ ```
75
+
76
+ ```json
77
+ {
78
+ "total": 2,
79
+ "subtotal": 2,
80
+ "page": 1,
81
+ "per_page": 30,
82
+ "search": null,
83
+ "sort": {
84
+ "by": null,
85
+ "order": null
86
+ },
87
+ "results": [
88
+ {
89
+ "description": "",
90
+ "id": "snapshot-646",
91
+ "name": "clean",
92
+ "created_at": "2018-10-08 08:07:30 UTC",
93
+ "parent_id": null,
94
+ "children_ids": [
95
+ "snapshot-658"
96
+ ]
97
+ },
98
+ {
99
+ "description": "test",
100
+ "id": "snapshot-658",
101
+ "name": "test",
102
+ "created_at": "2018-10-18 09:50:03 UTC",
103
+ "parent_id": null,
104
+ "children_ids": []
105
+ }
106
+ ]
107
+ }
108
+ ```
109
+
110
+ ### Show a snapshot
111
+
112
+ ```bash
113
+ curl -s -u "$AUTH" \
114
+ -H 'Accept: application/json' \
115
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots/${SNAP_ID}" \
116
+ | jq
117
+ ```
118
+
119
+ ```json
120
+ {
121
+ "description": "test",
122
+ "id": "snapshot-658",
123
+ "name": "test",
124
+ "created_at": "2018-10-18 09:50:03 UTC",
125
+ "parent_id": null,
126
+ "children_ids": []
127
+ }
128
+ ```
129
+
130
+ ### Create a snapshot
131
+
132
+ ```bash
133
+ curl -s -u "$AUTH" \
134
+ -X POST \
135
+ -H 'Accept: application/json' \
136
+ -H 'Content-Type: application/json' \
137
+ --data "{ \"name\": \"${SNAP_NAME}\", \"description\": \"${DESCRIPTION}\" }" \
138
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots" \
139
+ | jq
140
+ ```
141
+
142
+ ```json
143
+ {
144
+ "description": "A wonderful snapshot.",
145
+ "id": null,
146
+ "name": "wonderful",
147
+ "created_at": null,
148
+ "parent_id": null,
149
+ "children_ids": []
150
+ }
151
+ ```
152
+
153
+ ### Delete a snashot
154
+
155
+ ```bash
156
+ curl -s -u "$AUTH" \
157
+ -X DELETE \
158
+ -H 'Accept: application/json' \
159
+ -H 'Content-Type: application/json' \
160
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots/${SNAP_ID}" \
161
+ | jq
162
+ ```
163
+
164
+ ```json
165
+ {
166
+ "description": "A wonderful snapshot.",
167
+ "id": null,
168
+ "name": "wonderful",
169
+ "created_at": "2018-10-19 07:03:37 UTC",
170
+ "parent_id": null,
171
+ "children_ids": []
172
+ }
173
+ ```
174
+
175
+ ### Update a snapshot
176
+
177
+ This updates only name and description, not the data.
178
+
179
+ ```bash
180
+ curl -s -u "$AUTH" \
181
+ -X PUT \
182
+ -H 'Accept: application/json' \
183
+ -H 'Content-Type: application/json' \
184
+ --data "{ \"name\": \"${SNAP_NAME}\", \"description\": \"${DESCRIPTION}\" }" \
185
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots/${SNAP_ID}" \
186
+ | jq
187
+ ```
188
+
189
+ ```json
190
+ {
191
+ "description": "An exceptional snapshot.",
192
+ "id": "snapshot-666",
193
+ "name": "exceptional",
194
+ "created_at": "2018-10-19 07:11:24 UTC",
195
+ "parent_id": null,
196
+ "children_ids": []
197
+ }
198
+ ```
199
+
200
+ ### Revert a snapshot
201
+
202
+ This request will block until the snapshot is reverted. Make sure to check your timeouts.
203
+
204
+ ```bash
205
+ curl -s -u "$AUTH" \
206
+ --max-time 600 \
207
+ -X PUT \
208
+ -H 'Content-Type: application/json' \
209
+ -H 'Accept: application/json' \
210
+ "https://${FOREMAN}/api/v2/hosts/${HOST}/snapshots/${SNAP_ID}/revert" \
211
+ | jq
212
+ ```
213
+
214
+ ```json
215
+ {
216
+ "description": "test",
217
+ "id": "snapshot-658",
218
+ "name": "test",
219
+ "created_at": "2018-10-18 09:50:03 UTC",
220
+ "parent_id": null,
221
+ "children_ids": []
222
+ }
223
+ ```
224
+
27
225
  ## Contributing
28
226
 
29
227
  Fork and send a Pull Request. Thanks!
data/Rakefile CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/usr/bin/env rake
2
+ # frozen_string_literal: true
3
+
2
4
  begin
3
5
  require 'bundler/setup'
4
6
  rescue LoadError
@@ -12,6 +14,13 @@ rescue LoadError
12
14
  RDoc::Task = Rake::RDocTask
13
15
  end
14
16
 
17
+ begin
18
+ require 'rubocop/rake_task'
19
+ RuboCop::RakeTask.new
20
+ rescue StandardError => _e
21
+ puts 'Rubocop not loaded.'
22
+ end
23
+
15
24
  RDoc::Task.new(:rdoc) do |rdoc|
16
25
  rdoc.rdoc_dir = 'rdoc'
17
26
  rdoc.title = 'ForemanSnapshotManagement'
@@ -20,6 +29,4 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
29
  rdoc.rdoc_files.include('lib/**/*.rb')
21
30
  end
22
31
 
23
- APP_RAKEFILE = File.expand_path('test/dummy/Rakefile', __dir__)
24
-
25
32
  Bundler::GemHelper.install_tasks
@@ -1,17 +1,33 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Api
2
4
  module V2
3
5
  class SnapshotsController < V2::BaseController
4
6
  include Api::Version2
5
7
  include Foreman::Controller::Parameters::Snapshot
6
8
 
7
- before_action :find_required_nested_object
9
+ before_action :find_host
8
10
  before_action :check_snapshot_capability
9
11
  before_action :find_resource, :only => %w[show update destroy revert]
10
12
 
11
13
  api :GET, '/hosts/:host_id/snapshots', N_('List all snapshots')
12
14
  param :host_id, :identifier_dottable, :required => true
15
+ param_group :search_and_pagination, ::Api::V2::BaseController
16
+ meta :search => [{ :name => 'name', :type => 'string' }]
13
17
  def index
14
- @snapshots = resource_scope_for_index
18
+ if params[:search]
19
+ search = params[:search].match(/^\s*name\s*=\s*(\w+)\s*$/) || params[:search].match(/^\s*name\s*=\s*\"([^"]+)\"\s*$/)
20
+ raise "Field '#{params[:search]}' not recognized for searching!" unless search
21
+
22
+ snapshot = resource_class.find_for_host_by_name(@host, search[1])
23
+ @snapshots = if snapshot
24
+ [snapshot].paginate(paginate_options)
25
+ else
26
+ []
27
+ end
28
+ else
29
+ @snapshots = resource_scope_for_index
30
+ end
15
31
  end
16
32
 
17
33
  api :GET, '/hosts/:host_id/snapshots/:id', 'Show a snapshot'
@@ -33,7 +49,7 @@ module Api
33
49
  param_group :snapshot, :as => :create
34
50
 
35
51
  def create
36
- @snapshot = resource_class.new(snapshot_params.to_h.merge(host: @nested_obj).merge(include_ram: params[:include_ram]))
52
+ @snapshot = resource_class.new(snapshot_params.to_h.merge(host: @host).merge(include_ram: params[:include_ram]))
37
53
  process_response @snapshot.create
38
54
  end
39
55
 
@@ -43,7 +59,7 @@ module Api
43
59
  param_group :snapshot
44
60
 
45
61
  def update
46
- process_response @snapshot.update_attributes(snapshot_params)
62
+ process_response @snapshot.update(snapshot_params)
47
63
  end
48
64
 
49
65
  api :DELETE, '/hosts/:host_id/snapshots/:id', N_('Delete a snapshot')
@@ -64,9 +80,25 @@ module Api
64
80
 
65
81
  private
66
82
 
83
+ # Find Host
84
+ #
85
+ # This method is responsible that methods of the controller know the current host.
86
+ def find_host
87
+ host_id = params[:host_id]
88
+ if host_id.blank?
89
+ not_found
90
+ return false
91
+ end
92
+ @host = Host.authorized("#{action_permission}_snapshots".to_sym, Host).friendly.find(host_id)
93
+ return @host if @host
94
+
95
+ not_found
96
+ false
97
+ end
98
+
67
99
  def resource_scope(_options = {})
68
100
  # TODO: Ask host for snapshots
69
- @resource_scope ||= resource_class.all_for_host(@nested_obj)
101
+ @resource_scope ||= resource_class.all_for_host(@host)
70
102
  end
71
103
 
72
104
  def resource_scope_for_index
@@ -78,12 +110,12 @@ module Api
78
110
  end
79
111
 
80
112
  def find_resource
81
- @snapshot = resource_class.find_for_host(@nested_obj, params[:id])
113
+ @snapshot = resource_class.find_for_host(@host, params[:id])
82
114
  not_found unless @snapshot
83
115
  end
84
116
 
85
117
  def check_snapshot_capability
86
- not_found unless @nested_obj.compute_resource && @nested_obj.compute_resource.capabilities.include?(:snapshots)
118
+ not_found unless @host.compute_resource&.capabilities&.include?(:snapshots)
87
119
  end
88
120
 
89
121
  def action_permission
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Foreman::Controller::Parameters::Snapshot
2
4
  extend ActiveSupport::Concern
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ForemanSnapshotManagement
2
4
  class SnapshotsController < ApplicationController
3
5
  include Foreman::Controller::ActionPermissionDsl
@@ -64,7 +66,7 @@ module ForemanSnapshotManagement
64
66
  #
65
67
  # This method renames a Snapshot from a given host.
66
68
  def update
67
- if @snapshot.update_attributes(snapshot_params)
69
+ if @snapshot.update(snapshot_params)
68
70
  render json: { name: @snapshot.name, description: @snapshot.description }
69
71
  else
70
72
  msg = _('Failed to update Snapshot: %s') % @snapshot.errors.full_messages.to_sentence
@@ -87,8 +89,8 @@ module ForemanSnapshotManagement
87
89
  errors << [h.name, s.errors.full_messages.to_sentence]
88
90
  end
89
91
  end
90
- error _('Error occurred while creating Snapshot for<br /><dl>%s</dl>') % errors.map { |e| "<dt>#{e[0]}</dt><dd>#{e[1]}</dd>" }.join('<br />') unless errors.empty?
91
- if snapshots_created > 0
92
+ error _('Error occurred while creating Snapshot for:%s') % "<br /><dl>#{errors.map { |e| "<dt>#{e[0]}</dt><dd>#{e[1]}</dd>" }.join('<br />')}</dl>" unless errors.empty?
93
+ if snapshots_created.positive?
92
94
  msg = _('Created %{snapshots} for %{num} %{hosts}') % {
93
95
  snapshots: n_('Snapshot', 'Snapshots', snapshots_created),
94
96
  num: snapshots_created,
@@ -122,6 +124,7 @@ module ForemanSnapshotManagement
122
124
  end
123
125
  @host = Host.authorized("#{action_permission}_snapshots".to_sym, Host).friendly.find(host_id)
124
126
  return @host if @host
127
+
125
128
  not_found
126
129
  false
127
130
  end
@@ -140,10 +143,10 @@ module ForemanSnapshotManagement
140
143
  end
141
144
 
142
145
  @hosts
143
- rescue StandardError => error
144
- message = _('Something went wrong while selecting hosts - %s') % error
146
+ rescue StandardError => e
147
+ message = _('Something went wrong while selecting hosts - %s') % e
145
148
  error(message)
146
- Foreman::Logging.exception(message, error)
149
+ Foreman::Logging.exception(message, e)
147
150
  redirect_to hosts_path
148
151
  false
149
152
  end
@@ -168,7 +171,7 @@ module ForemanSnapshotManagement
168
171
  end
169
172
 
170
173
  def check_snapshot_capability
171
- not_found unless @host.compute_resource && @host.compute_resource.capabilities.include?(:snapshots)
174
+ not_found unless @host.compute_resource&.capabilities&.include?(:snapshots)
172
175
  end
173
176
 
174
177
  def enumerate_snapshots
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ForemanSnapshotManagement
2
4
  module HostsHelperExtension
3
5
  def multiple_actions
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ForemanSnapshotManagement
2
4
  module SnapshotHelper
3
5
  def foreman_snapshot_management_snapshot_path(snapshot)
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FogExtensions
4
+ module Proxmox
5
+ module Snapshots
6
+ module Mock
7
+ def status_task(_node, _upid)
8
+ {
9
+ 'type' => 'qmsnapshot',
10
+ 'starttime' => 1_580_720_848,
11
+ 'pstart' => 1_864_464_143,
12
+ 'node' => 'proxmox',
13
+ 'upid' => 'UPID:proxmox:00003E13:6F21770F:5E37E2D0:qmsnapshot:100:root@pam:',
14
+ 'user' => 'root@pam',
15
+ 'exitstatus' => 'OK',
16
+ 'status' => 'stopped',
17
+ 'id' => '100',
18
+ 'pid' => 15_891
19
+ }
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end