brightbox-cli 4.8.0 → 5.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +6 -2
- data/CHANGELOG.md +60 -0
- data/Gemfile.lock +17 -10
- data/brightbox-cli.gemspec +3 -7
- data/lib/brightbox-cli/accounts.rb +5 -1
- data/lib/brightbox-cli/api.rb +34 -1
- data/lib/brightbox-cli/cloud_ips.rb +6 -6
- data/lib/brightbox-cli/collaboration.rb +3 -7
- data/lib/brightbox-cli/commands/cloudips/unmap.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_apply.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_create.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_destroy.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_list.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_remove.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_show.rb +1 -1
- data/lib/brightbox-cli/commands/firewall/policies_update.rb +1 -1
- data/lib/brightbox-cli/commands/lbs/create.rb +28 -16
- data/lib/brightbox-cli/commands/lbs/show.rb +5 -0
- data/lib/brightbox-cli/commands/lbs/update.rb +9 -2
- data/lib/brightbox-cli/config.rb +12 -5
- data/lib/brightbox-cli/database_server.rb +20 -20
- data/lib/brightbox-cli/database_snapshot.rb +5 -5
- data/lib/brightbox-cli/database_type.rb +4 -8
- data/lib/brightbox-cli/detailed_server.rb +26 -28
- data/lib/brightbox-cli/detailed_server_group.rb +2 -2
- data/lib/brightbox-cli/firewall_policy.rb +5 -9
- data/lib/brightbox-cli/firewall_rule.rb +14 -15
- data/lib/brightbox-cli/images.rb +21 -20
- data/lib/brightbox-cli/indifferent_access_hash.rb +50 -0
- data/lib/brightbox-cli/load_balancers.rb +38 -4
- data/lib/brightbox-cli/server_groups.rb +4 -8
- data/lib/brightbox-cli/servers.rb +22 -16
- data/lib/brightbox-cli/types.rb +4 -8
- data/lib/brightbox-cli/user_collaboration.rb +1 -1
- data/lib/brightbox-cli/users.rb +3 -5
- data/lib/brightbox-cli/version.rb +1 -1
- data/lib/brightbox-cli/volume.rb +9 -13
- data/lib/brightbox-cli/zones.rb +0 -4
- data/lib/brightbox_cli.rb +1 -0
- data/spec/commands/cloudips/update_spec.rb +7 -5
- data/spec/commands/configmaps/create_spec.rb +6 -6
- data/spec/commands/configmaps/destroy_spec.rb +1 -1
- data/spec/commands/configmaps/list_spec.rb +1 -1
- data/spec/commands/configmaps/show_spec.rb +3 -3
- data/spec/commands/configmaps/update_spec.rb +9 -9
- data/spec/commands/lbs/create_spec.rb +158 -6
- data/spec/commands/lbs/show_spec.rb +99 -3
- data/spec/commands/lbs/update_spec.rb +50 -6
- data/spec/commands/servers/update_spec.rb +7 -7
- data/spec/commands/sql/instances/create_spec.rb +8 -8
- data/spec/commands/sql/instances/reset_spec.rb +3 -3
- data/spec/commands/sql/instances/resize_spec.rb +4 -4
- data/spec/commands/sql/instances/show_spec.rb +2 -1
- data/spec/commands/sql/instances/update_spec.rb +3 -3
- data/spec/commands/sql/snapshots/list_spec.rb +1 -1
- data/spec/commands/sql/snapshots/show_spec.rb +50 -7
- data/spec/commands/volumes/attach_spec.rb +4 -4
- data/spec/commands/volumes/copy_spec.rb +2 -2
- data/spec/commands/volumes/destroy_spec.rb +1 -1
- data/spec/commands/volumes/detach_spec.rb +1 -1
- data/spec/commands/volumes/list_spec.rb +1 -1
- data/spec/commands/volumes/resize_spec.rb +3 -3
- data/spec/commands/volumes/show_spec.rb +1 -1
- data/spec/commands/volumes/update_spec.rb +4 -4
- data/spec/spec_helper.rb +16 -0
- data/spec/support/shared/api_resource_examples.rb +25 -0
- data/spec/unit/brightbox/account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/api/attributes_spec.rb +65 -0
- data/spec/unit/brightbox/api/fog_attributes_spec.rb +65 -0
- data/spec/unit/brightbox/bb_config/config_directory_spec.rb +23 -3
- data/spec/unit/brightbox/cloud_ip/attributes_spec.rb +19 -0
- data/spec/unit/brightbox/collaborating_account/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_server/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_snapshot/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/database_type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/detailed_server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/detailed_server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/firewall_policy/attributes_spec.rb +21 -0
- data/spec/unit/brightbox/firewall_rule/attributes_spec.rb +18 -0
- data/spec/unit/brightbox/image/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/image/status_spec.rb +67 -0
- data/spec/unit/brightbox/load_balancer/acme_cert_spec.rb +75 -0
- data/spec/unit/brightbox/load_balancer/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/load_balancer/formatted_acme_domains_spec.rb +78 -0
- data/spec/unit/brightbox/server/attributes_spec.rb +29 -0
- data/spec/unit/brightbox/server/hostname_spec.rb +27 -0
- data/spec/unit/brightbox/server_group/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/type/attributes_spec.rb +20 -0
- data/spec/unit/brightbox/user/attributes_spec.rb +13 -0
- data/spec/unit/brightbox/user_collaboration/attributes_spec.rb +13 -0
- metadata +68 -23
- data/spec/cassettes/brightbox_sql_snapshots/show/when_resource_exists/does_not_output_to_stderr.yml +0 -93
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c8cd88f1d668182fcc07ad7ac31d8a3935bcf079321908ec56a364e59e0fe43
|
4
|
+
data.tar.gz: 4b5ae117508d213f075adebf4c70996e95001abe39a6e9de0769232d29f5d3c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b50ffa28cbb39bd012b39de3233ad1e6e29190723e2ed83f1239525c04bdbaa1927b7b26d528246fdbd5d9f6185ed08d88807ab58e7fd970b6dcadf65139b28
|
7
|
+
data.tar.gz: 022e0c725cc12e5d2db5178100f7434a9c52de94eb8330a88688238c9183944b1199016f75d9a868568498a37258bf13d3032b5e9fb3a357198b1605e117503e
|
data/.github/workflows/ruby.yml
CHANGED
@@ -19,9 +19,11 @@ jobs:
|
|
19
19
|
runs-on: ubuntu-latest
|
20
20
|
|
21
21
|
strategy:
|
22
|
+
fail-fast: false
|
22
23
|
matrix:
|
23
|
-
ruby: ["2.
|
24
|
-
|
24
|
+
ruby: ["2.7", "3.0", "3.1", "3.2", "3.3"]
|
25
|
+
env:
|
26
|
+
DEBUG: "true"
|
25
27
|
steps:
|
26
28
|
- uses: actions/checkout@v3
|
27
29
|
- name: Set up Ruby ${{ matrix.ruby }}
|
@@ -30,6 +32,8 @@ jobs:
|
|
30
32
|
uses: ruby/setup-ruby@v1
|
31
33
|
with:
|
32
34
|
ruby-version: ${{ matrix.ruby }}
|
35
|
+
- name: Install Bundler
|
36
|
+
run: gem install bundler -v $(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1 | awk '{print $1}')
|
33
37
|
- name: Install dependencies
|
34
38
|
run: bundle install
|
35
39
|
- name: Run tests
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,63 @@
|
|
1
|
+
### v5.0.0.rc1 / 2024-12-20
|
2
|
+
|
3
|
+
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.8.0...v5.0.0.rc1)
|
4
|
+
|
5
|
+
Backwards incompatible changes:
|
6
|
+
|
7
|
+
* Drop support for Ruby versions older than 2.7
|
8
|
+
* Update `Gemfile.lock` to use Bundler 2.4.22
|
9
|
+
* When ENV `HOME` is not set, the working directory is used for configs
|
10
|
+
rather than `/.brightbox` to fix issues with containers
|
11
|
+
|
12
|
+
Enhancements:
|
13
|
+
|
14
|
+
* Added support for ACME certificates
|
15
|
+
* `brightbox lbs create` and `update` accepts `--acme-domains` with CSV
|
16
|
+
domains to request them to be setup on the load balancer
|
17
|
+
* `brightbox lbs show` outputs ACME related fields
|
18
|
+
* `acme_domains` - domains requested to be present
|
19
|
+
* `acme_cert_expires` - when the ACME certificate in no longer valid
|
20
|
+
* `acme_cert_fingerprint` - the fingerprint of the ACME certificate
|
21
|
+
* `acme_cert_issued_at` - when the ACME certificate was issued
|
22
|
+
* `acme_cert_subjects` - domain present on ACME certificate
|
23
|
+
* `brightbox firewall-policy` is now an alias for `firewall-policies`
|
24
|
+
|
25
|
+
Changes:
|
26
|
+
|
27
|
+
* `brightbox images` will now report an deprecated and private image as
|
28
|
+
"private" rather than "deprecated"
|
29
|
+
* Update `fog-brightbox` to `v1.12.0`
|
30
|
+
* Numerous dependency gems updated
|
31
|
+
* Expanded debugging output
|
32
|
+
* `Brightbox::Api#attributes` attempts to transform and make attributes
|
33
|
+
indifferent to String or Symbol keys as that has introduced numerous
|
34
|
+
issues over the years. Fog only converts the top level of keys from
|
35
|
+
Strings to Symbols resulting in mismatched keys throughout
|
36
|
+
* Refactored all models `#attributes` and `#to_row` methods to use the
|
37
|
+
above with more involved testing
|
38
|
+
|
39
|
+
Bug fixes:
|
40
|
+
|
41
|
+
* `brightbox lbs create` no longer requires at least one node to balance
|
42
|
+
which was outdated client side validation long removed from the API
|
43
|
+
* `brightbox lbs create` should now recognise the `--buffer-size` option
|
44
|
+
* `brightbox lbs update` converts `buffer-size` to integer before sending
|
45
|
+
* `brightbox cloudips unmap` incorrectly used the "map" description in
|
46
|
+
the help output. This is now fixed
|
47
|
+
|
48
|
+
Testing:
|
49
|
+
|
50
|
+
* Update CI testing matrix from Ruby 2.7 up to 3.3
|
51
|
+
* Ensure bundler version declared in `Gemfile.lock` is used by CI tests
|
52
|
+
* CI setting completes all builds rather than cancelling on one fail
|
53
|
+
* CI testing includes `DEBUG` ENV settings
|
54
|
+
* Tests updated to not "fail" when `DEBUG` output is included upsetting
|
55
|
+
matches to expected output in numerous cases
|
56
|
+
* Simplecov has been introduced and configured to prevent a drop in
|
57
|
+
test coverage.
|
58
|
+
* Temporary testing config directories are removed explicitly to prevent
|
59
|
+
config bleeding in some test scenarios
|
60
|
+
|
1
61
|
### v4.8.0 / 2024-10-23
|
2
62
|
|
3
63
|
[Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v4.7.0...v4.8.0)
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brightbox-cli (
|
5
|
-
|
6
|
-
fog-brightbox (>= 1.11.0)
|
4
|
+
brightbox-cli (5.0.0.rc1)
|
5
|
+
fog-brightbox (>= 1.12.0)
|
7
6
|
fog-core (< 2.0)
|
8
7
|
gli (~> 2.21)
|
9
8
|
highline (~> 2.0)
|
@@ -24,9 +23,10 @@ GEM
|
|
24
23
|
crack (0.4.5)
|
25
24
|
rexml
|
26
25
|
diff-lcs (1.5.0)
|
27
|
-
|
26
|
+
docile (1.4.1)
|
27
|
+
dry-inflector (1.1.0)
|
28
28
|
excon (0.112.0)
|
29
|
-
fog-brightbox (1.
|
29
|
+
fog-brightbox (1.12.0)
|
30
30
|
dry-inflector
|
31
31
|
fog-core (>= 1.45, < 3.0)
|
32
32
|
fog-json
|
@@ -38,18 +38,18 @@ GEM
|
|
38
38
|
fog-core
|
39
39
|
multi_json (~> 1.10)
|
40
40
|
formatador (0.3.0)
|
41
|
-
gli (2.
|
41
|
+
gli (2.22.0)
|
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.
|
47
|
+
logger (1.6.2)
|
48
48
|
method_source (1.0.0)
|
49
49
|
mime-types (3.6.0)
|
50
50
|
logger
|
51
51
|
mime-types-data (~> 3.2015)
|
52
|
-
mime-types-data (3.2024.
|
52
|
+
mime-types-data (3.2024.1203)
|
53
53
|
mocha (1.14.0)
|
54
54
|
multi_json (1.15.0)
|
55
55
|
parallel (1.22.1)
|
@@ -65,7 +65,7 @@ GEM
|
|
65
65
|
rainbow (3.1.1)
|
66
66
|
rake (13.0.6)
|
67
67
|
regexp_parser (2.5.0)
|
68
|
-
rexml (3.
|
68
|
+
rexml (3.3.9)
|
69
69
|
rspec (3.11.0)
|
70
70
|
rspec-core (~> 3.11.0)
|
71
71
|
rspec-expectations (~> 3.11.0)
|
@@ -95,6 +95,12 @@ GEM
|
|
95
95
|
rubocop-rspec (2.10.0)
|
96
96
|
rubocop (~> 1.19)
|
97
97
|
ruby-progressbar (1.11.0)
|
98
|
+
simplecov (0.22.0)
|
99
|
+
docile (~> 1.1)
|
100
|
+
simplecov-html (~> 0.11)
|
101
|
+
simplecov_json_formatter (~> 0.1)
|
102
|
+
simplecov-html (0.13.1)
|
103
|
+
simplecov_json_formatter (0.1.4)
|
98
104
|
slop (3.6.0)
|
99
105
|
unicode-display_width (2.1.0)
|
100
106
|
vcr (2.9.3)
|
@@ -115,8 +121,9 @@ DEPENDENCIES
|
|
115
121
|
rubocop
|
116
122
|
rubocop-rake
|
117
123
|
rubocop-rspec
|
124
|
+
simplecov
|
118
125
|
vcr (~> 2.5)
|
119
126
|
webmock
|
120
127
|
|
121
128
|
BUNDLED WITH
|
122
|
-
2.
|
129
|
+
2.4.22
|
data/brightbox-cli.gemspec
CHANGED
@@ -14,14 +14,14 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.license = "MIT"
|
15
15
|
s.metadata['rubygems_mfa_required'] = 'true'
|
16
16
|
|
17
|
-
s.required_ruby_version = ">= 2.
|
17
|
+
s.required_ruby_version = ">= 2.7"
|
18
18
|
|
19
19
|
s.files = `git ls-files`.split("\n") + `find lib/brightbox-cli/vendor`.split("\n")
|
20
20
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
21
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
22
22
|
s.require_paths = ["lib"]
|
23
23
|
|
24
|
-
s.add_dependency "fog-brightbox", ">= 1.
|
24
|
+
s.add_dependency "fog-brightbox", ">= 1.12.0"
|
25
25
|
s.add_dependency "fog-core", "< 2.0"
|
26
26
|
s.add_dependency "gli", "~> 2.21"
|
27
27
|
s.add_dependency "highline", "~> 2.0"
|
@@ -30,11 +30,6 @@ Gem::Specification.new do |s|
|
|
30
30
|
s.add_dependency "mime-types", "~> 3.0"
|
31
31
|
s.add_dependency "multi_json", "~> 1.11"
|
32
32
|
|
33
|
-
# Indirect dependency
|
34
|
-
# 0.3 drops support for Ruby < 2.7
|
35
|
-
# 0.2.1 drops support for Ruby < 2.6
|
36
|
-
s.add_dependency "dry-inflector", "= 0.2.0"
|
37
|
-
|
38
33
|
s.add_development_dependency "mocha"
|
39
34
|
s.add_development_dependency "pry-remote"
|
40
35
|
s.add_development_dependency "rake"
|
@@ -42,6 +37,7 @@ Gem::Specification.new do |s|
|
|
42
37
|
s.add_development_dependency "rubocop"
|
43
38
|
s.add_development_dependency "rubocop-rake"
|
44
39
|
s.add_development_dependency "rubocop-rspec"
|
40
|
+
s.add_development_dependency "simplecov"
|
45
41
|
s.add_development_dependency "vcr", "~> 2.5"
|
46
42
|
s.add_development_dependency "webmock"
|
47
43
|
end
|
@@ -13,7 +13,11 @@ module Brightbox
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def to_row
|
16
|
-
attributes.merge(
|
16
|
+
attributes.to_h.merge(
|
17
|
+
:ram_free => ram_free,
|
18
|
+
:cloud_ip_limit => cloud_ip_limit,
|
19
|
+
:lb_limit => lb_limit
|
20
|
+
)
|
17
21
|
end
|
18
22
|
|
19
23
|
def self.all
|
data/lib/brightbox-cli/api.rb
CHANGED
@@ -52,6 +52,16 @@ module Brightbox
|
|
52
52
|
Brightbox.config.cache_id(@id) if Brightbox.config.respond_to?(:cache_id)
|
53
53
|
end
|
54
54
|
|
55
|
+
def attributes
|
56
|
+
fog_attributes
|
57
|
+
end
|
58
|
+
|
59
|
+
# Returns the transformed attributes from the fog model with a
|
60
|
+
# wrapper to allow access using either String or Symbol keys.
|
61
|
+
def fog_attributes
|
62
|
+
IndifferentAccessHash.new(deep_symbolize(fog_model.attributes))
|
63
|
+
end
|
64
|
+
|
55
65
|
def fog_model
|
56
66
|
@fog_model ||= self.class.find(@id)
|
57
67
|
end
|
@@ -62,6 +72,10 @@ module Brightbox
|
|
62
72
|
false
|
63
73
|
end
|
64
74
|
|
75
|
+
def to_row
|
76
|
+
attributes.to_h
|
77
|
+
end
|
78
|
+
|
65
79
|
def to_s
|
66
80
|
@id
|
67
81
|
end
|
@@ -165,7 +179,7 @@ module Brightbox
|
|
165
179
|
if value
|
166
180
|
value
|
167
181
|
else
|
168
|
-
Brightbox.config.cache_id id
|
182
|
+
Brightbox.config.cache_id id if Brightbox.config.respond_to?(:cache_id)
|
169
183
|
@cache[id] = get(id)
|
170
184
|
end
|
171
185
|
end
|
@@ -192,5 +206,24 @@ module Brightbox
|
|
192
206
|
|
193
207
|
fog_model.created_at.strftime("%Y-%m-%d")
|
194
208
|
end
|
209
|
+
|
210
|
+
private
|
211
|
+
|
212
|
+
# Recursively converts all keys in a hash to symbols to ensure
|
213
|
+
# consistent access.
|
214
|
+
def deep_symbolize(hash)
|
215
|
+
return hash unless hash.respond_to?(:each_with_object)
|
216
|
+
|
217
|
+
hash.each_with_object({}) do |(k, v), result|
|
218
|
+
result[k.to_sym] = case v
|
219
|
+
when Hash
|
220
|
+
deep_symbolize(v)
|
221
|
+
when Array
|
222
|
+
v.map { |i| i.is_a?(Hash) ? deep_symbolize(i) : i }
|
223
|
+
else
|
224
|
+
v
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|
195
228
|
end
|
196
229
|
end
|
@@ -33,15 +33,15 @@ module Brightbox
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def attributes
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
fog_attributes.tap do |attrs|
|
37
|
+
attrs[:destination] = destination_id
|
38
|
+
end
|
39
39
|
end
|
40
40
|
|
41
41
|
def to_row
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
attributes.merge(
|
43
|
+
port_translators: translators(attributes),
|
44
|
+
).to_h
|
45
45
|
end
|
46
46
|
|
47
47
|
def mapped?
|
@@ -31,14 +31,10 @@ module Brightbox
|
|
31
31
|
|
32
32
|
attr_reader :id
|
33
33
|
|
34
|
-
def attributes
|
35
|
-
fog_model.attributes
|
36
|
-
end
|
37
|
-
|
38
34
|
def to_row
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
attributes.merge(
|
36
|
+
name: invitee_name
|
37
|
+
).to_h
|
42
38
|
end
|
43
39
|
|
44
40
|
def invitee_name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Brightbox
|
2
2
|
desc I18n.t("firewall.policies.desc")
|
3
|
-
command [
|
3
|
+
command ["firewall-policies", "firewall-policy"] do |cmd|
|
4
4
|
cmd.desc I18n.t("firewall.policies.apply.desc")
|
5
5
|
cmd.arg_name "firewall-policy-id server-group-id"
|
6
6
|
cmd.command [:apply] do |c|
|
@@ -32,18 +32,21 @@ module Brightbox
|
|
32
32
|
c.default_value "/"
|
33
33
|
c.flag [:s, "hc-request"]
|
34
34
|
|
35
|
-
c.desc "
|
35
|
+
c.desc "Health check interval"
|
36
36
|
c.default_value "5000"
|
37
37
|
c.flag [:e, "hc-interval"]
|
38
38
|
|
39
|
-
c.desc "
|
39
|
+
c.desc "Health check threshold up. Number of successful health checks for the node to be considered up."
|
40
40
|
c.default_value "3"
|
41
41
|
c.flag [:u, "hc-up"]
|
42
42
|
|
43
|
-
c.desc "
|
43
|
+
c.desc "Health check threshold down. Number of failed health checks for the node to be considered down."
|
44
44
|
c.default_value "3"
|
45
45
|
c.flag [:d, "hc-down"]
|
46
46
|
|
47
|
+
c.desc "ACME domains"
|
48
|
+
c.flag ["acme_domains"]
|
49
|
+
|
47
50
|
c.desc "Filepath to the SSL certificate file to use."
|
48
51
|
c.flag ["ssl-cert"]
|
49
52
|
|
@@ -58,8 +61,6 @@ module Brightbox
|
|
58
61
|
c.switch ["sslv3"]
|
59
62
|
|
60
63
|
c.action do |global_options, options, args|
|
61
|
-
raise "You must specify which servers to balance connections to" if args.empty?
|
62
|
-
|
63
64
|
listeners = options[:l].split(",").map do |l|
|
64
65
|
inport, outport, protocol, timeout = l.split ":"
|
65
66
|
raise "listener '#{l}' is invalid" if inport.nil? || outport.nil? || protocol.nil?
|
@@ -78,6 +79,14 @@ module Brightbox
|
|
78
79
|
options[:y] = listeners.first[:protocol]
|
79
80
|
end
|
80
81
|
|
82
|
+
if options[:b]
|
83
|
+
options[:b] = options[:b].to_i
|
84
|
+
end
|
85
|
+
|
86
|
+
if options["acme_domains"]
|
87
|
+
options["acme_domains"] = options["acme_domains"].split(",")
|
88
|
+
end
|
89
|
+
|
81
90
|
hc_arg_lookup = {
|
82
91
|
:k => :port,
|
83
92
|
:y => :type,
|
@@ -96,7 +105,7 @@ module Brightbox
|
|
96
105
|
end
|
97
106
|
end
|
98
107
|
|
99
|
-
# SSL
|
108
|
+
# SSL arguments
|
100
109
|
ssl_cert_path = options["ssl-cert"]
|
101
110
|
ssl_key_path = options["ssl-key"]
|
102
111
|
|
@@ -113,16 +122,19 @@ module Brightbox
|
|
113
122
|
|
114
123
|
msg = "Creating a new load balancer"
|
115
124
|
info msg
|
116
|
-
lb = LoadBalancer.create(
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
125
|
+
lb = LoadBalancer.create(
|
126
|
+
domains: options["acme_domains"],
|
127
|
+
buffer_size: options[:b],
|
128
|
+
certificate_pem: ssl_cert,
|
129
|
+
certificate_private_key: ssl_key,
|
130
|
+
healthcheck: healthcheck,
|
131
|
+
listeners: listeners,
|
132
|
+
name: options[:n],
|
133
|
+
nodes: nodes,
|
134
|
+
policy: options[:policy],
|
135
|
+
ssl_minimum_version: options["ssl-min-ver"],
|
136
|
+
sslv3: options["sslv3"]
|
137
|
+
)
|
126
138
|
render_table([lb], global_options)
|
127
139
|
end
|
128
140
|
end
|
@@ -37,6 +37,9 @@ module Brightbox
|
|
37
37
|
c.desc "Healthcheck threshold down. Number of failed healthchecks for the node to be considered down."
|
38
38
|
c.flag [:d, "hc-down"]
|
39
39
|
|
40
|
+
c.desc "ACME domains"
|
41
|
+
c.flag ["acme_domains"]
|
42
|
+
|
40
43
|
c.desc "Filepath to the SSL certificate file to use."
|
41
44
|
c.flag ["ssl-cert"]
|
42
45
|
|
@@ -100,10 +103,10 @@ module Brightbox
|
|
100
103
|
end
|
101
104
|
|
102
105
|
if options[:b]
|
103
|
-
lbopts[:buffer_size] = options[:b]
|
106
|
+
lbopts[:buffer_size] = options[:b].to_i
|
104
107
|
end
|
105
108
|
|
106
|
-
# SSL
|
109
|
+
# SSL arguments
|
107
110
|
ssl_cert_path = options["ssl-cert"]
|
108
111
|
ssl_key_path = options["ssl-key"]
|
109
112
|
remove_ssl = options["remove-ssl"]
|
@@ -132,6 +135,10 @@ module Brightbox
|
|
132
135
|
lbopts[:ssl_minimum_version] = options["ssl-min-ver"]
|
133
136
|
end
|
134
137
|
|
138
|
+
if options["acme_domains"]
|
139
|
+
lbopts[:domains] = options["acme_domains"].split(",")
|
140
|
+
end
|
141
|
+
|
135
142
|
lbopts.nilify_blanks
|
136
143
|
|
137
144
|
lb = LoadBalancer.find lb_id
|
data/lib/brightbox-cli/config.rb
CHANGED
@@ -91,11 +91,17 @@ module Brightbox
|
|
91
91
|
def debug_tokens
|
92
92
|
return unless ENV["DEBUG"]
|
93
93
|
|
94
|
-
|
95
|
-
|
96
|
-
|
94
|
+
if client_name
|
95
|
+
debug "Client: #{client_name}"
|
96
|
+
|
97
|
+
debug "Access token: #{access_token} (#{cached_access_token})"
|
98
|
+
if using_application?
|
99
|
+
debug "Refresh token: #{refresh_token} (#{cached_refresh_token}))"
|
100
|
+
else
|
101
|
+
debug "Refresh token: <NOT EXPECTED FOR CLIENT>"
|
102
|
+
end
|
97
103
|
else
|
98
|
-
debug "
|
104
|
+
debug "No client selected"
|
99
105
|
end
|
100
106
|
end
|
101
107
|
|
@@ -112,7 +118,8 @@ module Brightbox
|
|
112
118
|
private
|
113
119
|
|
114
120
|
def default_config_dir
|
115
|
-
|
121
|
+
config_dir = ENV.fetch("HOME", nil) || Dir.pwd
|
122
|
+
File.join(config_dir, ".brightbox")
|
116
123
|
end
|
117
124
|
|
118
125
|
def configured?
|
@@ -70,34 +70,34 @@ module Brightbox
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def type_identifier
|
73
|
-
return unless
|
73
|
+
return unless fog_attributes.key?("database_server_type")
|
74
74
|
|
75
|
-
|
75
|
+
fog_attributes["database_server_type"]["id"]
|
76
76
|
end
|
77
77
|
|
78
78
|
def zone_handle
|
79
|
-
return unless
|
79
|
+
return unless fog_attributes.key?("zone")
|
80
80
|
|
81
|
-
|
81
|
+
fog_attributes["zone"]["handle"]
|
82
82
|
end
|
83
83
|
|
84
84
|
def to_row
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
85
|
+
attributes.merge(
|
86
|
+
status: fog_model.state,
|
87
|
+
locked: locked?,
|
88
|
+
type: type_identifier,
|
89
|
+
db_engine: engine_version,
|
90
|
+
engine: database_engine,
|
91
|
+
version: database_version,
|
92
|
+
maintenance_weekday: maintenance_weekday,
|
93
|
+
maintenance_hour: maintenance_hour,
|
94
|
+
maintenance_window: maintenance_window,
|
95
|
+
zone: zone_handle,
|
96
|
+
created_on: created_on,
|
97
|
+
allow_access: allow_access,
|
98
|
+
cloud_ip_ids: cloud_ip_ids,
|
99
|
+
cloud_ips: cloud_ip_addresses
|
100
|
+
)
|
101
101
|
end
|
102
102
|
|
103
103
|
def engine_version
|
@@ -27,11 +27,11 @@ module Brightbox
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def to_row
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
30
|
+
fog_attributes.merge(
|
31
|
+
status: fog_model.state,
|
32
|
+
locked: locked?,
|
33
|
+
created_on: fog_model.created_at.strftime("%Y-%m-%d")
|
34
|
+
)
|
35
35
|
end
|
36
36
|
end
|
37
37
|
end
|
@@ -3,10 +3,10 @@ module Brightbox
|
|
3
3
|
def self.require_account?; true; end
|
4
4
|
|
5
5
|
def attributes
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
fog_attributes.tap do |attrs|
|
7
|
+
attrs[:ram] = ram
|
8
|
+
attrs[:disk] = disk
|
9
|
+
end
|
10
10
|
end
|
11
11
|
|
12
12
|
def ram
|
@@ -17,10 +17,6 @@ module Brightbox
|
|
17
17
|
fog_model.disk.to_i
|
18
18
|
end
|
19
19
|
|
20
|
-
def to_row
|
21
|
-
attributes
|
22
|
-
end
|
23
|
-
|
24
20
|
def self.all
|
25
21
|
conn.database_types
|
26
22
|
end
|