fog-brightbox 1.4.1 → 1.4.2

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: 7e91c9a644e0cd1ba3d41a180c1d03f5f6b4f30170838cc8119f694dd528737f
4
- data.tar.gz: 51143d7150551695ea3027a75451c15760c0005b824df2aaeb56d1c73050db34
3
+ metadata.gz: e093d1f19cc306dee85aed2df1cd8cdfd1103a4384732decce4a68855397bca5
4
+ data.tar.gz: 5672ef5e5d920037120861bfa1bda35ce4ffb6f1530cc62d61a0cb02aeb22d4e
5
5
  SHA512:
6
- metadata.gz: 5eb27bf573f92cb3b3ecec889bf62c1ce072a8027e2734d8d4c5238590d6c9f4599388ef52bd6ac8e73b914fb4bf80639ff6a586646f3d06ea997b28903e40c8
7
- data.tar.gz: 03a47f51347c021bbe3fafbaf1a9dc5d180d6a8995ab8ce18297234bda87aea965dc7f82b5377ba8d062b00ff76164292e420b623cf6b47aa2dc0c0e45d1da53
6
+ metadata.gz: cce99fc4e5978804b72374022bb42b43035709608012dbc4feb8791fa1b689d98aa2d7ee44289117986e457b8243453fe22a307b9012938a86c1485e5e43cd5d
7
+ data.tar.gz: df8c06dcc583f25291bf7bd89bea248ccd7f2f0e5675330bc82cb520e6d6ab946427bce9fbbd35ef4f279b165c06c4a4e7272060ae47e5a900b12b3447f3fcc6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### 1.4.2 / 2022-06-09
2
+
3
+ Bug fixes:
4
+
5
+ * `Fog::Brightbox::Compute::ImageSelector#latest_ubuntu` was fixed to resolve
6
+ two bugs that prevented the latest version being found since Xenial:
7
+ * The filtering for `i686` was missing later release which are only available
8
+ as `x86_64` images following support being dropped upstream. The filter is
9
+ now swapped to only match 64bit releases.
10
+ * The reverse name sorting failed when the Ubuntu codenames returned to the
11
+ start of the alphabet so `xenial` (16.04) would appear above `bionic`
12
+ (18.04) or `jammy` (22.04). The names are now split and the version used
13
+ instead for the sorting.
14
+
1
15
  ### 1.4.1 / 2021-04-20
2
16
 
3
17
  Bug fixes:
@@ -29,11 +29,11 @@ module Fog
29
29
  @images.select do |img|
30
30
  img["official"] == true &&
31
31
  img["status"] == "available" &&
32
- img["arch"] == "i686" &&
32
+ img["arch"] == "x86_64" &&
33
33
  img["name"] =~ /ubuntu/i
34
34
  end.sort do |a, b|
35
- # Reverse sort so "raring" > "precise" and "13.10" > "13.04"
36
- b["name"].downcase <=> a["name"].downcase
35
+ # Reverse sort so "22.10" > "22.04"
36
+ NameSorter.new(b["name"]).version <=> NameSorter.new(a["name"]).version
37
37
  end.first["id"]
38
38
  rescue StandardError
39
39
  nil
@@ -55,6 +55,31 @@ module Fog
55
55
  rescue StandardError
56
56
  nil
57
57
  end
58
+
59
+ class NameSorter
60
+ PATTERN = /\A(?<ubuntu>.*?)-(?<codename>.*?)-(?<version>[\d\.]*?)-(?<arch>.*?)/
61
+
62
+ def initialize(name)
63
+ @name = name
64
+ @matches = name.match(PATTERN)
65
+ end
66
+
67
+ def arch
68
+ @matches[:arch] || ""
69
+ end
70
+
71
+ def codename
72
+ @matches[:codename] || ""
73
+ end
74
+
75
+ def ubuntu?
76
+ @name.start_with?("ubuntu")
77
+ end
78
+
79
+ def version
80
+ @matches[:version] || ""
81
+ end
82
+ end
58
83
  end
59
84
  end
60
85
  end
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Brightbox
3
- VERSION = "1.4.1"
3
+ VERSION = "1.4.2"
4
4
  end
5
5
  end
@@ -0,0 +1,34 @@
1
+ require "spec_helper"
2
+
3
+ describe Fog::Brightbox::Compute::ImageSelector do
4
+ subject { Fog::Brightbox::Compute::ImageSelector }
5
+
6
+ describe "#latest_ubuntu" do
7
+ it do
8
+ image_list = [
9
+ {"id"=>"img-kppxh", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-kppxh", "name"=>"ubuntu-xenial-16.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:amd64/20211001/disk1.img, Release: release", "source"=>"tmp54tt71pg", "arch"=>"x86_64", "created_at"=>"2021-10-02T06:57:09.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>394, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
10
+ {"id"=>"img-bugr2", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-bugr2", "name"=>"ubuntu-xenial-16.04-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:16.04:i386/20211001/disk1.img, Release: release", "source"=>"tmplj717rjf", "arch"=>"i686", "created_at"=>"2021-10-02T06:58:18.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>385, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
11
+ {"id"=>"img-6vfpp", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-6vfpp", "name"=>"ubuntu-xenial-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:16.04:amd64/20211001/disk1.img, Release: daily", "source"=>"tmp3aj5trto", "arch"=>"x86_64", "created_at"=>"2021-10-02T06:58:57.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>394, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
12
+ {"id"=>"img-x08p6", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-x08p6", "name"=>"ubuntu-bionic-18.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:amd64/20220523/disk1.img, Release: release", "source"=>"tmpcyevpow5", "arch"=>"x86_64", "created_at"=>"2022-05-24T06:57:15.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>480, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
13
+ {"id"=>"img-jrbnn", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-jrbnn", "name"=>"ubuntu-bionic-18.04-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:18.04:i386/20220523/disk1.img, Release: release", "source"=>"tmpw502837r", "arch"=>"i686", "created_at"=>"2022-05-24T06:57:44.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>450, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
14
+ {"id"=>"img-1cbbg", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-1cbbg", "name"=>"ubuntu-focal-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:20.04:amd64/20220530/disk1.img, Release: daily", "source"=>"tmpa2iezlb7", "arch"=>"x86_64", "created_at"=>"2022-06-01T07:06:08.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>685, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
15
+ {"id"=>"img-cjc8m", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-cjc8m", "name"=>"ubuntu-focal-20.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:20.04:amd64/20220530/disk1.img, Release: release", "source"=>"tmppadp2ka9", "arch"=>"x86_64", "created_at"=>"2022-06-02T06:57:21.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>685, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
16
+ {"id"=>"img-yes2q", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-yes2q", "name"=>"ubuntu-bionic-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:amd64/20220530/disk1.img, Release: daily", "source"=>"tmp7b0ty_cz", "arch"=>"x86_64", "created_at"=>"2022-06-02T06:59:06.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>480, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
17
+ {"id"=>"img-44xv2", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-44xv2", "name"=>"ubuntu-bionic-daily-i386-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:18.04:i386/20220530/disk1.img, Release: daily", "source"=>"tmpcsk_ejc9", "arch"=>"i686", "created_at"=>"2022-06-02T06:59:33.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>450, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
18
+ {"id"=>"img-axy3r", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-axy3r", "name"=>"ubuntu-impish-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:21.10:amd64/20220604/disk1.img, Release: daily", "source"=>"tmpq4xcgkhd", "arch"=>"x86_64", "created_at"=>"2022-06-05T06:57:52.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>699, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
19
+ {"id"=>"img-5sf6z", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-5sf6z", "name"=>"ubuntu-jammy-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.04:amd64/20220604/disk1.img, Release: daily", "source"=>"tmp6lwsv5cb", "arch"=>"x86_64", "created_at"=>"2022-06-05T06:58:33.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>709, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
20
+ {"id"=>"img-vuptu", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-vuptu", "name"=>"ubuntu-kinetic-daily-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:daily:download/com.ubuntu.cloud.daily:server:22.10:amd64/20220605/disk1.img, Release: daily", "source"=>"tmpj_k3e6u1", "arch"=>"x86_64", "created_at"=>"2022-06-06T06:57:58.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>752, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
21
+ {"id"=>"img-tqaxd", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-tqaxd", "name"=>"ubuntu-impish-21.10-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:21.10:amd64/20220604/disk1.img, Release: release", "source"=>"tmp_xphnxch", "arch"=>"x86_64", "created_at"=>"2022-06-07T06:57:33.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>699, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
22
+ {"id"=>"img-7d1e3", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-7d1e3", "name"=>"ubuntu-jammy-22.04-amd64-server", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:server:22.04:amd64/20220604/disk1.img, Release: release", "source"=>"tmp11_42l44", "arch"=>"x86_64", "created_at"=>"2022-06-07T06:58:16.000Z", "owner"=>"acc-kg71m", "official"=>true, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>709, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
23
+ {"id"=>"img-kg2oa", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-kg2oa", "name"=>"ubuntu-bionic-18.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:18.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpd7d5lvyb", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:01:21.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>258, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
24
+ {"id"=>"img-sdofr", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-sdofr", "name"=>"ubuntu-focal-20.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:20.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpl6wvuqu9", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:01:49.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>330, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
25
+ {"id"=>"img-7wwg7", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-7wwg7", "name"=>"ubuntu-impish-21.10-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:21.10:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpfkqj3pjo", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:02:13.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>328, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil},
26
+ {"id"=>"img-ielp9", "resource_type"=>"image", "url"=>"https://api.gb1s.brightbox.com/1.0/images/img-ielp9", "name"=>"ubuntu-jammy-22.04-amd64-minimal", "username"=>"ubuntu", "status"=>"available", "locked"=>false, "description"=>"ID: com.ubuntu.cloud:released:download/com.ubuntu.cloud:minimal:22.04:amd64/20220607/disk1.img, Release: minimal release", "source"=>"tmpd0ctsx1v", "arch"=>"x86_64", "created_at"=>"2022-06-08T07:02:38.000Z", "owner"=>"acc-yw7i0", "official"=>false, "public"=>true, "compatibility_mode"=>false, "source_type"=>"upload", "source_trigger"=>"manual", "disk_size"=>353, "virtual_size"=>2252, "min_ram"=>nil, "ancestor"=>nil}
27
+ ]
28
+
29
+ selector = subject.new(image_list)
30
+
31
+ assert_equal "img-7d1e3", selector.latest_ubuntu
32
+ end
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-brightbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Thornthwaite
@@ -391,6 +391,7 @@ files:
391
391
  - spec/fog/compute/brightbox/event_spec.rb
392
392
  - spec/fog/compute/brightbox/firewall_policy_spec.rb
393
393
  - spec/fog/compute/brightbox/flavor_spec.rb
394
+ - spec/fog/compute/brightbox/image_selector_spec.rb
394
395
  - spec/fog/compute/brightbox/image_spec.rb
395
396
  - spec/fog/compute/brightbox/load_balancer_spec.rb
396
397
  - spec/fog/compute/brightbox/server_group_spec.rb
@@ -495,6 +496,7 @@ test_files:
495
496
  - spec/fog/compute/brightbox/event_spec.rb
496
497
  - spec/fog/compute/brightbox/firewall_policy_spec.rb
497
498
  - spec/fog/compute/brightbox/flavor_spec.rb
499
+ - spec/fog/compute/brightbox/image_selector_spec.rb
498
500
  - spec/fog/compute/brightbox/image_spec.rb
499
501
  - spec/fog/compute/brightbox/load_balancer_spec.rb
500
502
  - spec/fog/compute/brightbox/server_group_spec.rb