brightbox-cli 5.0.0.rc2 → 5.0.0

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: 9eb6588f842b8e2bb0a2b48e1a1eece122697726faa67032b43a868f273b49cd
4
- data.tar.gz: 41e2cd7ac07f8423f5a401196710c26befa93e50740248a0d8f430a16c67ec8d
3
+ metadata.gz: 5e929ec8c3d8a07bace33e5bbe1d7abf05ab2bbea81478251dda30dfaf8092de
4
+ data.tar.gz: dba86d8b80857f383a4b9fa4a977c6ff34f02d837e1f1f959a10133eb893f9f3
5
5
  SHA512:
6
- metadata.gz: e6c6997a8f17a14293c46bc07b040b1d3b07fb3409e3fc60fe02b577e8f5cdf1bfde2fa5d5eb6ae526c680e558b114c28908c3d6614b8efa775a866e201830f3
7
- data.tar.gz: 912baa8d1adba3c050bfc5d0f0fc69cf69621d5c28da4d063dfe4a6751e42c54d5b36dec2c017286579c745b3b9ce53bff8354f30081911bc0539e923eb3ece4
6
+ metadata.gz: b805583af2e9a07fb8d1936e116ad6bf4df7e5d95c9e531400f2e1eb79db391ddb2b6f38362c402956e73d4e5495948bbfb341cd015b98d21f3e95d998138710
7
+ data.tar.gz: 19925cf75cbc66ac82b5e91a34a7fc76e18fc34086b91b7eb271659665664f6907d759cebf872b56b0cb6e5bace2ef053d0f501393e123d112a2bb6ad195096d
data/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
- ### v5.0.0.rc1 / 2024-12-20
1
+ ### v5.0.0 / 2025-01-20
2
2
 
3
- [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.8.0...v5.0.0.rc1)
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.8.0...v5.0.0)
4
4
 
5
5
  Backwards incompatible changes:
6
6
 
@@ -11,6 +11,8 @@ Backwards incompatible changes:
11
11
  * `show` commands require at least one argument to
12
12
  prevent an issue where the wrong, summary API was
13
13
  used resulting in missing data in tables
14
+ * `images` architecture is now its own `arch` column and no longer
15
+ combined with the name field.
14
16
 
15
17
  Enhancements:
16
18
 
@@ -60,6 +62,8 @@ Testing:
60
62
  test coverage.
61
63
  * Temporary testing config directories are removed explicitly to prevent
62
64
  config bleeding in some test scenarios
65
+ * Tests for `server activate_console` confirm support for local time and
66
+ time zones.
63
67
 
64
68
  ### v4.8.0 / 2024-10-23
65
69
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (5.0.0.rc2)
4
+ brightbox-cli (5.0.0)
5
5
  fog-brightbox (>= 1.12.0)
6
6
  fog-core (< 2.0)
7
7
  gli (~> 2.21)
@@ -23,7 +23,11 @@ module Brightbox
23
23
  uri.query = "password=#{r['console_token']}"
24
24
 
25
25
  expires = Time.parse(r["console_token_expires"])
26
- consoles << { :url => uri.to_s, :token => r["console_token"], :expires => expires.localtime.to_s }
26
+ consoles << {
27
+ url: uri.to_s,
28
+ token: r["console_token"],
29
+ expires: expires.localtime.to_s
30
+ }
27
31
  end
28
32
 
29
33
  render_table(consoles, global_options.merge(:fields => %i[url token expires], :resize => false))
@@ -16,7 +16,7 @@ module Brightbox
16
16
  end
17
17
 
18
18
  def self.default_field_order
19
- %i[id owner type created_on status size name]
19
+ %i[id owner type created_on status size arch name]
20
20
  end
21
21
 
22
22
  # Filter out images that are not of the right type, account or status if the option is passed
@@ -84,7 +84,7 @@ module Brightbox
84
84
  locked: locked?,
85
85
  username: username,
86
86
  arch: arch,
87
- name: name.to_s + " (#{arch})",
87
+ name: name.to_s,
88
88
  owner: official ? "brightbox" : owner_id,
89
89
  type: type,
90
90
  created_at: created_at,
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "5.0.0.rc2".freeze unless defined?(Brightbox::VERSION)
2
+ VERSION = "5.0.0".freeze unless defined?(Brightbox::VERSION)
3
3
  end
@@ -6,11 +6,153 @@ describe "brightbox servers" do
6
6
  let(:stdout) { output.stdout }
7
7
  let(:stderr) { output.stderr }
8
8
 
9
- context "" do
9
+ before do
10
+ WebMock.reset!
11
+
12
+ config_from_contents(API_CLIENT_CONFIG_CONTENTS)
13
+ stub_client_token_request
14
+ Brightbox.config.reauthenticate
15
+ end
16
+
17
+ context "without arguments" do
10
18
  let(:argv) { %w[servers activate_console] }
11
19
 
12
20
  it "does not error" do
13
21
  expect { output }.to_not raise_error
22
+
23
+ aggregate_failures do
24
+ expect(stderr).to match("ERROR: You must specify servers to activate the console for")
25
+ expect(stdout).to be_empty
26
+ end
27
+ end
28
+ end
29
+
30
+ context "with identifier argument" do
31
+ let(:argv) { %w[servers activate_console srv-lv426] }
32
+ let(:token_expires) { "2025-01-01T01:01:01Z" }
33
+
34
+ before do
35
+ stub_request(:get, "#{api_url}/1.0/servers/srv-lv426")
36
+ .with(query: hash_including(account_id: "acc-12345"))
37
+ .to_return(
38
+ status: 200,
39
+ body: {
40
+ id: "srv-lv426",
41
+ console_token: nil,
42
+ console_token_expires: nil,
43
+ console_url: nil,
44
+ image: {
45
+ id: "img-12345"
46
+ }
47
+ }.to_json
48
+ )
49
+
50
+ stub_request(:get, "#{api_url}/1.0/images")
51
+ .with(query: hash_including(account_id: "acc-12345"))
52
+ .to_return(
53
+ status: 200,
54
+ body: [
55
+ {
56
+ id: "img-12345"
57
+ }
58
+ ].to_json
59
+ )
60
+
61
+ stub_request(:post, "#{api_url}/1.0/servers/srv-lv426/activate_console")
62
+ .with(query: hash_including(account_id: "acc-12345"))
63
+ .to_return(
64
+ status: 202,
65
+ body: {
66
+ id: "srv-lv426",
67
+ console_token: "<test-token-placeholder>",
68
+ console_token_expires: token_expires,
69
+ console_url: "https://console.test.test/srv-lv426",
70
+ image: {
71
+ id: "img-12345"
72
+ }
73
+ }.to_json
74
+ )
75
+ end
76
+
77
+ context "when in different time zone" do
78
+ around do |example|
79
+ original_tz = ENV["TZ"]
80
+ example.run
81
+ ENV["TZ"] = original_tz
82
+ end
83
+
84
+ context "when in UTC" do
85
+ before do
86
+ ENV["TZ"] = "Europe/London"
87
+ end
88
+
89
+ context "without daylight savings" do
90
+ it "does not error" do
91
+ expect { output }.to_not raise_error
92
+
93
+ aggregate_failures do
94
+ expect(stderr).to match("")
95
+ expect(stderr).not_to match("ERROR")
96
+
97
+ expect(stdout).to match("url")
98
+ expect(stdout).to match("https://console.test.test/srv-lv426")
99
+
100
+ expect(stdout).to match("token")
101
+ expect(stdout).to match("<test-token-placeholder>")
102
+
103
+ expect(stdout).to match("expires")
104
+ expect(stdout).to match("2025-01-01T01:01")
105
+ end
106
+ end
107
+ end
108
+
109
+ context "with daylight savings (BST)" do
110
+ let(:token_expires) { "2025-07-01T01:01:01Z" }
111
+
112
+ it "does not error" do
113
+ expect { output }.to_not raise_error
114
+
115
+ aggregate_failures do
116
+ expect(stderr).to match("")
117
+ expect(stderr).not_to match("ERROR")
118
+
119
+ expect(stdout).to match("url")
120
+ expect(stdout).to match("https://console.test.test/srv-lv426")
121
+
122
+ expect(stdout).to match("token")
123
+ expect(stdout).to match("<test-token-placeholder>")
124
+
125
+ expect(stdout).to match("expires")
126
+ expect(stdout).to match("2025-07-01T02:01")
127
+ end
128
+ end
129
+ end
130
+ end
131
+
132
+ context "when in EST" do
133
+ around do |example|
134
+ ENV["TZ"] = "America/New_York"
135
+ example.run
136
+ end
137
+
138
+ it "does not error" do
139
+ expect { output }.to_not raise_error
140
+
141
+ aggregate_failures do
142
+ expect(stderr).to match("")
143
+ expect(stderr).not_to match("ERROR")
144
+
145
+ expect(stdout).to match("url")
146
+ expect(stdout).to match("https://console.test.test/srv-lv426")
147
+
148
+ expect(stdout).to match("token")
149
+ expect(stdout).to match("<test-token-placeholder>")
150
+
151
+ expect(stdout).to match("expires")
152
+ expect(stdout).to match("2024-12-31T20:01")
153
+ end
154
+ end
155
+ end
14
156
  end
15
157
  end
16
158
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0.rc2
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
8
8
  - Paul Thornthwaite
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-15 00:00:00.000000000 Z
11
+ date: 2025-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-brightbox