foreman_snapshot_management 1.7.0 → 1.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 886556b702d0ee48f89794fe453ae6b31cdb8ecef76cede5588dd96adf5b768d
4
- data.tar.gz: f0bd937adb826954d90f69242de16b7c45a12331c8b658e11ec97cceb4ba269d
3
+ metadata.gz: c9efa1f527f44cb80179813e24eef241905760743d411098da6627d6ee8975c2
4
+ data.tar.gz: 569d6387f7a18d74b7f3bdd916de43aefb91d9938618cba15763a9b18e9e08ae
5
5
  SHA512:
6
- metadata.gz: a1f36c17c1a4a9b4b1ca01b0cbfc19bd2f7b6f2d10a84bcb3bdff11ed6e872a6a5e9efbaa4f3233dd7fe5e6535700fed9bf77cd0c6c2ddff7eacf3b808496bba
7
- data.tar.gz: a1f9a9aa7b141fc4840a07d2fa38c12cbc48097fc7f8106a4926d22a72d0cf88cfdbeb0d8ffdec8dca52fe72dc7b5c0d3c74937329c239a210c8bde837ee14dd
6
+ metadata.gz: 7b04015470b2427bc450c69c5e008a33250c2decdebc45a52a7a092f221c34a38d1dd184da7938a400491332b97ac393e79e3fb502c2e0ff82de9ea19b1718a7
7
+ data.tar.gz: 70a2bca8aea94deda793f1434c7935587ea43beb983db1c9a3e583fee84d5bc73f3d61f2eaa44a83bf19e3d02f3725697b6c4dd84a861a582c439814fd37128e
data/README.md CHANGED
@@ -3,7 +3,9 @@
3
3
  # ForemanSnapshotManagement
4
4
 
5
5
  ForemanSnapshotManagement is a Foreman plugin to manage snapshots.
6
- As Hypervisor VMware vSphere is supported.
6
+ As Hypervisor the following systems are supported:
7
+ - VMware vSphere
8
+ - [Proxmox](https://www.proxmox.com/)
7
9
 
8
10
  ## Features
9
11
 
@@ -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
@@ -0,0 +1,101 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ForemanSnapshotManagement
4
+ module ProxmoxExtensions
5
+ # Extend Proxmox's capabilities with snapshots.
6
+ def capabilities
7
+ super + [:snapshots]
8
+ end
9
+
10
+ # Create a Snapshot.
11
+ #
12
+ # This method creates a Snapshot with a given name and optional description.
13
+ def create_snapshot(host, name, description, _include_ram = false)
14
+ server = find_vm_by_uuid host.uuid
15
+ raise _('Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _') unless name =~ /^[A-Za-z][\w]{1,}$/
16
+
17
+ snapshot = server.snapshots.create(name: name)
18
+ snapshot.description = description
19
+ snapshot.update
20
+ rescue StandardError => e
21
+ Foreman::Logging.exception('Error creating Proxmox Snapshot', e)
22
+ raise ::Foreman::WrappedException.new(e, N_('Unable to create Proxmox Snapshot'))
23
+ end
24
+
25
+ # Remove Snapshot
26
+ #
27
+ # This method removes a Snapshot from a given host.
28
+ def remove_snapshot(snapshot)
29
+ snapshot.destroy
30
+ rescue StandardError => e
31
+ Foreman::Logging.exception('Error removing Proxmox Snapshot', e)
32
+ raise ::Foreman::WrappedException.new(e, N_('Unable to remove Proxmox Snapshot'))
33
+ end
34
+
35
+ # Revert Snapshot
36
+ #
37
+ # This method revert a host to a given Snapshot.
38
+ def revert_snapshot(snapshot)
39
+ snapshot.rollback
40
+ rescue StandardError => e
41
+ Foreman::Logging.exception('Error reverting Proxmox Snapshot', e)
42
+ raise ::Foreman::WrappedException.new(e, N_('Unable to revert Proxmox Snapshot'))
43
+ end
44
+
45
+ # Update Snapshot
46
+ #
47
+ # This method renames a Snapshot from a given host.
48
+ def update_snapshot(snapshot, name, description)
49
+ raise _('Snapshot name cannot be changed') if snapshot.name != name
50
+
51
+ snapshot.description = description
52
+ snapshot.update
53
+ rescue StandardError => e
54
+ Foreman::Logging.exception('Error updating Proxmox Snapshot', e)
55
+ raise ::Foreman::WrappedException.new(e, N_('Unable to update Proxmox Snapshot'))
56
+ end
57
+
58
+ # Get Snapshot
59
+ #
60
+ # This methods returns a specific Snapshot for a given host.
61
+ def get_snapshot(host, snapshot_id)
62
+ server = find_vm_by_uuid host.uuid
63
+ snapshot = server.snapshots.get(snapshot_id)
64
+ raw_to_snapshot(host, snapshot)
65
+ end
66
+
67
+ # Get Snapshot by name
68
+ #
69
+ # This method returns a specific Snapshot for a given host.
70
+ def get_snapshot_by_name(host, name)
71
+ server = find_vm_by_uuid host.uuid
72
+ snapshot = server.snapshots.get(name)
73
+ raw_to_snapshot(host, snapshot) if snapshot
74
+ end
75
+
76
+ # Get Snapshots
77
+ #
78
+ # This methods returns Snapshots for a given host.
79
+ def get_snapshots(host)
80
+ server = find_vm_by_uuid host.uuid
81
+ server.snapshots.delete(server.snapshots.get('current'))
82
+ server.snapshots.map do |snapshot|
83
+ raw_to_snapshot(host, snapshot)
84
+ end
85
+ end
86
+
87
+ private
88
+
89
+ def raw_to_snapshot(host, raw_snapshot)
90
+ if raw_snapshot
91
+ Snapshot.new(
92
+ host: host,
93
+ id: raw_snapshot.name,
94
+ raw_snapshot: raw_snapshot,
95
+ name: raw_snapshot.name,
96
+ description: raw_snapshot.description
97
+ )
98
+ end
99
+ end
100
+ end
101
+ end
@@ -53,7 +53,7 @@ module ForemanSnapshotManagement
53
53
  end
54
54
 
55
55
  def formatted_create_time
56
- create_time.strftime('%F %H:%M')
56
+ create_time&.strftime('%F %H:%M')
57
57
  end
58
58
 
59
59
  def persisted?
@@ -4,7 +4,7 @@ module ForemanSnapshotManagement
4
4
  module VmwareExtensions
5
5
  # Extend VMWare's capabilities with snapshots.
6
6
  def capabilities
7
- super + [:snapshots]
7
+ super + [:snapshots, :snapshot_include_ram, :editable_snapshot_name]
8
8
  end
9
9
 
10
10
  # Create a Snapshot.
@@ -4,7 +4,9 @@
4
4
  <tr>
5
5
  <th class="col-md-1"><%= _('Snapshot') %></th>
6
6
  <th class="col-md-2"><%= _('Description') %></th>
7
- <th class="col-md-1"><%= _('Include RAM') %></th>
7
+ <% if @host.compute_resource.capable?(:snapshot_include_ram) %>
8
+ <th class="col-md-1"><%= _('Include RAM') %></th>
9
+ <% end %>
8
10
  <th class="col-md-1"><%= _('Action') %></th>
9
11
  </tr>
10
12
  </thead>
@@ -17,9 +19,11 @@
17
19
  <td>
18
20
  <%= f.text_field :description, class: 'form-control' %>
19
21
  </td>
20
- <td>
21
- <%= f.check_box :include_ram, class: 'form-control' %>
22
- </td>
22
+ <% if @host.compute_resource.capable?(:snapshot_include_ram) %>
23
+ <td>
24
+ <%= f.check_box :include_ram, class: 'form-control' %>
25
+ </td>
26
+ <% end %>
23
27
  <td>
24
28
  <%= f.submit _('Create'), class: 'btn btn-success', :onclick => "$(this).attr('disabled', 'disabled'); $(this).parents('form').submit();" %>
25
29
  </td>
@@ -28,7 +32,7 @@
28
32
  <% @snapshots.each do |snapshot| %>
29
33
  <tr>
30
34
  <td>
31
- <% if authorized_for(:auth_object => @host, :permission => :edit_snapshots) %>
35
+ <% if authorized_for(:auth_object => @host, :permission => :edit_snapshots) && @host.compute_resource.capable?(:editable_snapshot_name) %>
32
36
  <%= edit_textfield snapshot, :name %>
33
37
  <% else %>
34
38
  <%= snapshot.name %>
@@ -42,8 +46,10 @@
42
46
  <%= snapshot.description %>
43
47
  <% end %>
44
48
  </td>
45
- <td>
46
- </td>
49
+ <% if @host.compute_resource.capable?(:snapshot_include_ram) %>
50
+ <td>
51
+ </td>
52
+ <% end %>
47
53
  <td>
48
54
  <%= action_buttons(
49
55
  display_link_if_authorized(_('Rollback'), hash_for_revert_host_snapshot_path(host_id: @host, id: snapshot.id).merge(:auth_object => @host, :permission => :revert_snapshots), method: :put, class: 'btn btn-primary', data: {confirm: _('Are you sure to revert this Snapshot?'), 'disable-with': _('Reverting...')}),
@@ -43,14 +43,18 @@ module ForemanSnapshotManagement
43
43
  end
44
44
 
45
45
  # Adds roles if they do not exist
46
- role 'Snapshot Viewer', [:view_snapshots]
47
- role 'Snapshot Manager', [
48
- :view_snapshots,
49
- :create_snapshots,
50
- :edit_snapshots,
51
- :destroy_snapshots,
52
- :revert_snapshots
53
- ]
46
+ role 'Snapshot Viewer',
47
+ [:view_snapshots],
48
+ 'Role granting permission only to view snapshots for hosts'
49
+ role 'Snapshot Manager',
50
+ [
51
+ :view_snapshots,
52
+ :create_snapshots,
53
+ :edit_snapshots,
54
+ :destroy_snapshots,
55
+ :revert_snapshots
56
+ ],
57
+ 'Role granting permission to manage snapshots for hosts'
54
58
 
55
59
  extend_page('hosts/show') do |context|
56
60
  context.add_pagelet :main_tabs,
@@ -81,13 +85,27 @@ module ForemanSnapshotManagement
81
85
  config.to_prepare do
82
86
  begin
83
87
  # Load Foreman extensions
84
- ::Foreman::Model::Vmware.prepend(ForemanSnapshotManagement::VmwareExtensions)
85
- ::HostsHelper.prepend(ForemanSnapshotManagement::HostsHelperExtension)
88
+ ::HostsHelper.prepend ForemanSnapshotManagement::HostsHelperExtension
86
89
 
87
- # Load Fog extensions
88
- if Foreman::Model::Vmware.available?
89
- ForemanSnapshotManagement.fog_vsphere_namespace::Real.prepend(FogExtensions::Vsphere::Snapshots::Real)
90
- ForemanSnapshotManagement.fog_vsphere_namespace::Mock.prepend(FogExtensions::Vsphere::Snapshots::Mock)
90
+ begin
91
+ ::ForemanFogProxmox::Proxmox.prepend ForemanSnapshotManagement::ProxmoxExtensions
92
+
93
+ # Load Fog extensions
94
+ Fog::Proxmox::Compute::Mock.prepend FogExtensions::Proxmox::Snapshots::Mock if ForemanFogProxmox::Proxmox.available?
95
+ rescue StandardError => e
96
+ Rails.logger.warn "Failed to load Proxmox extension #{e}"
97
+ end
98
+
99
+ begin
100
+ ::Foreman::Model::Vmware.prepend ForemanSnapshotManagement::VmwareExtensions
101
+
102
+ # Load Fog extensions
103
+ if Foreman::Model::Vmware.available?
104
+ ForemanSnapshotManagement.fog_vsphere_namespace::Real.prepend FogExtensions::Vsphere::Snapshots::Real
105
+ ForemanSnapshotManagement.fog_vsphere_namespace::Mock.prepend FogExtensions::Vsphere::Snapshots::Mock
106
+ end
107
+ rescue StandardError => e
108
+ Rails.logger.warn "Failed to load VMware extension #{e}"
91
109
  end
92
110
  rescue StandardError => e
93
111
  Rails.logger.warn "ForemanSnapshotManagement: skipping engine hook (#{e})"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ForemanSnapshotManagement
4
- VERSION = '1.7.0'
4
+ VERSION = '1.7.1'
5
5
  end
@@ -1,136 +1,162 @@
1
- # German translations for foreman_snapshot_management package.
2
- # Copyright (C) 2019 THE PACKAGE'S COPYRIGHT HOLDER
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
3
  # This file is distributed under the same license as the foreman_snapshot_management package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
5
  #
6
+ # Translators:
7
+ # Lukáš Zapletal, 2019
8
+ # Ettore Atalan <atalanttore@googlemail.com>, 2019
9
+ # Wiederoder <stefanwiederoder@googlemail.com>, 2019
10
+ # Bryan Kearney <bryan.kearney@gmail.com>, 2019
11
+ # Martin Zimmermann <martin.zimmermann@gmx.com>, 2019
12
+ # Markus Bucher <bucher@atix.de>, 2020
13
+ #
14
+ #, fuzzy
6
15
  msgid ""
7
16
  msgstr ""
8
- "Project-Id-Version: foreman_snapshot_management 1.0.0\n"
17
+ "Project-Id-Version: foreman_snapshot_management 1.7.0\n"
9
18
  "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"
19
+ "PO-Revision-Date: 2019-10-22 11:54+0000\n"
20
+ "Last-Translator: Markus Bucher <bucher@atix.de>, 2020\n"
21
+ "Language-Team: German (https://www.transifex.com/foreman/teams/114/de/)\n"
14
22
  "MIME-Version: 1.0\n"
15
23
  "Content-Type: text/plain; charset=UTF-8\n"
16
24
  "Content-Transfer-Encoding: 8bit\n"
17
- "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
- "\n"
25
+ "Language: de\n"
26
+ "Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
27
 
20
28
  msgid "Action"
21
- msgstr ""
29
+ msgstr "Aktion"
22
30
 
23
31
  msgid "Are you sure to delete this Snapshot?"
24
- msgstr ""
32
+ msgstr "Wollen Sie diesen Snapshot wirklich löschen?"
25
33
 
26
34
  msgid "Are you sure to revert this Snapshot?"
27
- msgstr ""
35
+ msgstr "Sind Sie sicher, dass Sie diesen Snapshot wiederherstellen wollen?"
28
36
 
29
37
  msgid "Create"
30
- msgstr ""
38
+ msgstr "Erstellen"
31
39
 
32
40
  msgid "Create Snapshot"
33
- msgstr ""
41
+ msgstr "Snapshot erstellen"
34
42
 
35
43
  msgid "Create a snapshot"
36
- msgstr ""
44
+ msgstr "Einen Snapshot erstellen"
37
45
 
38
46
  msgid "Created %{snapshots} for %{num} %{hosts}"
39
- msgstr ""
47
+ msgstr "%{snapshots} für %{num} %{hosts} erstellt"
40
48
 
41
49
  msgid "Delete a snapshot"
42
- msgstr ""
50
+ msgstr "Snapshot löschen"
43
51
 
44
52
  msgid "Deleting..."
45
- msgstr ""
53
+ msgstr "Löschen..."
46
54
 
47
55
  msgid "Description"
48
- msgstr ""
56
+ msgstr "Beschreibung"
49
57
 
50
58
  msgid "Description of this snapshot"
51
- msgstr ""
59
+ msgstr "Beschreibung dieses Snapshots"
52
60
 
53
61
  msgid "Error occurred while creating Snapshot for:%s"
54
- msgstr ""
62
+ msgstr "Beim Erzeugen des Snapshots ist ein Fehler aufgetreten: %s"
55
63
 
56
64
  msgid "Error occurred while creating Snapshot: %s"
57
- msgstr ""
65
+ msgstr "Beim Erzeugen des Snaphosts ist ein Fehler aufgetreten: %s"
58
66
 
59
67
  msgid "Error occurred while removing Snapshot: %s"
60
- msgstr ""
68
+ msgstr "Beim Löschen des Snapshots ist ein Fehler aufgetreten: %s"
61
69
 
62
70
  msgid "Error occurred while rolling back VM: %s"
63
- msgstr ""
71
+ msgstr "Beim Zurücksetzen der VM ist ein Fehler aufgetreten: %s"
64
72
 
65
73
  msgid "Failed to update Snapshot: %s"
66
- msgstr ""
74
+ msgstr "Das Aktualisieren des Snapshots ist fehlgeschlagen: %s"
67
75
 
68
- msgid "Foreman-plugin to manage snapshots in a vSphere environment."
69
- msgstr ""
76
+ msgid "Foreman-plugin to manage snapshots in a virtual-hardware environments."
77
+ msgstr "Ein Foremanplugin, welches Snapshots in Umgebungen mit virtueller Hardware nutzbar macht."
70
78
 
71
79
  msgid "Include RAM"
72
- msgstr ""
80
+ msgstr "RAM einbeziehen"
73
81
 
74
82
  msgid "List all snapshots"
75
- msgstr ""
83
+ msgstr "Alle Snapshots auflisten"
76
84
 
77
85
  msgid "Loading Snapshots information ..."
78
- msgstr ""
86
+ msgstr "Lade Snapshot Informationen ..."
87
+
88
+ msgid "Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _"
89
+ msgstr "Der Name muss aus mindestens 2 Zeichen bestehen und mit einem Buchstaben beginnen. Gültige Zeichen: A-Z a-z 0-9 _"
79
90
 
80
91
  msgid "Name of this snapshot"
81
- msgstr ""
92
+ msgstr "Name dieses Snapshots"
82
93
 
83
94
  msgid "No capable hosts found."
84
- msgstr ""
95
+ msgstr "Kein unterstützter Host gefunden."
85
96
 
86
97
  msgid "No capable hosts selected"
87
- msgstr ""
98
+ msgstr "Keine unterstützten Hosts ausgewählt"
88
99
 
89
100
  msgid "No hosts were found with that id, name or query filter"
90
- msgstr ""
101
+ msgstr "Keine Hosts wurden mit dieser Kennung, Name oder Abfrage-Filter gefunden"
91
102
 
92
103
  msgid "Revert Host to a snapshot"
93
- msgstr ""
104
+ msgstr "Host auf einen Snapshot zurücksetzen"
94
105
 
95
106
  msgid "Reverting..."
96
- msgstr ""
107
+ msgstr "Zurücksetzen..."
97
108
 
98
109
  msgid "Rollback"
99
- msgstr ""
110
+ msgstr "Wiederherstellen"
100
111
 
101
112
  msgid "Snapshot"
102
113
  msgid_plural "Snapshots"
103
- msgstr[0] ""
104
- msgstr[1] ""
114
+ msgstr[0] "Snapshot"
115
+ msgstr[1] "Snapshots"
116
+
117
+ msgid "Snapshot name cannot be changed"
118
+ msgstr "Der Name des Snapshots kann nicht geändert werden"
105
119
 
106
120
  msgid "Snapshots"
107
- msgstr ""
121
+ msgstr "Snapshots"
108
122
 
109
123
  msgid "Something went wrong while selecting hosts - %s"
110
- msgstr ""
124
+ msgstr "Fehler beim Auswählen der Hosts – %s"
125
+
126
+ msgid "Unable to create Proxmox Snapshot"
127
+ msgstr "Proxmox Snapshot konnte nicht erstellt werden"
111
128
 
112
129
  msgid "Unable to create VMWare Snapshot"
113
- msgstr ""
130
+ msgstr "VMWare Snapshot konnte nicht erstellt werden"
131
+
132
+ msgid "Unable to remove Proxmox Snapshot"
133
+ msgstr "Proxmox Snapshot konnte nicht gelöscht werden"
114
134
 
115
135
  msgid "Unable to remove VMWare Snapshot"
116
- msgstr ""
136
+ msgstr "VMWare Snapshot konnte nicht gelöscht werden"
137
+
138
+ msgid "Unable to revert Proxmox Snapshot"
139
+ msgstr "Proxmox Snapshot konnte nicht wiederhergestellt werden"
117
140
 
118
141
  msgid "Unable to revert VMWare Snapshot"
119
- msgstr ""
142
+ msgstr "VMWare Snapshot konnte nicht wiederhergestellt werden"
143
+
144
+ msgid "Unable to update Proxmox Snapshot"
145
+ msgstr "Proxmox Snapshot konnte nicht aktualisiert werden"
120
146
 
121
147
  msgid "Unable to update VMWare Snapshot"
122
- msgstr ""
148
+ msgstr "VMWare Snapshot konnte nicht aktualisiert werden"
123
149
 
124
150
  msgid "Update a snapshot"
125
- msgstr ""
151
+ msgstr "Snapshot aktualisieren"
126
152
 
127
153
  msgid "VM successfully rolled back."
128
- msgstr ""
154
+ msgstr "Die VM wurde erfolgreich zurückgesetzt."
129
155
 
130
156
  msgid "Whether to include the RAM state in the snapshot"
131
- msgstr ""
157
+ msgstr "Ob auch der aktuelle Hauptspeicherstand im Snapshot gespeichert werden soll"
132
158
 
133
159
  msgid "host"
134
160
  msgid_plural "hosts"
135
- msgstr[0] ""
136
- msgstr[1] ""
161
+ msgstr[0] "Host"
162
+ msgstr[1] "Hosts"
@@ -1,19 +1,21 @@
1
- # foreman_snapshot_management
2
- #
3
- # This file is distributed under the same license as foreman_snapshot_management.
1
+ # English translations for foreman_snapshot_management package.
2
+ # Copyright (C) 2020 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>, 2020.
4
5
  #
5
6
  msgid ""
6
7
  msgstr ""
7
- "Project-Id-Version: version 0.0.1\n"
8
+ "Project-Id-Version: foreman_snapshot_management 1.7.0\n"
8
9
  "Report-Msgid-Bugs-To: \n"
9
- "PO-Revision-Date: 2014-08-20 08:54+0100\n"
10
- "Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
11
- "Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
12
- "Language: \n"
10
+ "PO-Revision-Date: 2020-03-02 10:27+0000\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: English\n"
13
+ "Language: en\n"
13
14
  "MIME-Version: 1.0\n"
14
15
  "Content-Type: text/plain; charset=UTF-8\n"
15
16
  "Content-Transfer-Encoding: 8bit\n"
16
- "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "\n"
17
19
 
18
20
  msgid "Action"
19
21
  msgstr ""
@@ -63,7 +65,7 @@ msgstr ""
63
65
  msgid "Failed to update Snapshot: %s"
64
66
  msgstr ""
65
67
 
66
- msgid "Foreman-plugin to manage snapshots in a vSphere environment."
68
+ msgid "Foreman-plugin to manage snapshots in a virtual-hardware environments."
67
69
  msgstr ""
68
70
 
69
71
  msgid "Include RAM"
@@ -75,6 +77,9 @@ msgstr ""
75
77
  msgid "Loading Snapshots information ..."
76
78
  msgstr ""
77
79
 
80
+ msgid "Name must contain at least 2 characters starting with alphabet. Valid characters are A-Z a-z 0-9 _"
81
+ msgstr ""
82
+
78
83
  msgid "Name of this snapshot"
79
84
  msgstr ""
80
85
 
@@ -101,21 +106,36 @@ msgid_plural "Snapshots"
101
106
  msgstr[0] ""
102
107
  msgstr[1] ""
103
108
 
109
+ msgid "Snapshot name cannot be changed"
110
+ msgstr ""
111
+
104
112
  msgid "Snapshots"
105
113
  msgstr ""
106
114
 
107
115
  msgid "Something went wrong while selecting hosts - %s"
108
116
  msgstr ""
109
117
 
118
+ msgid "Unable to create Proxmox Snapshot"
119
+ msgstr ""
120
+
110
121
  msgid "Unable to create VMWare Snapshot"
111
122
  msgstr ""
112
123
 
124
+ msgid "Unable to remove Proxmox Snapshot"
125
+ msgstr ""
126
+
113
127
  msgid "Unable to remove VMWare Snapshot"
114
128
  msgstr ""
115
129
 
130
+ msgid "Unable to revert Proxmox Snapshot"
131
+ msgstr ""
132
+
116
133
  msgid "Unable to revert VMWare Snapshot"
117
134
  msgstr ""
118
135
 
136
+ msgid "Unable to update Proxmox Snapshot"
137
+ msgstr ""
138
+
119
139
  msgid "Unable to update VMWare Snapshot"
120
140
  msgstr ""
121
141
 
@@ -8,8 +8,8 @@ msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: foreman_snapshot_management 1.0.0\n"
10
10
  "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2019-10-22 13:22+0000\n"
12
- "PO-Revision-Date: 2019-10-22 13:22+0000\n"
11
+ "POT-Creation-Date: 2020-03-02 15:24+0000\n"
12
+ "PO-Revision-Date: 2020-03-02 15:24+0000\n"
13
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
15
  "Language: \n"
@@ -22,31 +22,31 @@ msgstr ""
22
22
  msgid "List all snapshots"
23
23
  msgstr ""
24
24
 
25
- #: ../app/controllers/api/v2/snapshots_controller.rb:27
25
+ #: ../app/controllers/api/v2/snapshots_controller.rb:41
26
26
  msgid "Name of this snapshot"
27
27
  msgstr ""
28
28
 
29
- #: ../app/controllers/api/v2/snapshots_controller.rb:28
29
+ #: ../app/controllers/api/v2/snapshots_controller.rb:42
30
30
  msgid "Description of this snapshot"
31
31
  msgstr ""
32
32
 
33
- #: ../app/controllers/api/v2/snapshots_controller.rb:32
33
+ #: ../app/controllers/api/v2/snapshots_controller.rb:46
34
34
  msgid "Create a snapshot"
35
35
  msgstr ""
36
36
 
37
- #: ../app/controllers/api/v2/snapshots_controller.rb:34
37
+ #: ../app/controllers/api/v2/snapshots_controller.rb:48
38
38
  msgid "Whether to include the RAM state in the snapshot"
39
39
  msgstr ""
40
40
 
41
- #: ../app/controllers/api/v2/snapshots_controller.rb:42
41
+ #: ../app/controllers/api/v2/snapshots_controller.rb:56
42
42
  msgid "Update a snapshot"
43
43
  msgstr ""
44
44
 
45
- #: ../app/controllers/api/v2/snapshots_controller.rb:51
45
+ #: ../app/controllers/api/v2/snapshots_controller.rb:65
46
46
  msgid "Delete a snapshot"
47
47
  msgstr ""
48
48
 
49
- #: ../app/controllers/api/v2/snapshots_controller.rb:59
49
+ #: ../app/controllers/api/v2/snapshots_controller.rb:73
50
50
  msgid "Revert Host to a snapshot"
51
51
  msgstr ""
52
52
 
@@ -79,7 +79,7 @@ msgid "Created %{snapshots} for %{num} %{hosts}"
79
79
  msgstr ""
80
80
 
81
81
  #: ../app/controllers/foreman_snapshot_management/snapshots_controller.rb:95
82
- #: ../app/models/foreman_snapshot_management/snapshot.rb:56
82
+ #: ../app/models/foreman_snapshot_management/snapshot.rb:52
83
83
  #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:5
84
84
  #: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:8
85
85
  msgid "Snapshot"
@@ -110,6 +110,32 @@ msgstr ""
110
110
  msgid "Create Snapshot"
111
111
  msgstr ""
112
112
 
113
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:15
114
+ msgid ""
115
+ "Name must contain at least 2 characters starting with alphabet. Valid characte"
116
+ "rs are A-Z a-z 0-9 _"
117
+ msgstr ""
118
+
119
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:22
120
+ msgid "Unable to create Proxmox Snapshot"
121
+ msgstr ""
122
+
123
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:32
124
+ msgid "Unable to remove Proxmox Snapshot"
125
+ msgstr ""
126
+
127
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:42
128
+ msgid "Unable to revert Proxmox Snapshot"
129
+ msgstr ""
130
+
131
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:49
132
+ msgid "Snapshot name cannot be changed"
133
+ msgstr ""
134
+
135
+ #: ../app/models/foreman_snapshot_management/proxmox_extensions.rb:55
136
+ msgid "Unable to update Proxmox Snapshot"
137
+ msgstr ""
138
+
113
139
  #: ../app/models/foreman_snapshot_management/vmware_extensions.rb:18
114
140
  msgid "Unable to create VMWare Snapshot"
115
141
  msgstr ""
@@ -131,36 +157,36 @@ msgstr ""
131
157
  msgid "Description"
132
158
  msgstr ""
133
159
 
134
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:7
160
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:8
135
161
  #: ../app/views/foreman_snapshot_management/snapshots/select_multiple_host.html.erb:14
136
162
  msgid "Include RAM"
137
163
  msgstr ""
138
164
 
139
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:8
165
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:10
140
166
  msgid "Action"
141
167
  msgstr ""
142
168
 
143
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:24
169
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:28
144
170
  msgid "Create"
145
171
  msgstr ""
146
172
 
147
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
173
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:55
148
174
  msgid "Rollback"
149
175
  msgstr ""
150
176
 
151
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
177
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:55
152
178
  msgid "Are you sure to revert this Snapshot?"
153
179
  msgstr ""
154
180
 
155
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:49
181
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:55
156
182
  msgid "Reverting..."
157
183
  msgstr ""
158
184
 
159
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:50
185
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:56
160
186
  msgid "Are you sure to delete this Snapshot?"
161
187
  msgstr ""
162
188
 
163
- #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:50
189
+ #: ../app/views/foreman_snapshot_management/snapshots/_index.html.erb:56
164
190
  msgid "Deleting..."
165
191
  msgstr ""
166
192
 
@@ -173,10 +199,10 @@ msgstr ""
173
199
  msgid "Loading Snapshots information ..."
174
200
  msgstr ""
175
201
 
176
- #: ../lib/foreman_snapshot_management/engine.rb:57
202
+ #: ../lib/foreman_snapshot_management/engine.rb:61
177
203
  msgid "Snapshots"
178
204
  msgstr ""
179
205
 
180
206
  #: gemspec.rb:4
181
- msgid "Foreman-plugin to manage snapshots in a vSphere environment."
207
+ msgid "Foreman-plugin to manage snapshots in a virtual-hardware environments."
182
208
  msgstr ""
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Matches foreman_snapshot_management.gemspec
4
- _('Foreman-plugin to manage snapshots in a vSphere environment.')
4
+ _('Foreman-plugin to manage snapshots in a virtual-hardware environments.')
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'test_helper'
3
+ require 'test_plugin_helper'
4
4
 
5
5
  class Api::V2::SnapshotsControllerTest < ActionController::TestCase
6
6
  let(:tax_location) { Location.find_by(name: 'Location 1') }
@@ -12,10 +12,17 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
12
12
  let(:uuid) { '5032c8a5-9c5e-ba7a-3804-832a03e16381' }
13
13
  let(:host) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid) }
14
14
  let(:snapshot_id) { 'snapshot-0101' }
15
+ let(:proxmox_compute_resource) do
16
+ FactoryBot.create(:proxmox_cr)
17
+ ComputeResource.find_by(type: 'ForemanFogProxmox::Proxmox')
18
+ end
19
+ let(:vmid) { '100' }
20
+ let(:proxmox_host) { FactoryBot.create(:host, :managed, :compute_resource => proxmox_compute_resource, :uuid => vmid) }
21
+ let(:proxmox_snapshot) { 'snapshot1' }
15
22
  setup { ::Fog.mock! }
16
23
  teardown { ::Fog.unmock! }
17
24
 
18
- test 'should get index' do
25
+ test 'should get index of Vmware Snapshots' do
19
26
  get :index, params: { :host_id => host.to_param }
20
27
  assert_response :success
21
28
  assert_not_nil assigns(:snapshots)
@@ -24,7 +31,17 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
24
31
  assert_not_empty body['results']
25
32
  end
26
33
 
27
- test 'should search snapshot' do
34
+ test 'should get index of Proxmox Snapshots' do
35
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
36
+ get :index, params: { :host_id => proxmox_host.to_param }
37
+ assert_response :success
38
+ assert_not_nil assigns(:snapshots)
39
+ body = ActiveSupport::JSON.decode(@response.body)
40
+ assert_not_empty body
41
+ assert_not_empty body['results']
42
+ end
43
+
44
+ test 'should search VMware snapshot' do
28
45
  get :index, params: { :host_id => host.to_param, :search => 'name= clean' }
29
46
  assert_response :success
30
47
  assert_not_nil assigns(:snapshots)
@@ -34,12 +51,23 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
34
51
  assert body['results'].count == 1
35
52
  end
36
53
 
37
- test 'should refute search snapshot' do
54
+ test 'should search Proxmox snapshot' do
55
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
56
+ get :index, params: { :host_id => proxmox_host.to_param, :search => 'name= snapshot1' }
57
+ assert_response :success
58
+ assert_not_nil assigns(:snapshots)
59
+ body = ActiveSupport::JSON.decode(@response.body)
60
+ assert_not_empty body
61
+ assert_not_empty body['results']
62
+ assert body['results'].count == 1
63
+ end
64
+
65
+ test 'should refute search Vmware snapshot' do
38
66
  get :index, params: { :host_id => host.to_param, :search => 'name != clean' }
39
67
  assert_response :internal_server_error
40
68
  end
41
69
 
42
- test 'should show snapshot' do
70
+ test 'should show Vmware snapshot' do
43
71
  get :show, params: { :host_id => host.to_param, :id => snapshot_id }
44
72
  assert_not_nil assigns(:snapshot)
45
73
  assert_response :success
@@ -47,30 +75,75 @@ class Api::V2::SnapshotsControllerTest < ActionController::TestCase
47
75
  assert_not_empty body
48
76
  end
49
77
 
50
- test 'should 404 for unknown snapshot' do
78
+ test 'should show Proxmox snapshot' do
79
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
80
+ get :show, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot }
81
+ assert_not_nil assigns(:snapshot)
82
+ assert_response :success
83
+ body = ActiveSupport::JSON.decode(@response.body)
84
+ assert_not_empty body
85
+ end
86
+
87
+ test 'should 404 for unknown Vmware snapshot' do
51
88
  get :show, params: { :host_id => host.to_param, :id => 'does-not-exist' }
52
89
  assert_response :not_found
53
90
  end
54
91
 
55
- test 'should create snapshot' do
92
+ test 'should create Vmware snapshot' do
56
93
  post :create, params: { :host_id => host.to_param, :name => 'test' }
57
94
  assert_response :created
58
95
  assert_not_nil assigns(:snapshot)
59
96
  end
60
97
 
61
- test 'should update snapshot' do
98
+ test 'should create Proxmox snapshot' do
99
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
100
+ post :create, params: { :host_id => proxmox_host.to_param, :name => 'test' }
101
+ assert_response :created
102
+ assert_not_nil assigns(:snapshot)
103
+ end
104
+
105
+ test 'should update Vmware snapshot' do
62
106
  name = 'test'
63
107
  put :update, params: { :host_id => host.to_param, :id => snapshot_id.to_param, :name => name.to_param }
64
108
  assert_response :success
65
109
  end
66
110
 
67
- test 'should destroy snapshot' do
111
+ test 'should update Proxmox snapshot' do
112
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
113
+ description = 'snapshot1 updated'
114
+ put :update, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot.to_param, :description => description.to_param }
115
+ assert_response :success
116
+ end
117
+
118
+ test 'should refute update Proxmox snapshot name' do
119
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
120
+ name = 'test'
121
+ put :update, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot.to_param, :name => name.to_param }
122
+ assert_response :unprocessable_entity
123
+ end
124
+
125
+ test 'should destroy Vmware snapshot' do
68
126
  delete :destroy, params: { :host_id => host.to_param, :id => snapshot_id.to_param }
69
127
  assert_response :success
70
128
  end
71
129
 
72
- test 'should revert snapshot' do
130
+ test 'should destroy Proxmox snapshot' do
131
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
132
+ delete :destroy, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot.to_param }
133
+ assert_response :success
134
+ body = ActiveSupport::JSON.decode(@response.body)
135
+ assert_not_nil body['name']
136
+ assert_nil body['id']
137
+ end
138
+
139
+ test 'should revert Vmware snapshot' do
73
140
  put :revert, params: { :host_id => host.to_param, :id => snapshot_id.to_param }
74
141
  assert_response :success
75
142
  end
143
+
144
+ test 'should revert Proxmox snapshot' do
145
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
146
+ put :revert, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot.to_param }
147
+ assert_response :success
148
+ end
76
149
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'test_helper'
3
+ require 'test_plugin_helper'
4
4
 
5
5
  module ForemanSnapshotManagement
6
6
  class SnapshotsControllerTest < ActionController::TestCase
@@ -15,25 +15,47 @@ module ForemanSnapshotManagement
15
15
  let(:host) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid) }
16
16
  let(:host2) { FactoryBot.create(:host, :managed, :compute_resource => compute_resource, :uuid => uuid2) }
17
17
  let(:snapshot_id) { 'snapshot-0101' }
18
+ let(:proxmox_compute_resource) do
19
+ FactoryBot.create(:proxmox_cr)
20
+ ComputeResource.find_by(type: 'ForemanFogProxmox::Proxmox')
21
+ end
22
+ let(:vmid) { '100' }
23
+ let(:proxmox_host) { FactoryBot.create(:host, :managed, :compute_resource => proxmox_compute_resource, :uuid => vmid) }
24
+ let(:proxmox_snapshot) { 'snapshot1' }
18
25
  setup { ::Fog.mock! }
19
26
  teardown { ::Fog.unmock! }
20
27
 
21
28
  context 'GET #index' do
22
- test 'should get index' do
29
+ test 'should get VMware snapshot index' do
23
30
  get :index, params: { :host_id => host.to_param }, session: set_session_user
24
31
  assert_response :success
25
32
  assert_not_nil assigns(:snapshots)
26
33
  assert_template 'foreman_snapshot_management/snapshots/_index'
27
34
  end
35
+
36
+ test 'should get Proxmox index' do
37
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
38
+ get :index, params: { :host_id => proxmox_host.to_param }, session: set_session_user
39
+ assert_response :success
40
+ assert_not_nil assigns(:snapshots)
41
+ assert_template 'foreman_snapshot_management/snapshots/_index'
42
+ end
28
43
  end
29
44
 
30
45
  context 'POST #create' do
31
- test 'create valid' do
46
+ test 'create valid VMware snapshot' do
32
47
  post :create, params: { :host_id => host.to_param, :snapshot => { :name => 'test' } }, session: set_session_user
33
48
  assert_redirected_to host_url(host, :anchor => 'snapshots')
34
49
  assert_includes flash[:notice] || flash[:success], 'Successfully created Snapshot.'
35
50
  end
36
51
 
52
+ test 'create valid proxmox snapshot' do
53
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
54
+ post :create, params: { :host_id => proxmox_host.to_param, :snapshot => { :name => 'test' } }, session: set_session_user
55
+ assert_redirected_to host_url(proxmox_host, :anchor => 'snapshots')
56
+ assert_includes flash[:notice] || flash[:success], 'Successfully created Snapshot.'
57
+ end
58
+
37
59
  test 'create valid multiple' do
38
60
  post :create_multiple_host, params: { :host_ids => [host.id, host2.id], :snapshot => { :name => 'test' } }, session: set_session_user
39
61
  assert_redirected_to hosts_url
@@ -62,6 +84,13 @@ module ForemanSnapshotManagement
62
84
  assert_includes flash[:notice] || flash[:success], 'Successfully deleted Snapshot.'
63
85
  end
64
86
 
87
+ test 'destroy successful' do
88
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
89
+ delete :destroy, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot }, session: set_session_user
90
+ assert_redirected_to host_url(proxmox_host, :anchor => 'snapshots')
91
+ assert_includes flash[:notice] || flash[:success], 'Successfully deleted Snapshot.'
92
+ end
93
+
65
94
  test 'destroy with error' do
66
95
  ForemanSnapshotManagement::Snapshot.any_instance.stubs(:destroy).returns(false)
67
96
  delete :destroy, params: { :host_id => host.to_param, :id => snapshot_id }, session: set_session_user
@@ -71,12 +100,19 @@ module ForemanSnapshotManagement
71
100
  end
72
101
 
73
102
  context 'PUT #revert' do
74
- test 'revert successful' do
103
+ test 'revert successful VMware' do
75
104
  put :revert, params: { :host_id => host.to_param, :id => snapshot_id }, session: set_session_user
76
105
  assert_redirected_to host_url(host, :anchor => 'snapshots')
77
106
  assert_includes flash[:notice] || flash[:success], 'VM successfully rolled back.'
78
107
  end
79
108
 
109
+ test 'revert successful proxmox snapshot' do
110
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
111
+ put :revert, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot }, session: set_session_user
112
+ assert_redirected_to host_url(proxmox_host, :anchor => 'snapshots')
113
+ assert_includes flash[:notice] || flash[:success], 'VM successfully rolled back.'
114
+ end
115
+
80
116
  test 'revert with error' do
81
117
  ForemanSnapshotManagement::Snapshot.any_instance.stubs(:revert).returns(false)
82
118
  put :revert, params: { :host_id => host.to_param, :id => snapshot_id }, session: set_session_user
@@ -86,7 +122,7 @@ module ForemanSnapshotManagement
86
122
  end
87
123
 
88
124
  context 'PUT #update' do
89
- test 'update successful' do
125
+ test 'update successful VMware snapsoht' do
90
126
  data = { 'name' => 'test 2', 'description' => '' }
91
127
  put :update, params: { :host_id => host.to_param, :id => snapshot_id, :snapshot => data }, session: set_session_user
92
128
  assert_response :success
@@ -94,11 +130,27 @@ module ForemanSnapshotManagement
94
130
  assert_equal(data, body)
95
131
  end
96
132
 
97
- test 'update with error' do
133
+ test 'update successful proxmox' do
134
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
135
+ data = { 'name' => 'snapshot1', 'description' => 'updated snapshot1' }
136
+ put :update, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot, :snapshot => data }, session: set_session_user
137
+ assert_response :success
138
+ body = ActiveSupport::JSON.decode(@response.body)
139
+ assert_equal(data, body)
140
+ end
141
+
142
+ test 'update with error VMware snapshot' do
98
143
  ForemanSnapshotManagement::Snapshot.any_instance.stubs(:save).returns(false)
99
144
  put :update, params: { :host_id => host.to_param, :id => snapshot_id, :snapshot => { :name => 'test 2' } }, session: set_session_user
100
145
  assert_response :unprocessable_entity
101
146
  end
147
+
148
+ test 'update with error proxmox snapshot' do
149
+ Host::Managed.any_instance.stubs(:vm_exists?).returns(false)
150
+ ForemanSnapshotManagement::Snapshot.any_instance.stubs(:save).returns(false)
151
+ put :update, params: { :host_id => proxmox_host.to_param, :id => proxmox_snapshot, :snapshot => { :name => 'snapshot1', :description => 'fail' } }, session: set_session_user
152
+ assert_response :unprocessable_entity
153
+ end
102
154
  end
103
155
  end
104
156
  end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ FactoryBot.define do
4
+ factory :proxmox_resource, :class => ComputeResource do
5
+ sequence(:name) { |n| "compute_resource#{n}" }
6
+ organizations { [Organization.find_by(name: 'Organization 1')] }
7
+ locations { [Location.find_by(name: 'Location 1')] }
8
+
9
+ trait :proxmox do
10
+ provider { 'Proxmox' }
11
+ user { 'root@pam' }
12
+ password { 'proxmox01' }
13
+ url { 'https://192.168.56.101:8006/api2/json' }
14
+ end
15
+
16
+ factory :proxmox_cr, :class => ForemanFogProxmox::Proxmox, :traits => [:proxmox]
17
+ end
18
+ end
@@ -2,3 +2,6 @@
2
2
 
3
3
  # This calls the main test_helper in Foreman-core
4
4
  require 'test_helper'
5
+
6
+ FactoryBot.definition_file_paths << File.join(File.dirname(__FILE__), 'factories')
7
+ FactoryBot.reload
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.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ATIX AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-22 00:00:00.000000000 Z
11
+ date: 2020-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.75.0
41
- description: Foreman-plugin to manage snapshots in a vSphere environment.
41
+ description: Foreman-plugin to manage snapshots in a virtual-hardware environments.
42
42
  email:
43
43
  - info@atix.de
44
44
  executables: []
@@ -53,8 +53,10 @@ files:
53
53
  - app/controllers/foreman_snapshot_management/snapshots_controller.rb
54
54
  - app/helpers/concerns/foreman_snapshot_management/hosts_helper_extension.rb
55
55
  - app/helpers/foreman_snapshot_management/snapshot_helper.rb
56
+ - app/models/concerns/fog_extensions/proxmox/snapshots/mock.rb
56
57
  - app/models/concerns/fog_extensions/vsphere/snapshots/mock.rb
57
58
  - app/models/concerns/fog_extensions/vsphere/snapshots/real.rb
59
+ - app/models/foreman_snapshot_management/proxmox_extensions.rb
58
60
  - app/models/foreman_snapshot_management/snapshot.rb
59
61
  - app/models/foreman_snapshot_management/vmware_extensions.rb
60
62
  - app/views/api/v2/snapshots/base.json.rabl
@@ -74,16 +76,20 @@ files:
74
76
  - lib/foreman_snapshot_management/version.rb
75
77
  - lib/tasks/foreman_snapshot_management_tasks.rake
76
78
  - locale/Makefile
79
+ - locale/de/LC_MESSAGES/foreman_snapshot_management.mo
77
80
  - locale/de/foreman_snapshot_management.po
81
+ - locale/en/LC_MESSAGES/foreman_snapshot_management.mo
78
82
  - locale/en/foreman_snapshot_management.edit.po
79
83
  - locale/en/foreman_snapshot_management.po
80
84
  - locale/foreman_snapshot_management.pot
81
85
  - locale/gemspec.rb
82
86
  - test/controllers/api/v2/snapshots_test.rb
83
87
  - test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
88
+ - test/factories/proxmox_factory.rb
84
89
  - test/test_plugin_helper.rb
85
90
  homepage: https://www.orcharhino.com
86
- licenses: []
91
+ licenses:
92
+ - GPL-3.0-only
87
93
  metadata: {}
88
94
  post_install_message:
89
95
  rdoc_options: []
@@ -100,12 +106,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
106
  - !ruby/object:Gem::Version
101
107
  version: '0'
102
108
  requirements: []
103
- rubyforge_project:
104
- rubygems_version: 2.7.6.2
109
+ rubygems_version: 3.0.6
105
110
  signing_key:
106
111
  specification_version: 4
107
- summary: Snapshot Management for VMware vSphere
112
+ summary: Snapshot Management for machines on virtualization-platforms
108
113
  test_files:
109
114
  - test/controllers/api/v2/snapshots_test.rb
110
115
  - test/controllers/foreman_snapshot_management/snapshots_controller_test.rb
111
116
  - test/test_plugin_helper.rb
117
+ - test/factories/proxmox_factory.rb