foreman_snapshot_management 1.6.1 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/app/controllers/api/v2/snapshots_controller.rb +16 -2
- data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +5 -5
- data/app/models/foreman_snapshot_management/snapshot.rb +23 -27
- data/app/models/foreman_snapshot_management/vmware_extensions.rb +39 -12
- data/app/views/api/v2/snapshots/main.json.rabl +2 -2
- data/lib/foreman_snapshot_management/engine.rb +5 -5
- data/lib/foreman_snapshot_management/version.rb +1 -1
- data/locale/de/foreman_snapshot_management.po +136 -0
- data/locale/en/foreman_snapshot_management.edit.po +0 -0
- data/locale/en/foreman_snapshot_management.po +117 -2
- data/locale/foreman_snapshot_management.pot +171 -8
- data/test/controllers/api/v2/snapshots_test.rb +21 -6
- data/test/controllers/foreman_snapshot_management/snapshots_controller_test.rb +3 -3
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 886556b702d0ee48f89794fe453ae6b31cdb8ecef76cede5588dd96adf5b768d
|
4
|
+
data.tar.gz: f0bd937adb826954d90f69242de16b7c45a12331c8b658e11ec97cceb4ba269d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f36c17c1a4a9b4b1ca01b0cbfc19bd2f7b6f2d10a84bcb3bdff11ed6e872a6a5e9efbaa4f3233dd7fe5e6535700fed9bf77cd0c6c2ddff7eacf3b808496bba
|
7
|
+
data.tar.gz: a1f9a9aa7b141fc4840a07d2fa38c12cbc48097fc7f8106a4926d22a72d0cf88cfdbeb0d8ffdec8dca52fe72dc7b5c0d3c74937329c239a210c8bde837ee14dd
|
data/README.md
CHANGED
@@ -20,6 +20,8 @@ See [How_to_Install_a_Plugin](http://projects.theforeman.org/projects/foreman/wi
|
|
20
20
|
|
21
21
|
| Foreman Version | Plugin Version |
|
22
22
|
| --------------- | -------------- |
|
23
|
+
| 1.24 | >= 1.7.0 |
|
24
|
+
| 1.23 | >= 1.7.0 |
|
23
25
|
| 1.22 | >= 1.6.0 |
|
24
26
|
| 1.21 | >= 1.5.0 |
|
25
27
|
| 1.20 | >= 1.5.0 |
|
@@ -12,8 +12,22 @@ module Api
|
|
12
12
|
|
13
13
|
api :GET, '/hosts/:host_id/snapshots', N_('List all snapshots')
|
14
14
|
param :host_id, :identifier_dottable, :required => true
|
15
|
+
param_group :search_and_pagination, ::Api::V2::BaseController
|
16
|
+
meta :search => [{ :name => 'name', :type => 'string' }]
|
15
17
|
def index
|
16
|
-
|
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(@nested_obj, 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
|
17
31
|
end
|
18
32
|
|
19
33
|
api :GET, '/hosts/:host_id/snapshots/:id', 'Show a snapshot'
|
@@ -45,7 +59,7 @@ module Api
|
|
45
59
|
param_group :snapshot
|
46
60
|
|
47
61
|
def update
|
48
|
-
process_response @snapshot.
|
62
|
+
process_response @snapshot.update(snapshot_params)
|
49
63
|
end
|
50
64
|
|
51
65
|
api :DELETE, '/hosts/:host_id/snapshots/:id', N_('Delete a snapshot')
|
@@ -66,7 +66,7 @@ module ForemanSnapshotManagement
|
|
66
66
|
#
|
67
67
|
# This method renames a Snapshot from a given host.
|
68
68
|
def update
|
69
|
-
if @snapshot.
|
69
|
+
if @snapshot.update(snapshot_params)
|
70
70
|
render json: { name: @snapshot.name, description: @snapshot.description }
|
71
71
|
else
|
72
72
|
msg = _('Failed to update Snapshot: %s') % @snapshot.errors.full_messages.to_sentence
|
@@ -89,7 +89,7 @@ module ForemanSnapshotManagement
|
|
89
89
|
errors << [h.name, s.errors.full_messages.to_sentence]
|
90
90
|
end
|
91
91
|
end
|
92
|
-
error _('Error occurred while creating Snapshot for
|
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
93
|
if snapshots_created.positive?
|
94
94
|
msg = _('Created %{snapshots} for %{num} %{hosts}') % {
|
95
95
|
snapshots: n_('Snapshot', 'Snapshots', snapshots_created),
|
@@ -143,10 +143,10 @@ module ForemanSnapshotManagement
|
|
143
143
|
end
|
144
144
|
|
145
145
|
@hosts
|
146
|
-
rescue StandardError =>
|
147
|
-
message = _('Something went wrong while selecting hosts - %s') %
|
146
|
+
rescue StandardError => e
|
147
|
+
message = _('Something went wrong while selecting hosts - %s') % e
|
148
148
|
error(message)
|
149
|
-
Foreman::Logging.exception(message,
|
149
|
+
Foreman::Logging.exception(message, e)
|
150
150
|
redirect_to hosts_path
|
151
151
|
false
|
152
152
|
end
|
@@ -5,6 +5,7 @@ require 'date'
|
|
5
5
|
module ForemanSnapshotManagement
|
6
6
|
class Snapshot
|
7
7
|
extend ActiveModel::Callbacks
|
8
|
+
extend ActiveModel::Naming
|
8
9
|
include ActiveModel::Conversion
|
9
10
|
include ActiveModel::Model
|
10
11
|
include ActiveModel::Dirty
|
@@ -16,40 +17,35 @@ module ForemanSnapshotManagement
|
|
16
17
|
attr_reader :name, :description, :include_ram, :host_id
|
17
18
|
define_attribute_methods :name, :description, :include_ram
|
18
19
|
|
19
|
-
def self.
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def self.model_name
|
21
|
+
Struct.new(:name, :klass, :singular, :plural, :element,
|
22
|
+
:human, :collection, :param_key, :i18n_key, :route_key, :singular_route_key).new(
|
23
|
+
'ForemanSnapshotManagement::Snapshot', ForemanSnapshotManagement::Snapshot,
|
24
|
+
'foreman_snapshot_management_snapshot', 'foreman_snapshot_management_snapshots',
|
25
|
+
'snapshot', 'Snapshot', 'foreman_snapshot_management/snapshots',
|
26
|
+
'snapshot', :'foreman_snapshot_management/snapshot', 'foreman_snapshot_management_snapshots',
|
27
|
+
'foreman_snapshot_management_snapshot'
|
28
|
+
)
|
23
29
|
end
|
24
30
|
|
25
|
-
def self.
|
26
|
-
|
27
|
-
new_from_vmware(host, raw_snapshot) if raw_snapshot
|
31
|
+
def self.new_for_host(host)
|
32
|
+
host.compute_resource.new_snapshot(host)
|
28
33
|
end
|
29
34
|
|
30
|
-
def self.
|
31
|
-
|
32
|
-
host: host,
|
33
|
-
id: raw_snapshot.ref,
|
34
|
-
raw_snapshot: raw_snapshot,
|
35
|
-
name: raw_snapshot.name,
|
36
|
-
description: raw_snapshot.description,
|
37
|
-
parent: opts[:parent],
|
38
|
-
create_time: raw_snapshot.create_time
|
39
|
-
)
|
35
|
+
def self.all_for_host(host)
|
36
|
+
host.compute_resource.get_snapshots(host)
|
40
37
|
end
|
41
38
|
|
42
|
-
def
|
43
|
-
|
39
|
+
def self.find_for_host(host, id)
|
40
|
+
host.compute_resource.get_snapshot(host, id)
|
41
|
+
end
|
44
42
|
|
45
|
-
|
46
|
-
|
47
|
-
end
|
48
|
-
child_snapshots + child_snapshots.flat_map(&:children)
|
43
|
+
def self.find_for_host_by_name(host, name)
|
44
|
+
host.compute_resource.get_snapshot_by_name(host, name)
|
49
45
|
end
|
50
46
|
|
51
47
|
def inspect
|
52
|
-
"#<#{self.class}:0x#{self.__id__.to_s(16)} name=#{name} id=#{id} description=#{description} host_id=#{host_id} parent=#{parent.try(:id)}
|
48
|
+
"#<#{self.class}:0x#{self.__id__.to_s(16)} name=#{name} id=#{id} description=#{description} host_id=#{host_id} parent=#{parent.try(:id)}>"
|
53
49
|
end
|
54
50
|
|
55
51
|
def to_s
|
@@ -111,7 +107,7 @@ module ForemanSnapshotManagement
|
|
111
107
|
end
|
112
108
|
end
|
113
109
|
|
114
|
-
def
|
110
|
+
def update(new_attributes)
|
115
111
|
assign_attributes(new_attributes)
|
116
112
|
save if changed?
|
117
113
|
end
|
@@ -122,7 +118,7 @@ module ForemanSnapshotManagement
|
|
122
118
|
handle_snapshot_errors do
|
123
119
|
host.audit_comment = "Create snapshot #{name}"
|
124
120
|
host.save!
|
125
|
-
host.compute_resource.create_snapshot(host
|
121
|
+
host.compute_resource.create_snapshot(host, name, description, include_ram)
|
126
122
|
changes_applied
|
127
123
|
end
|
128
124
|
end
|
@@ -144,7 +140,7 @@ module ForemanSnapshotManagement
|
|
144
140
|
result = handle_snapshot_errors do
|
145
141
|
host.audit_comment = "Destroy snapshot #{name}"
|
146
142
|
host.save!
|
147
|
-
result = host.compute_resource.remove_snapshot(raw_snapshot
|
143
|
+
result = host.compute_resource.remove_snapshot(raw_snapshot)
|
148
144
|
end
|
149
145
|
@id = nil
|
150
146
|
result
|
@@ -10,8 +10,8 @@ module ForemanSnapshotManagement
|
|
10
10
|
# Create a Snapshot.
|
11
11
|
#
|
12
12
|
# This method creates a Snapshot with a given name and optional description.
|
13
|
-
def create_snapshot(
|
14
|
-
task = client.vm_take_snapshot('instance_uuid' => uuid, 'name' => name, 'description' => description, 'memory' => include_ram)
|
13
|
+
def create_snapshot(host, name, description, include_ram = false)
|
14
|
+
task = client.vm_take_snapshot('instance_uuid' => host.uuid, 'name' => name, 'description' => description, 'memory' => include_ram)
|
15
15
|
task_successful?(task)
|
16
16
|
rescue RbVmomi::Fault => e
|
17
17
|
Foreman::Logging.exception('Error creating VMWare Snapshot', e)
|
@@ -21,7 +21,7 @@ module ForemanSnapshotManagement
|
|
21
21
|
# Remove Snapshot
|
22
22
|
#
|
23
23
|
# This method removes a Snapshot from a given host.
|
24
|
-
def remove_snapshot(snapshot, remove_children)
|
24
|
+
def remove_snapshot(snapshot, remove_children = false)
|
25
25
|
task = client.remove_snapshot('snapshot' => snapshot, 'removeChildren' => remove_children)
|
26
26
|
task_successful?(task)
|
27
27
|
rescue RbVmomi::Fault => e
|
@@ -54,23 +54,50 @@ module ForemanSnapshotManagement
|
|
54
54
|
# Get Snapshot
|
55
55
|
#
|
56
56
|
# This methods returns a specific Snapshot for a given host.
|
57
|
-
def get_snapshot(
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
def get_snapshot(host, snapshot_id)
|
58
|
+
raw_snapshot = client.snapshots(server_id: host.uuid).get(snapshot_id)
|
59
|
+
raw_to_snapshot(host, raw_snapshot)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Get Snapshot by name
|
63
|
+
#
|
64
|
+
# This method returns a specific Snapshot for a given host.
|
65
|
+
def get_snapshot_by_name(host, name)
|
66
|
+
raw_snapshot = nil
|
67
|
+
client.snapshots(server_id: host.uuid).all(recursive: true).each do |snapshot|
|
68
|
+
if name == snapshot.name
|
69
|
+
raw_snapshot = snapshot
|
70
|
+
break
|
71
|
+
end
|
72
|
+
end
|
73
|
+
raw_to_snapshot(host, raw_snapshot)
|
63
74
|
end
|
64
75
|
|
65
76
|
# Get Snapshots
|
66
77
|
#
|
67
|
-
# This methods returns Snapshots
|
68
|
-
def get_snapshots(
|
69
|
-
client.snapshots(server_id:
|
78
|
+
# This methods returns Snapshots for a given host.
|
79
|
+
def get_snapshots(host)
|
80
|
+
client.snapshots(server_id: host.uuid).all(recursive: true).map do |raw_snapshot|
|
81
|
+
raw_to_snapshot(host, raw_snapshot)
|
82
|
+
end
|
70
83
|
end
|
71
84
|
|
72
85
|
private
|
73
86
|
|
87
|
+
def raw_to_snapshot(host, raw_snapshot, opts = {})
|
88
|
+
if raw_snapshot
|
89
|
+
Snapshot.new(
|
90
|
+
host: host,
|
91
|
+
id: raw_snapshot.ref,
|
92
|
+
raw_snapshot: raw_snapshot,
|
93
|
+
name: raw_snapshot.name,
|
94
|
+
description: raw_snapshot.description,
|
95
|
+
parent: opts[:parent],
|
96
|
+
create_time: raw_snapshot.create_time
|
97
|
+
)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
74
101
|
def task_successful?(task)
|
75
102
|
task['task_state'] == 'success' || task['state'] == 'success'
|
76
103
|
end
|
@@ -7,5 +7,5 @@ extends 'api/v2/snapshots/base'
|
|
7
7
|
attributes :description
|
8
8
|
|
9
9
|
node(:created_at, &:create_time)
|
10
|
-
node(:parent_id) { |snapshot| snapshot.parent.try(:id) }
|
11
|
-
node(:children_ids) { |snapshot| snapshot.children.map
|
10
|
+
node(:parent_id) { |snapshot| snapshot.try(:parent).try(:id) }
|
11
|
+
node(:children_ids) { |snapshot| snapshot.try(:children).try(:map, &:id) }
|
@@ -22,7 +22,7 @@ module ForemanSnapshotManagement
|
|
22
22
|
}, :resource_type => 'Host'
|
23
23
|
|
24
24
|
permission :create_snapshots, {
|
25
|
-
:'foreman_snapshot_management/snapshots' => [:create],
|
25
|
+
:'foreman_snapshot_management/snapshots' => [:create, :select_multiple_host, :create_multiple_host],
|
26
26
|
:'api/v2/snapshots' => [:create]
|
27
27
|
}, :resource_type => 'Host'
|
28
28
|
|
@@ -81,13 +81,13 @@ module ForemanSnapshotManagement
|
|
81
81
|
config.to_prepare do
|
82
82
|
begin
|
83
83
|
# Load Foreman extensions
|
84
|
-
::Foreman::Model::Vmware.
|
85
|
-
::HostsHelper.
|
84
|
+
::Foreman::Model::Vmware.prepend(ForemanSnapshotManagement::VmwareExtensions)
|
85
|
+
::HostsHelper.prepend(ForemanSnapshotManagement::HostsHelperExtension)
|
86
86
|
|
87
87
|
# Load Fog extensions
|
88
88
|
if Foreman::Model::Vmware.available?
|
89
|
-
ForemanSnapshotManagement.fog_vsphere_namespace::Real.
|
90
|
-
ForemanSnapshotManagement.fog_vsphere_namespace::Mock.
|
89
|
+
ForemanSnapshotManagement.fog_vsphere_namespace::Real.prepend(FogExtensions::Vsphere::Snapshots::Real)
|
90
|
+
ForemanSnapshotManagement.fog_vsphere_namespace::Mock.prepend(FogExtensions::Vsphere::Snapshots::Mock)
|
91
91
|
end
|
92
92
|
rescue StandardError => e
|
93
93
|
Rails.logger.warn "ForemanSnapshotManagement: skipping engine hook (#{e})"
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# German translations for foreman_snapshot_management package.
|
2
|
+
# Copyright (C) 2019 THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
+
# This file is distributed under the same license as the foreman_snapshot_management package.
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
|
5
|
+
#
|
6
|
+
msgid ""
|
7
|
+
msgstr ""
|
8
|
+
"Project-Id-Version: foreman_snapshot_management 1.0.0\n"
|
9
|
+
"Report-Msgid-Bugs-To: \n"
|
10
|
+
"PO-Revision-Date: 2019-10-22 14:00+0000\n"
|
11
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
12
|
+
"Language-Team: German\n"
|
13
|
+
"Language: de\n"
|
14
|
+
"MIME-Version: 1.0\n"
|
15
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
16
|
+
"Content-Transfer-Encoding: 8bit\n"
|
17
|
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
18
|
+
"\n"
|
19
|
+
|
20
|
+
msgid "Action"
|
21
|
+
msgstr ""
|
22
|
+
|
23
|
+
msgid "Are you sure to delete this Snapshot?"
|
24
|
+
msgstr ""
|
25
|
+
|
26
|
+
msgid "Are you sure to revert this Snapshot?"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
msgid "Create"
|
30
|
+
msgstr ""
|
31
|
+
|
32
|
+
msgid "Create Snapshot"
|
33
|
+
msgstr ""
|
34
|
+
|
35
|
+
msgid "Create a snapshot"
|
36
|
+
msgstr ""
|
37
|
+
|
38
|
+
msgid "Created %{snapshots} for %{num} %{hosts}"
|
39
|
+
msgstr ""
|
40
|
+
|
41
|
+
msgid "Delete a snapshot"
|
42
|
+
msgstr ""
|
43
|
+
|
44
|
+
msgid "Deleting..."
|
45
|
+
msgstr ""
|
46
|
+
|
47
|
+
msgid "Description"
|
48
|
+
msgstr ""
|
49
|
+
|
50
|
+
msgid "Description of this snapshot"
|
51
|
+
msgstr ""
|
52
|
+
|
53
|
+
msgid "Error occurred while creating Snapshot for:%s"
|
54
|
+
msgstr ""
|
55
|
+
|
56
|
+
msgid "Error occurred while creating Snapshot: %s"
|
57
|
+
msgstr ""
|
58
|
+
|
59
|
+
msgid "Error occurred while removing Snapshot: %s"
|
60
|
+
msgstr ""
|
61
|
+
|
62
|
+
msgid "Error occurred while rolling back VM: %s"
|
63
|
+
msgstr ""
|
64
|
+
|
65
|
+
msgid "Failed to update Snapshot: %s"
|
66
|
+
msgstr ""
|
67
|
+
|
68
|
+
msgid "Foreman-plugin to manage snapshots in a vSphere environment."
|
69
|
+
msgstr ""
|
70
|
+
|
71
|
+
msgid "Include RAM"
|
72
|
+
msgstr ""
|
73
|
+
|
74
|
+
msgid "List all snapshots"
|
75
|
+
msgstr ""
|
76
|
+
|
77
|
+
msgid "Loading Snapshots information ..."
|
78
|
+
msgstr ""
|
79
|
+
|
80
|
+
msgid "Name of this snapshot"
|
81
|
+
msgstr ""
|
82
|
+
|
83
|
+
msgid "No capable hosts found."
|
84
|
+
msgstr ""
|
85
|
+
|
86
|
+
msgid "No capable hosts selected"
|
87
|
+
msgstr ""
|
88
|
+
|
89
|
+
msgid "No hosts were found with that id, name or query filter"
|
90
|
+
msgstr ""
|
91
|
+
|
92
|
+
msgid "Revert Host to a snapshot"
|
93
|
+
msgstr ""
|
94
|
+
|
95
|
+
msgid "Reverting..."
|
96
|
+
msgstr ""
|
97
|
+
|
98
|
+
msgid "Rollback"
|
99
|
+
msgstr ""
|
100
|
+
|
101
|
+
msgid "Snapshot"
|
102
|
+
msgid_plural "Snapshots"
|
103
|
+
msgstr[0] ""
|
104
|
+
msgstr[1] ""
|
105
|
+
|
106
|
+
msgid "Snapshots"
|
107
|
+
msgstr ""
|
108
|
+
|
109
|
+
msgid "Something went wrong while selecting hosts - %s"
|
110
|
+
msgstr ""
|
111
|
+
|
112
|
+
msgid "Unable to create VMWare Snapshot"
|
113
|
+
msgstr ""
|
114
|
+
|
115
|
+
msgid "Unable to remove VMWare Snapshot"
|
116
|
+
msgstr ""
|
117
|
+
|
118
|
+
msgid "Unable to revert VMWare Snapshot"
|
119
|
+
msgstr ""
|
120
|
+
|
121
|
+
msgid "Unable to update VMWare Snapshot"
|
122
|
+
msgstr ""
|
123
|
+
|
124
|
+
msgid "Update a snapshot"
|
125
|
+
msgstr ""
|
126
|
+
|
127
|
+
msgid "VM successfully rolled back."
|
128
|
+
msgstr ""
|
129
|
+
|
130
|
+
msgid "Whether to include the RAM state in the snapshot"
|
131
|
+
msgstr ""
|
132
|
+
|
133
|
+
msgid "host"
|
134
|
+
msgid_plural "hosts"
|
135
|
+
msgstr[0] ""
|
136
|
+
msgstr[1] ""
|
File without changes
|
@@ -2,12 +2,10 @@
|
|
2
2
|
#
|
3
3
|
# This file is distributed under the same license as foreman_snapshot_management.
|
4
4
|
#
|
5
|
-
#, fuzzy
|
6
5
|
msgid ""
|
7
6
|
msgstr ""
|
8
7
|
"Project-Id-Version: version 0.0.1\n"
|
9
8
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"POT-Creation-Date: 2014-08-20 08:46+0100\n"
|
11
9
|
"PO-Revision-Date: 2014-08-20 08:54+0100\n"
|
12
10
|
"Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
|
13
11
|
"Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
|
@@ -17,3 +15,120 @@ msgstr ""
|
|
17
15
|
"Content-Transfer-Encoding: 8bit\n"
|
18
16
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19
17
|
|
18
|
+
msgid "Action"
|
19
|
+
msgstr ""
|
20
|
+
|
21
|
+
msgid "Are you sure to delete this Snapshot?"
|
22
|
+
msgstr ""
|
23
|
+
|
24
|
+
msgid "Are you sure to revert this Snapshot?"
|
25
|
+
msgstr ""
|
26
|
+
|
27
|
+
msgid "Create"
|
28
|
+
msgstr ""
|
29
|
+
|
30
|
+
msgid "Create Snapshot"
|
31
|
+
msgstr ""
|
32
|
+
|
33
|
+
msgid "Create a snapshot"
|
34
|
+
msgstr ""
|
35
|
+
|
36
|
+
msgid "Created %{snapshots} for %{num} %{hosts}"
|
37
|
+
msgstr ""
|
38
|
+
|
39
|
+
msgid "Delete a snapshot"
|
40
|
+
msgstr ""
|
41
|
+
|
42
|
+
msgid "Deleting..."
|
43
|
+
msgstr ""
|
44
|
+
|
45
|
+
msgid "Description"
|
46
|
+
msgstr ""
|
47
|
+
|
48
|
+
msgid "Description of this snapshot"
|
49
|
+
msgstr ""
|
50
|
+
|
51
|
+
msgid "Error occurred while creating Snapshot for:%s"
|
52
|
+
msgstr ""
|
53
|
+
|
54
|
+
msgid "Error occurred while creating Snapshot: %s"
|
55
|
+
msgstr ""
|
56
|
+
|
57
|
+
msgid "Error occurred while removing Snapshot: %s"
|
58
|
+
msgstr ""
|
59
|
+
|
60
|
+
msgid "Error occurred while rolling back VM: %s"
|
61
|
+
msgstr ""
|
62
|
+
|
63
|
+
msgid "Failed to update Snapshot: %s"
|
64
|
+
msgstr ""
|
65
|
+
|
66
|
+
msgid "Foreman-plugin to manage snapshots in a vSphere environment."
|
67
|
+
msgstr ""
|
68
|
+
|
69
|
+
msgid "Include RAM"
|
70
|
+
msgstr ""
|
71
|
+
|
72
|
+
msgid "List all snapshots"
|
73
|
+
msgstr ""
|
74
|
+
|
75
|
+
msgid "Loading Snapshots information ..."
|
76
|
+
msgstr ""
|
77
|
+
|
78
|
+
msgid "Name of this snapshot"
|
79
|
+
msgstr ""
|
80
|
+
|
81
|
+
msgid "No capable hosts found."
|
82
|
+
msgstr ""
|
83
|
+
|
84
|
+
msgid "No capable hosts selected"
|
85
|
+
msgstr ""
|
86
|
+
|
87
|
+
msgid "No hosts were found with that id, name or query filter"
|
88
|
+
msgstr ""
|
89
|
+
|
90
|
+
msgid "Revert Host to a snapshot"
|
91
|
+
msgstr ""
|
92
|
+
|
93
|
+
msgid "Reverting..."
|
94
|
+
msgstr ""
|
95
|
+
|
96
|
+
msgid "Rollback"
|
97
|
+
msgstr ""
|
98
|
+
|
99
|
+
msgid "Snapshot"
|
100
|
+
msgid_plural "Snapshots"
|
101
|
+
msgstr[0] ""
|
102
|
+
msgstr[1] ""
|
103
|
+
|
104
|
+
msgid "Snapshots"
|
105
|
+
msgstr ""
|
106
|
+
|
107
|
+
msgid "Something went wrong while selecting hosts - %s"
|
108
|
+
msgstr ""
|
109
|
+
|
110
|
+
msgid "Unable to create VMWare Snapshot"
|
111
|
+
msgstr ""
|
112
|
+
|
113
|
+
msgid "Unable to remove VMWare Snapshot"
|
114
|
+
msgstr ""
|
115
|
+
|
116
|
+
msgid "Unable to revert VMWare Snapshot"
|
117
|
+
msgstr ""
|
118
|
+
|
119
|
+
msgid "Unable to update VMWare Snapshot"
|
120
|
+
msgstr ""
|
121
|
+
|
122
|
+
msgid "Update a snapshot"
|
123
|
+
msgstr ""
|
124
|
+
|
125
|
+
msgid "VM successfully rolled back."
|
126
|
+
msgstr ""
|
127
|
+
|
128
|
+
msgid "Whether to include the RAM state in the snapshot"
|
129
|
+
msgstr ""
|
130
|
+
|
131
|
+
msgid "host"
|
132
|
+
msgid_plural "hosts"
|
133
|
+
msgstr[0] ""
|
134
|
+
msgstr[1] ""
|
@@ -1,19 +1,182 @@
|
|
1
|
-
#
|
2
|
-
#
|
3
|
-
# This file is distributed under the same license as foreman_snapshot_management.
|
1
|
+
# SOME DESCRIPTIVE TITLE.
|
2
|
+
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
3
|
+
# This file is distributed under the same license as the foreman_snapshot_management package.
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
4
5
|
#
|
5
6
|
#, fuzzy
|
6
7
|
msgid ""
|
7
8
|
msgstr ""
|
8
|
-
"Project-Id-Version:
|
9
|
+
"Project-Id-Version: foreman_snapshot_management 1.0.0\n"
|
9
10
|
"Report-Msgid-Bugs-To: \n"
|
10
|
-
"POT-Creation-Date:
|
11
|
-
"PO-Revision-Date:
|
12
|
-
"Last-Translator:
|
13
|
-
"Language-Team:
|
11
|
+
"POT-Creation-Date: 2019-10-22 13:22+0000\n"
|
12
|
+
"PO-Revision-Date: 2019-10-22 13:22+0000\n"
|
13
|
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14
|
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
14
15
|
"Language: \n"
|
15
16
|
"MIME-Version: 1.0\n"
|
16
17
|
"Content-Type: text/plain; charset=UTF-8\n"
|
17
18
|
"Content-Transfer-Encoding: 8bit\n"
|
18
19
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
19
20
|
|
21
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:13
|
22
|
+
msgid "List all snapshots"
|
23
|
+
msgstr ""
|
24
|
+
|
25
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:27
|
26
|
+
msgid "Name of this snapshot"
|
27
|
+
msgstr ""
|
28
|
+
|
29
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:28
|
30
|
+
msgid "Description of this snapshot"
|
31
|
+
msgstr ""
|
32
|
+
|
33
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:32
|
34
|
+
msgid "Create a snapshot"
|
35
|
+
msgstr ""
|
36
|
+
|
37
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:34
|
38
|
+
msgid "Whether to include the RAM state in the snapshot"
|
39
|
+
msgstr ""
|
40
|
+
|
41
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:42
|
42
|
+
msgid "Update a snapshot"
|
43
|
+
msgstr ""
|
44
|
+
|
45
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:51
|
46
|
+
msgid "Delete a snapshot"
|
47
|
+
msgstr ""
|
48
|
+
|
49
|
+
#: ../app/controllers/api/v2/snapshots_controller.rb:59
|
50
|
+
msgid "Revert Host to a snapshot"
|
51
|
+
msgstr ""
|
52
|
+
|
53
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:36
|
54
|
+
msgid "Error occurred while creating Snapshot: %s"
|
55
|
+
msgstr ""
|
56
|
+
|
57
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:48
|
58
|
+
msgid "Error occurred while removing Snapshot: %s"
|
59
|
+
msgstr ""
|
60
|
+
|
61
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:58
|
62
|
+
msgid "VM successfully rolled back."
|
63
|
+
msgstr ""
|
64
|
+
|
65
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:60
|
66
|
+
msgid "Error occurred while rolling back VM: %s"
|
67
|
+
msgstr ""
|
68
|
+
|
69
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:72
|
70
|
+
msgid "Failed to update Snapshot: %s"
|
71
|
+
msgstr ""
|
72
|
+
|
73
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:92
|
74
|
+
msgid "Error occurred while creating Snapshot for:%s"
|
75
|
+
msgstr ""
|
76
|
+
|
77
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:94
|
78
|
+
msgid "Created %{snapshots} for %{num} %{hosts}"
|
79
|
+
msgstr ""
|
80
|
+
|
81
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:95
|
82
|
+
#: ../app/models/foreman_snapshot_management/snapshot.rb:56
|
83
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:5
|
84
|
+
#: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:8
|
85
|
+
msgid "Snapshot"
|
86
|
+
msgid_plural "Snapshots"
|
87
|
+
msgstr[0] ""
|
88
|
+
msgstr[1] ""
|
89
|
+
|
90
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:97
|
91
|
+
msgid "host"
|
92
|
+
msgid_plural "hosts"
|
93
|
+
msgstr[0] ""
|
94
|
+
msgstr[1] ""
|
95
|
+
|
96
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:140
|
97
|
+
msgid "No hosts were found with that id, name or query filter"
|
98
|
+
msgstr ""
|
99
|
+
|
100
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:147
|
101
|
+
msgid "Something went wrong while selecting hosts - %s"
|
102
|
+
msgstr ""
|
103
|
+
|
104
|
+
#: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:166
|
105
|
+
msgid "No capable hosts found."
|
106
|
+
msgstr ""
|
107
|
+
|
108
|
+
#:
|
109
|
+
#: ../app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb:6
|
110
|
+
msgid "Create Snapshot"
|
111
|
+
msgstr ""
|
112
|
+
|
113
|
+
#: ../app/models/foreman_snapshot_management/vmware_extensions.rb:18
|
114
|
+
msgid "Unable to create VMWare Snapshot"
|
115
|
+
msgstr ""
|
116
|
+
|
117
|
+
#: ../app/models/foreman_snapshot_management/vmware_extensions.rb:29
|
118
|
+
msgid "Unable to remove VMWare Snapshot"
|
119
|
+
msgstr ""
|
120
|
+
|
121
|
+
#: ../app/models/foreman_snapshot_management/vmware_extensions.rb:40
|
122
|
+
msgid "Unable to revert VMWare Snapshot"
|
123
|
+
msgstr ""
|
124
|
+
|
125
|
+
#: ../app/models/foreman_snapshot_management/vmware_extensions.rb:51
|
126
|
+
msgid "Unable to update VMWare Snapshot"
|
127
|
+
msgstr ""
|
128
|
+
|
129
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:6
|
130
|
+
#: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:11
|
131
|
+
msgid "Description"
|
132
|
+
msgstr ""
|
133
|
+
|
134
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:7
|
135
|
+
#: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:14
|
136
|
+
msgid "Include RAM"
|
137
|
+
msgstr ""
|
138
|
+
|
139
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:8
|
140
|
+
msgid "Action"
|
141
|
+
msgstr ""
|
142
|
+
|
143
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:24
|
144
|
+
msgid "Create"
|
145
|
+
msgstr ""
|
146
|
+
|
147
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
|
148
|
+
msgid "Rollback"
|
149
|
+
msgstr ""
|
150
|
+
|
151
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
|
152
|
+
msgid "Are you sure to revert this Snapshot?"
|
153
|
+
msgstr ""
|
154
|
+
|
155
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
|
156
|
+
msgid "Reverting..."
|
157
|
+
msgstr ""
|
158
|
+
|
159
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:50
|
160
|
+
msgid "Are you sure to delete this Snapshot?"
|
161
|
+
msgstr ""
|
162
|
+
|
163
|
+
#: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:50
|
164
|
+
msgid "Deleting..."
|
165
|
+
msgstr ""
|
166
|
+
|
167
|
+
#:
|
168
|
+
#: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:4
|
169
|
+
msgid "No capable hosts selected"
|
170
|
+
msgstr ""
|
171
|
+
|
172
|
+
#: ../app/views/hosts/_snapshots_tab.html.erb:5
|
173
|
+
msgid "Loading Snapshots information ..."
|
174
|
+
msgstr ""
|
175
|
+
|
176
|
+
#: ../lib/foreman_snapshot_management/engine.rb:57
|
177
|
+
msgid "Snapshots"
|
178
|
+
msgstr ""
|
179
|
+
|
180
|
+
#: gemspec.rb:4
|
181
|
+
msgid "Foreman-plugin to manage snapshots in a vSphere environment."
|
182
|
+
msgstr ""
|
@@ -3,11 +3,11 @@
|
|
3
3
|
require 'test_helper'
|
4
4
|
|
5
5
|
class Api::V2::SnapshotsControllerTest < ActionController::TestCase
|
6
|
-
let(:tax_location) { Location.
|
7
|
-
let(:tax_organization) { Organization.
|
6
|
+
let(:tax_location) { Location.find_by(name: 'Location 1') }
|
7
|
+
let(:tax_organization) { Organization.find_by(name: 'Organization 1') }
|
8
8
|
let(:compute_resource) do
|
9
9
|
cr = FactoryBot.create(:compute_resource, :vmware, :uuid => 'Solutions', :locations => [tax_location], organizations: [tax_organization])
|
10
|
-
ComputeResource.
|
10
|
+
ComputeResource.find_by(id: cr.id)
|
11
11
|
end
|
12
12
|
let(:uuid) { '5032c8a5-9c5e-ba7a-3804-832a03e16381' }
|
13
13
|
let(:host) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid) }
|
@@ -20,8 +20,23 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
|
|
20
20
|
assert_response :success
|
21
21
|
assert_not_nil assigns(:snapshots)
|
22
22
|
body = ActiveSupport::JSON.decode(@response.body)
|
23
|
-
|
24
|
-
|
23
|
+
assert_not_empty body
|
24
|
+
assert_not_empty body['results']
|
25
|
+
end
|
26
|
+
|
27
|
+
test 'should search snapshot' do
|
28
|
+
get :index, params: { :host_id => host.to_param, :search => 'name= clean' }
|
29
|
+
assert_response :success
|
30
|
+
assert_not_nil assigns(:snapshots)
|
31
|
+
body = ActiveSupport::JSON.decode(@response.body)
|
32
|
+
assert_not_empty body
|
33
|
+
assert_not_empty body['results']
|
34
|
+
assert body['results'].count == 1
|
35
|
+
end
|
36
|
+
|
37
|
+
test 'should refute search snapshot' do
|
38
|
+
get :index, params: { :host_id => host.to_param, :search => 'name != clean' }
|
39
|
+
assert_response :internal_server_error
|
25
40
|
end
|
26
41
|
|
27
42
|
test 'should show snapshot' do
|
@@ -29,7 +44,7 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
|
|
29
44
|
assert_not_nil assigns(:snapshot)
|
30
45
|
assert_response :success
|
31
46
|
body = ActiveSupport::JSON.decode(@response.body)
|
32
|
-
|
47
|
+
assert_not_empty body
|
33
48
|
end
|
34
49
|
|
35
50
|
test 'should 404 for unknown snapshot' do
|
@@ -4,11 +4,11 @@ require 'test_helper'
|
|
4
4
|
|
5
5
|
module ForemanSnapshotManagement
|
6
6
|
class SnapshotsControllerTest < ActionController::TestCase
|
7
|
-
let(:tax_location) { Location.
|
8
|
-
let(:tax_organization) { Organization.
|
7
|
+
let(:tax_location) { Location.find_by(name: 'Location 1') }
|
8
|
+
let(:tax_organization) { Organization.find_by(name: 'Organization 1') }
|
9
9
|
let(:compute_resource) do
|
10
10
|
cr = FactoryBot.create(:compute_resource, :vmware, :uuid => 'Solutions', :locations => [tax_location], organizations: [tax_organization])
|
11
|
-
ComputeResource.
|
11
|
+
ComputeResource.find_by(id: cr.id)
|
12
12
|
end
|
13
13
|
let(:uuid) { '5032c8a5-9c5e-ba7a-3804-832a03e16381' }
|
14
14
|
let(:uuid2) { 'a7169e20-74d3-4367-afc2-d355716e7555' }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_snapshot_management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ATIX AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.75.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.75.0
|
41
41
|
description: Foreman-plugin to manage snapshots in a vSphere environment.
|
42
42
|
email:
|
43
43
|
- info@atix.de
|
@@ -74,6 +74,8 @@ files:
|
|
74
74
|
- lib/foreman_snapshot_management/version.rb
|
75
75
|
- lib/tasks/foreman_snapshot_management_tasks.rake
|
76
76
|
- locale/Makefile
|
77
|
+
- locale/de/foreman_snapshot_management.po
|
78
|
+
- locale/en/foreman_snapshot_management.edit.po
|
77
79
|
- locale/en/foreman_snapshot_management.po
|
78
80
|
- locale/foreman_snapshot_management.pot
|
79
81
|
- locale/gemspec.rb
|