foreman_fog_proxmox 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of foreman_fog_proxmox might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1304ab366464cb132705a6d4b31dc6473d52c30e44dd50118d14eb2ef1f64ed6
4
- data.tar.gz: 8d3791c5a478031da10323c24fd9f90c2d23dcda0d185dbece4649b5896b26dc
3
+ metadata.gz: 67b90e9d6ff96226f14cddbef179252562e82abbdb1796e0c13d5f69cfc8a3c6
4
+ data.tar.gz: c845f7e54a242b0aa0615c799e49632ee6eb65a611238deec9d1647ba938d311
5
5
  SHA512:
6
- metadata.gz: 9ef6e0f3b3670c18bc5e23d5a467df1df14e041e5036c1bca1bf8de10eb699ffa705e5934da287f6cb42e2baf2730d6a3994fecc396abcbe067941b142e5cf71
7
- data.tar.gz: 49d98f70077f0382b046f5763f12fa169c12c5e9e1b57aed84f44b4be18194a5924a75f9ab1f4c46297a400281dfd3036b16e9a8f4df3ff3db0178f41549376f
6
+ metadata.gz: 4e8cda3b7436b46cd4f64ff2d676b810943ce382d53fd6da58bfdaf3faabe310b429c1fb076bed47ee10b00386d505d4531190361e1b7bf943863f45794072de
7
+ data.tar.gz: 01a69e1955953ac427add329d4883f5b8bde2df97aae11db1972d746d9f93dd0d8a010f107cf80f804265a595ea0aa2c130a407b091546e8fe21070e27e852d1
data/README.md CHANGED
@@ -17,7 +17,8 @@ If you like it and need more features you can [support](SUPPORT.md) it.
17
17
  |Fog-proxmox|Proxmox|Foreman-fog-proxmox|Foreman|Ruby|
18
18
  |--|--|--|--|--|
19
19
  |<0.6|<5.3|<0.6|<=1.20|>=2.3|
20
- |>=0.6|=5.3|>=0.6|=1.21|>=2.3|
20
+ |=0.6|=5.3|=0.6|=1.21|>=2.3|
21
+ |=0.7|=5.4|=0.7|=1.22|>=2.3|
21
22
 
22
23
  ## Installation
23
24
 
@@ -62,7 +63,7 @@ sudo -u foreman /usr/bin/foreman-ruby /usr/bin/bundle install
62
63
  /usr/bin/foreman-ruby /usr/bin/bundle exec bin/rake plugin:gettext[foreman_fog_proxmox]
63
64
  ```
64
65
 
65
- * Complete installation of foreman 1.17+ with foreman-installer:
66
+ * Complete installation of foreman 1.22 with foreman-installer:
66
67
 
67
68
  ```shell
68
69
  sudo apt install -y foreman-installer
@@ -99,7 +100,7 @@ Redhat, CentOS or Fedora users should also [setup Selinux](https://projects.thef
99
100
 
100
101
  ### Prerequisites
101
102
 
102
- * You need a Proxmox VE >= 5.1 server running.
103
+ * You need a Proxmox VE 5.4 server running.
103
104
  * You need ruby >= 2.3. You can install it with [rbenv](https://github.com/rbenv/rbenv).
104
105
  * You also need nodejs in your dev machine to run webpack-dev-server. You can install it with [nvm](https://github.com/creationix/nvm).
105
106
 
@@ -107,11 +108,10 @@ Redhat, CentOS or Fedora users should also [setup Selinux](https://projects.thef
107
108
 
108
109
  * Fork this github repo.
109
110
  * Clone it on your local machine
110
- * Install foreman v1.21.1 on your machine:
111
+ * Install foreman v1.22 on your machine:
111
112
 
112
113
  ```shell
113
- git clone https://github.com/theforeman/foreman
114
- git checkout tags/1.21.1
114
+ git clone https://github.com/theforeman/foreman -b develop
115
115
  ```
116
116
 
117
117
  * Create a Gemfile.local.rb file in foreman/bundler.d/
@@ -97,7 +97,7 @@ module ProxmoxContainerHelper
97
97
  def parse_container_volume(args)
98
98
  disk = {}
99
99
  id = args['id']
100
- id = "mp#{args['device']}" if args.has_key?('device') && !id
100
+ id = "mp#{args['device']}" if args.has_key?('device')
101
101
  delete = args['_delete'].to_i == 1
102
102
  logger.debug("parse_container_volume() args=#{args}")
103
103
  return args if ForemanFogProxmox::Value.empty?(id) || server_disk?(id)
@@ -18,6 +18,7 @@
18
18
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  require 'fog/proxmox'
21
+ require 'foreman_fog_proxmox/semver'
21
22
 
22
23
  module ForemanFogProxmox
23
24
  class Proxmox < ComputeResource
@@ -53,7 +54,9 @@ module ForemanFogProxmox
53
54
  end
54
55
 
55
56
  def version_suitable?
56
- version == '5.3'
57
+ logger.debug(_("Proxmox compute resource version is %{version}") % { version: version })
58
+ raise ::Foreman::Exception.new(_("Proxmox version %{version} is not semver suitable") % { version: version }) unless ForemanFogProxmox::Semver.is_semver?(version)
59
+ ForemanFogProxmox::Semver.to_semver(version) >= ForemanFogProxmox::Semver.to_semver("5.3.0") && ForemanFogProxmox::Semver.to_semver(version) < ForemanFogProxmox::Semver.to_semver("5.5.0")
57
60
  end
58
61
 
59
62
  def test_connection(options = {})
@@ -152,14 +155,13 @@ module ForemanFogProxmox
152
155
  def new_volume_server(attr = {})
153
156
  opts = volume_server_defaults.merge(attr.to_h).deep_symbolize_keys
154
157
  opts[:size] = opts[:size].to_s
155
- Fog::Compute::Proxmox::Disk.new(opts)
158
+ Fog::Proxmox::Compute::Disk.new(opts)
156
159
  end
157
160
 
158
161
  def new_volume_container(attr = {})
159
- id = attr[:id]
160
- opts = volume_container_defaults(id).merge(attr.to_h).deep_symbolize_keys
162
+ opts = volume_container_defaults.merge(attr.to_h).deep_symbolize_keys
161
163
  opts[:size] = opts[:size].to_s
162
- Fog::Compute::Proxmox::Disk.new(opts)
164
+ Fog::Proxmox::Compute::Disk.new(opts)
163
165
  end
164
166
 
165
167
  def new_interface(attr = {})
@@ -176,13 +178,13 @@ module ForemanFogProxmox
176
178
  def new_server_interface(attr = {})
177
179
  logger.debug("new_server_interface")
178
180
  opts = interface_server_defaults.merge(attr.to_h).deep_symbolize_keys
179
- Fog::Compute::Proxmox::Interface.new(opts)
181
+ Fog::Proxmox::Compute::Interface.new(opts)
180
182
  end
181
183
 
182
184
  def new_container_interface(attr = {})
183
185
  logger.debug("new_container_interface")
184
186
  opts = interface_container_defaults.merge(attr.to_h).deep_symbolize_keys
185
- Fog::Compute::Proxmox::Interface.new(opts)
187
+ Fog::Proxmox::Compute::Interface.new(opts)
186
188
  end
187
189
 
188
190
  # used by host.clone
@@ -413,7 +415,8 @@ module ForemanFogProxmox
413
415
  end
414
416
 
415
417
  def version
416
- identity_client.read_version
418
+ v = identity_client.read_version
419
+ "#{v['version']}.#{v['release']}"
417
420
  end
418
421
 
419
422
  private
@@ -426,15 +429,15 @@ module ForemanFogProxmox
426
429
  end
427
430
 
428
431
  def client
429
- @client ||= ::Fog::Compute::Proxmox.new(fog_credentials)
432
+ @client ||= ::Fog::Proxmox::Compute.new(fog_credentials)
430
433
  end
431
434
 
432
435
  def identity_client
433
- @identity_client ||= ::Fog::Identity::Proxmox.new(fog_credentials)
436
+ @identity_client ||= ::Fog::Proxmox::Identity.new(fog_credentials)
434
437
  end
435
438
 
436
439
  def network_client
437
- @network_client ||= ::Fog::Network::Proxmox.new(fog_credentials)
440
+ @network_client ||= ::Fog::Proxmox::Network.new(fog_credentials)
438
441
  end
439
442
 
440
443
  def disconnect
@@ -21,5 +21,5 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
21
21
  </tr>
22
22
  <tr>
23
23
  <td><%= _("Version") %></td>
24
- <td><%= @compute_resource.version['version'] %></td>
24
+ <td><%= @compute_resource.version%></td>
25
25
  </tr>
@@ -20,7 +20,7 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
20
20
  <%= field_set_tag _("Mount point"), :id => "container_volume_#{f.index}", :class => ('hide' unless container), :disabled => !container do %>
21
21
  <%= f.hidden_field :volid if !new_vm %>
22
22
  <%= select_f f, :storage, compute_resource.storages, :storage, :storage, { }, :label => _('Storage'), :label_size => "col-md-2", :disabled => !new_vm %>
23
- <%= text_f f, :mp, :label => _('Mount point'), :label_size => "col-md-2", :disabled => !new_vm, :required => true %>
23
+ <%= text_f f, :mp, :label => _('Path'), :label_size => "col-md-2", :disabled => !new_vm, :required => true %>
24
24
  <%= counter_f f, :device, :label => _('Device'), :label_size => "col-md-2", :class => ('hide' if f.object.rootfs?), :disabled => (!new_vm || f.object.rootfs?), :'data-soft-max' => 10 %>
25
25
  <%= byte_size_f f, :size, :class => "input-mini", :label => _("Size"), :label_size => "col-md-2", :disabled => !new_vm %>
26
26
  <% end %>
@@ -35,10 +35,6 @@ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
35
35
  <%= prop :uptime %>
36
36
  <%= prop :vmid %>
37
37
  <%= prop :description %>
38
- <% if @vm.container? %>
39
- <%= prop :mount_points %>
40
- <% else %>
41
- <%= prop :disks %>
42
- <% end %>
38
+ <%= prop :disks %>
43
39
  </table>
44
40
  </div>
@@ -38,7 +38,7 @@ module ForemanFogProxmox
38
38
 
39
39
  initializer 'foreman_fog_proxmox.register_plugin', :before => :finisher_hook do |_app|
40
40
  Foreman::Plugin.register :foreman_fog_proxmox do
41
- requires_foreman '>= 1.21.0'
41
+ requires_foreman '>= 1.22.0'
42
42
  # Register Proxmox VE compute resource in foreman
43
43
  compute_resource ForemanFogProxmox::Proxmox
44
44
  parameter_filter(ComputeResource, :uuid)
@@ -85,12 +85,12 @@ module ForemanFogProxmox
85
85
  require 'fog/compute/proxmox/models/volume'
86
86
  require 'fog/compute/proxmox/models/node'
87
87
 
88
- Fog::Compute::Proxmox::Server.send :include, FogExtensions::Proxmox::Server
89
- Fog::Compute::Proxmox::ServerConfig.send :include, FogExtensions::Proxmox::ServerConfig
90
- Fog::Compute::Proxmox::Disk.send :include, FogExtensions::Proxmox::Disk
91
- Fog::Compute::Proxmox::Volume.send :include, FogExtensions::Proxmox::Volume
88
+ Fog::Proxmox::Compute::Server.send :include, FogExtensions::Proxmox::Server
89
+ Fog::Proxmox::Compute::ServerConfig.send :include, FogExtensions::Proxmox::ServerConfig
90
+ Fog::Proxmox::Compute::Disk.send :include, FogExtensions::Proxmox::Disk
91
+ Fog::Proxmox::Compute::Volume.send :include, FogExtensions::Proxmox::Volume
92
92
  ::ComputeResourcesController.send :include, ForemanFogProxmox::Controller::Parameters::ComputeResource
93
- Fog::Compute::Proxmox::Node.send :include, FogExtensions::Proxmox::Node
93
+ Fog::Proxmox::Compute::Node.send :include, FogExtensions::Proxmox::Node
94
94
  end
95
95
 
96
96
  end
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2018 Tristan Robert
4
+
5
+ # This file is part of ForemanFogProxmox.
6
+
7
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ module ForemanFogProxmox::Semver
21
+ SEMVER_REGEX = /^(\d+)[.]{1}(\d+)[.]{1}(\d+)[-]{0,1}(\w+){0,1}$/
22
+ class SemverClass
23
+ attr_accessor :major
24
+ attr_accessor :minor
25
+ attr_accessor :patch
26
+ attr_accessor :qualifier
27
+ def initialize(major,minor,patch, qualifier = '')
28
+ @major = major.to_i
29
+ @minor = minor.to_i
30
+ @patch = patch.to_i
31
+ @qualifier = qualifier.nil? ? '' : qualifier
32
+ end
33
+ def to_s
34
+ flat = "#{major}.#{minor}.#{patch}"
35
+ flat += "-#{qualifier}" unless qualifier == ''
36
+ end
37
+ def <=(other)
38
+ raise TypeError unless other.is_a?(SemverClass)
39
+ if @major == other.major
40
+ if @minor == other.minor
41
+ return @patch <= other.patch
42
+ else
43
+ return @minor <= other.minor
44
+ end
45
+ else
46
+ return @major <= other.major
47
+ end
48
+ end
49
+ def <(other)
50
+ raise TypeError unless other.is_a?(SemverClass)
51
+ if @major == other.major
52
+ if @minor == other.minor
53
+ return @patch < other.patch
54
+ else
55
+ return @minor < other.minor
56
+ end
57
+ else
58
+ return @major < other.major
59
+ end
60
+ end
61
+ def >(other)
62
+ raise TypeError unless other.is_a?(SemverClass)
63
+ if @major == other.major
64
+ if @minor == other.minor
65
+ return @patch > other.patch
66
+ else
67
+ return @minor > other.minor
68
+ end
69
+ else
70
+ return @major > other.major
71
+ end
72
+ end
73
+ def >=(other)
74
+ raise TypeError unless other.is_a?(SemverClass)
75
+ if @major == other.major
76
+ if @minor == other.minor
77
+ return @patch >= other.patch
78
+ else
79
+ return @minor >= other.minor
80
+ end
81
+ else
82
+ return @major >= other.major
83
+ end
84
+ end
85
+ def ==(other)
86
+ raise TypeError unless other.is_a?(SemverClass)
87
+ @major == other.major && @minor == other.minor && @patch == other.patch && @qualifier == other.qualifier
88
+ end
89
+ end
90
+ def self.is_semver?(version)
91
+ version.is_a?(String) && version.match(SEMVER_REGEX)
92
+ end
93
+ def self.to_semver(version)
94
+ raise ArgumentError unless self.is_semver?(version)
95
+ version_a = version.scan(SEMVER_REGEX)
96
+ raise ArgumentError if version_a.empty?
97
+ semver_a = version_a.first
98
+ raise ArgumentError if semver_a.empty?
99
+ raise ArgumentError if semver_a.size < 4
100
+ SemverClass.new(semver_a[0],semver_a[1],semver_a[2],semver_a[3])
101
+ end
102
+ end
@@ -18,5 +18,5 @@
18
18
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
19
 
20
20
  module ForemanFogProxmox
21
- VERSION = '0.6.0'.freeze
21
+ VERSION = '0.7.0'.freeze
22
22
  end
@@ -36,7 +36,7 @@ FactoryBot.define do
36
36
 
37
37
  end
38
38
 
39
- factory :node, :class => Fog::Compute::Proxmox::Node do
39
+ factory :node, :class => Fog::Proxmox::Compute::Node do
40
40
  sequence(:identity) { |n| "node#{n}" }
41
41
  trait :pve do
42
42
  identity 'pve'
@@ -44,7 +44,7 @@ FactoryBot.define do
44
44
  trait :service do
45
45
  service :proxmox_cr
46
46
  end
47
- factory :pve_node, :class => Fog::Compute::Proxmox::Node, :traits => [:pve, :service]
47
+ factory :pve_node, :class => Fog::Proxmox::Compute::Node, :traits => [:pve, :service]
48
48
  end
49
49
 
50
50
  def deferred_nic_attrs
@@ -4,7 +4,9 @@ require 'simplecov'
4
4
 
5
5
  SimpleCov.start do
6
6
  add_filter '/test/'
7
- add_group 'App', 'app'
7
+ add_group 'Controllers', 'app/controllers'
8
+ add_group 'Models', 'app/models'
9
+ add_group 'Helpers', 'app/helpers'
8
10
  add_group 'Lib', 'lib'
9
11
  end
10
12
 
@@ -54,7 +54,7 @@ class ProxmoxContainerHelperTest < ActiveSupport::TestCase
54
54
  },
55
55
  'volumes_attributes' => {
56
56
  '0'=> { 'id' => 'rootfs', 'storage' => 'local-lvm', 'size' => '1073741824', 'cache' => nil },
57
- '1'=> { 'id' => 'mp0', 'storage' => 'local-lvm', 'size' => '1073741824' }
57
+ '1'=> { 'id' => 'mp0', 'storage' => 'local-lvm', 'size' => '1073741824', 'mp' => '/opt/path' }
58
58
  },
59
59
  'interfaces_attributes' => {
60
60
  '0' => { 'id' => 'net0', 'name' => 'eth0', 'bridge' => 'vmbr0', 'ip' => 'dhcp', 'ip6' => 'dhcp', 'rate' => nil },
@@ -83,7 +83,7 @@ class ProxmoxContainerHelperTest < ActiveSupport::TestCase
83
83
  'ostemplate_file' => 'local:vztmpl/alpine-3.7-default_20171211_amd64.tar.xz',
84
84
  'password' => 'proxmox01',
85
85
  :rootfs => 'local-lvm:1073741824',
86
- :mp0 => 'local-lvm:1073741824',
86
+ :mp0 => 'local-lvm:1073741824,mp=/opt/path',
87
87
  'net0' => 'name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp',
88
88
  'net1' => 'model=eth1,bridge=vmbr0,ip=dhcp,ip6=dhcp'
89
89
  }
@@ -152,16 +152,20 @@ class ProxmoxContainerHelperTest < ActiveSupport::TestCase
152
152
  :net0 => 'name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp',
153
153
  :net1 => 'name=eth1,bridge=vmbr0,ip=dhcp,ip6=dhcp',
154
154
  :rootfs => 'local-lvm:1073741824',
155
- :mp0 => 'local-lvm:1073741824' )
155
+ :mp0 => 'local-lvm:1073741824,mp=/opt/path' )
156
156
  assert_equal expected_vm, vm
157
157
  end
158
158
 
159
159
  test '#volume with rootfs 1Gb' do
160
160
  volumes = parse_container_volumes(host['volumes_attributes'])
161
161
  assert !volumes.empty?
162
- assert volume = volumes.first
163
- assert volume.has_key?(:rootfs)
164
- assert_equal 'local-lvm:1073741824', volume[:rootfs]
162
+ assert_equal 2, volumes.size
163
+ assert rootfs = volumes.first
164
+ assert rootfs.has_key?(:rootfs)
165
+ assert_equal 'local-lvm:1073741824', rootfs[:rootfs]
166
+ assert mp0 = volumes[1]
167
+ assert mp0.has_key?(:mp0)
168
+ assert_equal 'local-lvm:1073741824,mp=/opt/path', mp0[:mp0]
165
169
  end
166
170
 
167
171
  test '#volume delete mp0' do
@@ -35,7 +35,7 @@ class ProxmoxVmHelperTest < ActiveSupport::TestCase
35
35
  service = mock('service')
36
36
  service.stubs(:get_server_config).returns(nil)
37
37
  service.stubs(:list_tasks).returns([])
38
- Fog::Compute::Proxmox::Server.new(
38
+ Fog::Proxmox::Compute::Server.new(
39
39
  { 'vmid' => '100',
40
40
  'hostname' => 'test',
41
41
  :type => 'lxc',
@@ -58,7 +58,7 @@ class ProxmoxVmHelperTest < ActiveSupport::TestCase
58
58
  service = mock('service')
59
59
  service.stubs(:get_server_config).returns(nil)
60
60
  service.stubs(:list_tasks).returns([])
61
- Fog::Compute::Proxmox::Server.new(
61
+ Fog::Proxmox::Compute::Server.new(
62
62
  { 'vmid' => '100',
63
63
  'name' => 'test',
64
64
  :node_id => 'pve',
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2018 Tristan Robert
4
+
5
+ # This file is part of ForemanFogProxmox.
6
+
7
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
8
+ # it under the terms of the GNU General Public License as published by
9
+ # the Free Software Foundation, either version 3 of the License, or
10
+ # (at your option) any later version.
11
+
12
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ # GNU General Public License for more details.
16
+
17
+ # You should have received a copy of the GNU General Public License
18
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
19
+
20
+ require 'foreman_fog_proxmox/semver'
21
+
22
+ module ForemanFogProxmox
23
+ class SemverTest < ActiveSupport::TestCase
24
+ describe 'is_semver?' do
25
+ it '#5.3.2 returns true' do
26
+ assert ForemanFogProxmox::Semver.is_semver?("5.3.2")
27
+ end
28
+ it '#5.3beta returns false' do
29
+ assert !ForemanFogProxmox::Semver.is_semver?("5.3beta")
30
+ end
31
+ end
32
+ describe 'to_semver' do
33
+ it '#5.3.2 returns SemverClass' do
34
+ semver = ForemanFogProxmox::Semver.to_semver("5.3.2")
35
+ assert_not_nil semver
36
+ assert semver.is_a?(ForemanFogProxmox::Semver::SemverClass)
37
+ assert_equal 5, semver.major
38
+ assert_equal 3, semver.minor
39
+ assert_equal 2, semver.patch
40
+ assert_equal '', semver.qualifier
41
+ end
42
+ it '#5.3beta raises ArgumentError' do
43
+ assert_raises ArgumentError do
44
+ ForemanFogProxmox::Semver.to_semver("5.3beta")
45
+ end
46
+ end
47
+ end
48
+ describe 'semverclass comparators' do
49
+ it '#5.3.0 <= 5.4.0 returns true' do
50
+ assert ForemanFogProxmox::Semver.to_semver("5.3.0")<=ForemanFogProxmox::Semver.to_semver("5.4.0")
51
+ end
52
+ it '#2.4.0 >= 1.3.0 returns true' do
53
+ assert ForemanFogProxmox::Semver.to_semver("2.4.0")>=ForemanFogProxmox::Semver.to_semver("1.3.0")
54
+ end
55
+ it '#1.0.10 <= 1.0.20 returns true' do
56
+ assert ForemanFogProxmox::Semver.to_semver("1.0.10")<=ForemanFogProxmox::Semver.to_semver("1.0.20")
57
+ end
58
+ it '#1.2.3-beta == 1.2.3-beta returns true' do
59
+ assert ForemanFogProxmox::Semver.to_semver("1.2.3-beta")==ForemanFogProxmox::Semver.to_semver("1.2.3-beta")
60
+ end
61
+ it '#1.2.3-beta >= 1.-beta raises ArgumentError' do
62
+ assert_raises ArgumentError do
63
+ ForemanFogProxmox::Semver.to_semver("1.2.3-beta")>=ForemanFogProxmox::Semver.to_semver("1.-beta")
64
+ end
65
+ end
66
+ it '#SemverClass(1.2.3-beta) >= String(1.-beta) raises TypeError' do
67
+ assert_raises TypeError do
68
+ ForemanFogProxmox::Semver.to_semver("1.2.3-beta")>="1.-beta"
69
+ end
70
+ end
71
+ it '#1.10.2 < 1.20.0 returns true' do
72
+ assert ForemanFogProxmox::Semver.to_semver("1.10.2")<ForemanFogProxmox::Semver.to_semver("1.20.0")
73
+ end
74
+ it '#0.10.2 < 1.20.0 returns true' do
75
+ assert ForemanFogProxmox::Semver.to_semver("0.10.2")<ForemanFogProxmox::Semver.to_semver("1.20.0")
76
+ end
77
+ end
78
+ end
79
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_fog_proxmox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Robert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-16 00:00:00.000000000 Z
12
+ date: 2019-04-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog-proxmox
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '0.6'
20
+ version: '0.7'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '0.6'
27
+ version: '0.7'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: deface
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -82,7 +82,7 @@ dependencies:
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: Foreman plugin adds Proxmox VE compute resource using fog-proxmox. It
85
- is compatible with Foreman 1.17+
85
+ is compatible with Foreman 1.22+
86
86
  email:
87
87
  - tristan.robert.44@gmail.com
88
88
  - theforeman.rubygems@gmail.com
@@ -149,6 +149,7 @@ files:
149
149
  - config/routes.rb
150
150
  - lib/foreman_fog_proxmox.rb
151
151
  - lib/foreman_fog_proxmox/engine.rb
152
+ - lib/foreman_fog_proxmox/semver.rb
152
153
  - lib/foreman_fog_proxmox/value.rb
153
154
  - lib/foreman_fog_proxmox/version.rb
154
155
  - lib/tasks/foreman_fog_proxmox_tasks.rake
@@ -165,6 +166,7 @@ files:
165
166
  - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
166
167
  - test/unit/foreman_fog_proxmox/proxmox_test.rb
167
168
  - test/unit/foreman_fog_proxmox/proxmox_test_helpers.rb
169
+ - test/unit/foreman_fog_proxmox/semver_test.rb
168
170
  homepage: https://github.com/theforeman/foreman_fog_proxmox
169
171
  licenses:
170
172
  - GPL-3.0
@@ -190,10 +192,11 @@ specification_version: 4
190
192
  summary: Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
191
193
  test_files:
192
194
  - test/functional/compute_resources_controller_test.rb
193
- - test/factories/proxmox_factory.rb
194
- - test/test_plugin_helper.rb
195
+ - test/unit/foreman_fog_proxmox/semver_test.rb
196
+ - test/unit/foreman_fog_proxmox/proxmox_test.rb
197
+ - test/unit/foreman_fog_proxmox/proxmox_test_helpers.rb
195
198
  - test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
196
199
  - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
197
200
  - test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
198
- - test/unit/foreman_fog_proxmox/proxmox_test.rb
199
- - test/unit/foreman_fog_proxmox/proxmox_test_helpers.rb
201
+ - test/factories/proxmox_factory.rb
202
+ - test/test_plugin_helper.rb