brightbox-cli 4.7.0 → 4.8.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7421a4af403275a028e9738bfd7a32b3d9ec9c747a0ea5ddfdf570e51a4cafdd
4
- data.tar.gz: f36372d185741699dc9f53595cf5acf633457a2ba002d045e731f15d54f02799
3
+ metadata.gz: 1957aedb76eb618990c1deca7846319433ce2cc3b88ed2f4b3eac0b4aca3b3c0
4
+ data.tar.gz: b7a83328c30eb76699b880cb8a6a356cf61bf3e362c19c50b1f8c4dcbbc17c6d
5
5
  SHA512:
6
- metadata.gz: a3d2173640f650163f2602757c472174fe285f209c03d763aa8ca3e214ab67df5f94b1497abc8660675c7db2452b12b720ccaeb477ddaf2e3c5431a0b3d4e1f8
7
- data.tar.gz: dd875beb01cbe080cf47fc4eeaadf6581a95671fdd3808972901d883c601df40cb23291d7fd3681b289025eb31f83c66011ae8eaa5981340f08f5fd9997e7afd
6
+ metadata.gz: 1a2a3316ce568a85d06eea928b5382d0a9a0b2737e2e14c01940a2f2071f8cd10d5c7a25c4f3af2878d5d453c98d70b1bfb50a6fa92b46ed7c5ca4f075fb844f
7
+ data.tar.gz: 3cd77f4748d94aea53ac8685268228f112aef95e9c8b9a8aca00692d67dc10e92948fa5acef2c696cf6ce08c58920ded07a1167e3933fcc4faf9e2736c480903
@@ -20,7 +20,7 @@ jobs:
20
20
 
21
21
  strategy:
22
22
  matrix:
23
- ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "head"]
23
+ ruby: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
24
24
 
25
25
  steps:
26
26
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ### v4.8.0 / 2024-10-23
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.7.0...v4.8.0)
4
+
5
+ Changes:
6
+
7
+ * Increase supported Server `user-data` limit to match 64KiB now
8
+ supported by API.
9
+
1
10
  ### v4.7.0 / 2024-01-03
2
11
 
3
12
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.6.0...v4.7.0)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (4.7.0)
4
+ brightbox-cli (4.8.0)
5
5
  dry-inflector (= 0.2.0)
6
6
  fog-brightbox (>= 1.11.0)
7
7
  fog-core (< 2.0)
@@ -18,14 +18,14 @@ GEM
18
18
  addressable (2.8.0)
19
19
  public_suffix (>= 2.0.2, < 5.0)
20
20
  ast (2.4.2)
21
- builder (3.2.4)
21
+ builder (3.3.0)
22
22
  coderay (1.1.3)
23
- concurrent-ruby (1.2.2)
23
+ concurrent-ruby (1.3.4)
24
24
  crack (0.4.5)
25
25
  rexml
26
26
  diff-lcs (1.5.0)
27
27
  dry-inflector (0.2.0)
28
- excon (0.108.0)
28
+ excon (0.112.0)
29
29
  fog-brightbox (1.11.0)
30
30
  dry-inflector
31
31
  fog-core (>= 1.45, < 3.0)
@@ -38,16 +38,18 @@ GEM
38
38
  fog-core
39
39
  multi_json (~> 1.10)
40
40
  formatador (0.3.0)
41
- gli (2.21.1)
41
+ gli (2.21.5)
42
42
  hashdiff (1.0.1)
43
43
  highline (2.1.0)
44
44
  hirb (0.7.3)
45
45
  i18n (1.10.0)
46
46
  concurrent-ruby (~> 1.0)
47
+ logger (1.6.1)
47
48
  method_source (1.0.0)
48
- mime-types (3.5.2)
49
+ mime-types (3.6.0)
50
+ logger
49
51
  mime-types-data (~> 3.2015)
50
- mime-types-data (3.2023.1205)
52
+ mime-types-data (3.2024.1001)
51
53
  mocha (1.14.0)
52
54
  multi_json (1.15.0)
53
55
  parallel (1.22.1)
@@ -69,10 +69,8 @@ module Brightbox
69
69
  if user_data_file
70
70
  raise "Cannot specify user data on command line and in file at same time" if user_data
71
71
 
72
- # Wot we use to read the data, be it from stdin or a file on disk
72
+ # Used to read the data, be it from stdin or a file on disk
73
73
  file_handler = lambda do |fh|
74
- raise "User data file too big (>16k)" if fh.stat.size > 16 * 1024
75
-
76
74
  user_data = fh.read
77
75
  end
78
76
  # Figure out how to invoke file_handler, and then invoke it
@@ -88,7 +86,7 @@ module Brightbox
88
86
  require "base64"
89
87
  user_data = Base64.encode64(user_data)
90
88
  end
91
- raise "User data too big (>16k)" if user_data.size > 16 * 1024
89
+ raise "Encoded user-data exceeds 64KiB limit" if user_data.size > 64 * 1024
92
90
  end
93
91
 
94
92
  # Split server groups into array of identifiers (or empty array)
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "4.7.0".freeze unless defined?(Brightbox::VERSION)
2
+ VERSION = "4.8.0".freeze unless defined?(Brightbox::VERSION)
3
3
  end
@@ -195,6 +195,58 @@ describe "brightbox servers" do
195
195
  end
196
196
  end
197
197
 
198
+ context "with --user-data flag" do
199
+ before do
200
+ expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
201
+ expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
202
+ end
203
+
204
+ context "with user data string within limit" do
205
+ let(:argv) { ["servers", "create", "--user-data", user_data, "--no-base64", "img-12345"] }
206
+ let(:user_data) { ("a" * 65_535) }
207
+
208
+ it "requests new server with user data" do
209
+ stub_request(:post, "http://api.brightbox.localhost/1.0/servers?account_id=acc-12345")
210
+ .with(:headers => { "Content-Type" => "application/json" },
211
+ body: hash_including(user_data: user_data))
212
+ .and_return(status: 202, body: sample_response)
213
+
214
+ aggregate_failures do
215
+ expect(stderr).not_to match("ERROR")
216
+ expect(stdout).to match("srv-12345")
217
+ end
218
+ end
219
+ end
220
+
221
+ context "with user data string encoded by client" do
222
+ let(:argv) { ["servers", "create", "--user-data", user_data, "--base64", "img-12345"] }
223
+ let(:encoded_user_data) { Base64.encode64(user_data) }
224
+ let(:user_data) { ("a" * 48_345) }
225
+
226
+ it "requests new server with user data" do
227
+ stub_request(:post, "http://api.brightbox.localhost/1.0/servers?account_id=acc-12345")
228
+ .with(:headers => { "Content-Type" => "application/json" },
229
+ body: hash_including(user_data: encoded_user_data))
230
+ .and_return(status: 202, body: sample_response)
231
+
232
+ aggregate_failures do
233
+ expect(stderr).not_to match("ERROR")
234
+ expect(stdout).to match("srv-12345")
235
+ end
236
+ end
237
+ end
238
+
239
+ context "with user data string exceeding limit" do
240
+ let(:argv) { ["servers", "create", "--user-data", user_data, "img-12345"] }
241
+ let(:user_data) { ("a" * 65_535) + "b" }
242
+
243
+ it "errors" do
244
+ expect(stderr).to match("Encoded user-data exceeds 64KiB limit")
245
+ expect(stdout).not_to match("srv-12345")
246
+ end
247
+ end
248
+ end
249
+
198
250
  def sample_response
199
251
  '{
200
252
  "id": "srv-12345",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.7.0
4
+ version: 4.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-01-03 00:00:00.000000000 Z
12
+ date: 2024-10-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fog-brightbox
@@ -819,7 +819,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
819
819
  - !ruby/object:Gem::Version
820
820
  version: '0'
821
821
  requirements: []
822
- rubygems_version: 3.4.10
822
+ rubygems_version: 3.5.16
823
823
  signing_key:
824
824
  specification_version: 4
825
825
  summary: The Brightbox cloud management system