brightbox-cli 2.6.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 96fa4d23d9ae155d8bed3923b2008147d5f02e5d
4
- data.tar.gz: 8e2c0fc64b410dc6f62e35b7e3f5636fa02db1bc
3
+ metadata.gz: 2f0236852c669e77d8e4d89e5947a5a3043ec42f
4
+ data.tar.gz: bc9e0ade011ecdb7c610c3d82b1ffd49ab2c8924
5
5
  SHA512:
6
- metadata.gz: 75b51b5235e6a878194476c16eef375e65b538fc35e7fae7741f2d021b846b54cdf23c80d3040d9d5a583aa61b2ea9b0f2375e69010ae394f33e45f17ffed44c
7
- data.tar.gz: 413d50665c92d89d79fc2256cc2dc98811158954d404ba5bbe420c7bff6377989a9f2aa23bb52911a20f98349214be48ea92b53f45fd276762f7136fc0467d64
6
+ metadata.gz: dbf2d4a5f305d2b8aafceba0244bb0a9d0145f08d8516d7e60eb849aaa614d6d605c27072ab57f3f2c8bb9f6a9d5a23bd4837a7429917a6b3c979c803fa39d1a
7
+ data.tar.gz: 2160feaa504a2fb29fbca45086e2dc9eef801036bce3620fc09be3eb97ae003f328859e6515bf30cbee9ee18c6f165e1e006edde4e05e4da57d91d8316a80c62
@@ -1,7 +1,11 @@
1
1
  language: ruby
2
2
  sudo: false
3
+ before_install:
4
+ - gem install bundler
3
5
  rvm:
4
- - 1.9.3
5
- - 2.0.0
6
- - 2.1.0
7
- - 2.2.4
6
+ - 1.9
7
+ - 2.0
8
+ - 2.1
9
+ - 2.2
10
+ - 2.3
11
+ - 2.4
@@ -1,3 +1,17 @@
1
+ ### v2.7.0 / 2017-09-06
2
+
3
+ [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.6.0...v2.7.0)
4
+
5
+ Enhancements:
6
+
7
+ * Add `cloud-ip` argument to `server create` command to pre-allocate and map
8
+ a cloud IP to a server upon build completion.
9
+
10
+ Changes:
11
+
12
+ * Update `fog-brightbox` to v0.13.0
13
+ * Various changes to Travis settings
14
+
1
15
  ### v2.6.0 / 2016-07-07
2
16
 
3
17
  [Full Changelog](https://github.com/brightbox/brightbox-cli/compare/v2.5.0...v2.6.0)
@@ -2,7 +2,7 @@ PATH
2
2
  remote: .
3
3
  specs:
4
4
  brightbox-cli (2.6.0)
5
- fog-brightbox (>= 0.11.0)
5
+ fog-brightbox (>= 0.13.0)
6
6
  gli (~> 2.12.0)
7
7
  highline (~> 1.6.0)
8
8
  hirb (~> 0.6)
@@ -15,19 +15,19 @@ GEM
15
15
  remote: https://rubygems.org/
16
16
  specs:
17
17
  addressable (2.3.8)
18
- builder (3.2.2)
18
+ builder (3.2.3)
19
19
  coderay (1.0.9)
20
20
  crack (0.4.2)
21
21
  safe_yaml (~> 1.0.0)
22
22
  diff-lcs (1.2.5)
23
- excon (0.50.1)
24
- fog-brightbox (0.11.0)
23
+ excon (0.58.0)
24
+ fog-brightbox (0.13.0)
25
25
  fog-core (~> 1.22)
26
26
  fog-json
27
27
  inflecto (~> 0.0.2)
28
- fog-core (1.42.0)
28
+ fog-core (1.45.0)
29
29
  builder
30
- excon (~> 0.49)
30
+ excon (~> 0.58)
31
31
  formatador (~> 0.2)
32
32
  fog-json (1.0.2)
33
33
  fog-core (~> 1.0)
@@ -40,7 +40,7 @@ GEM
40
40
  inflecto (0.0.2)
41
41
  metaclass (0.0.1)
42
42
  method_source (0.8.1)
43
- mime-types (2.99.2)
43
+ mime-types (2.99.3)
44
44
  mocha (0.14.0)
45
45
  metaclass (~> 0.0.1)
46
46
  multi_json (1.11.3)
@@ -81,4 +81,4 @@ DEPENDENCIES
81
81
  webmock
82
82
 
83
83
  BUNDLED WITH
84
- 1.12.5
84
+ 1.14.6
@@ -0,0 +1 @@
1
+ README
@@ -21,7 +21,7 @@ Gem::Specification.new do |s|
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", ">= 0.11.0"
24
+ s.add_dependency "fog-brightbox", ">= 0.13.0"
25
25
  s.add_dependency "gli", "~> 2.12.0"
26
26
  s.add_dependency "i18n", "~> 0.6.0"
27
27
  s.add_dependency "mime-types", "~> 2.6"
@@ -32,6 +32,9 @@ module Brightbox
32
32
  c.desc "Server groups to place server in - comma delimited list"
33
33
  c.flag [:g, "server-groups"]
34
34
 
35
+ c.desc I18n.t("servers.create.cloud_ip.desc")
36
+ c.flag ["cloud-ip"]
37
+
35
38
  c.action do |global_options, options, args|
36
39
 
37
40
  if args.empty?
@@ -93,6 +96,14 @@ module Brightbox
93
96
  msg << " in zone #{zone.handle} (#{zone})" if zone
94
97
  msg << " in groups #{server_groups.map(&:id).join(", ")}" unless server_groups.empty?
95
98
  msg << " with %.2fk of user data" % (user_data.size / 1024.0) if user_data
99
+ if options[:"cloud-ip"] && options[:"cloud-ip"].respond_to?(:start_with?)
100
+ if options[:"cloud-ip"].start_with?("cip-")
101
+ msg << " mapping #{options[:'cloud-ip']} when built"
102
+ end
103
+ if options[:"cloud-ip"] == "true"
104
+ msg << " mapping a new cloud IP when built"
105
+ end
106
+ end
96
107
  info msg
97
108
 
98
109
  params = {
@@ -104,7 +115,10 @@ module Brightbox
104
115
  :server_groups => server_groups.map(&:id)
105
116
  }
106
117
 
118
+ params[:cloud_ip] = options[:"cloud-ip"] if options.key?(:"cloud-ip")
119
+
107
120
  servers = Server.create_servers options[:i], params
121
+ info servers.inspect
108
122
  render_table(servers, global_options)
109
123
  end
110
124
  end
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "2.6.0" unless defined?(Brightbox::VERSION)
2
+ VERSION = "2.7.0" unless defined?(Brightbox::VERSION)
3
3
  end
@@ -142,6 +142,8 @@ en:
142
142
  desc: Activate web consoles for a number of servers
143
143
  create:
144
144
  desc: Create servers
145
+ cloud_ip:
146
+ desc: Immediately map a Cloud IP to new server? Either "true" or the identifier of the Cloud IP
145
147
  destroy:
146
148
  desc: Destroy servers
147
149
  lock:
@@ -7,12 +7,85 @@ describe "brightbox servers" do
7
7
  let(:stdout) { output.stdout }
8
8
  let(:stderr) { output.stderr }
9
9
 
10
- context "" do
10
+ before do
11
+ config = config_from_contents(USER_APP_CONFIG_CONTENTS)
12
+ cache_access_token(config, "f83da712e6299cda953513ec07f7a754f747d727")
13
+
14
+ stub_request(:post, "http://api.brightbox.dev/token").to_return(
15
+ :status => 200,
16
+ :body => '{"access_token":"44320b29286077c44f14c4efdfed70f63f4a8361","token_type":"Bearer","refresh_token":"759b2b28c228948a0ba5d07a89f39f9e268a95c0","scope":"infrastructure orbit","expires_in":7200}')
17
+ end
18
+
19
+ context "without arguments" do
11
20
  let(:argv) { %w(servers create) }
12
21
 
13
22
  it "does not error" do
14
23
  expect { output }.to_not raise_error
15
24
  end
16
25
  end
26
+
27
+ context "with --cloud-ip with nominated IP argument" do
28
+ let(:argv) { %w(servers create --cloud-ip cip-12345 img-12345) }
29
+
30
+ let(:image) { double(:id => "img-12345", :name => "Linux") }
31
+ let(:type) { double(:id => "typ-12345", :handle => "nano") }
32
+ let(:zone) { double(:handle => "gb1-a") }
33
+
34
+ before do
35
+ expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
36
+ expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
37
+ end
38
+
39
+ it "requests nominated Cloud IP" do
40
+ stub_request(:post, "http://api.brightbox.dev/1.0/servers?account_id=acc-12345")
41
+ .with(:body => /"cloud_ip":"cip-12345"/)
42
+ .and_return(:status => 202, :body => sample_response)
43
+
44
+ expect(stderr).to match("mapping cip-12345 when built")
45
+ expect(stderr).not_to match("ERROR")
46
+ expect(stdout).to match("srv-12345")
47
+ end
48
+ end
49
+
50
+ context "with --cloud-ip true argument" do
51
+ let(:argv) { %w(servers create --cloud-ip true img-12345) }
52
+
53
+ let(:image) { double(:id => "img-12345", :name => "Linux") }
54
+ let(:type) { double(:id => "typ-12345", :handle => "nano") }
55
+ let(:zone) { double(:handle => "gb1-a") }
56
+
57
+ before do
58
+ expect(Brightbox::Image).to receive(:find).with("img-12345").and_return(image)
59
+ expect(Brightbox::Type).to receive(:find_by_handle).and_return(type)
60
+ end
61
+
62
+ it "requests new allocated Cloud IP" do
63
+ stub_request(:post, "http://api.brightbox.dev/1.0/servers?account_id=acc-12345")
64
+ .with(:body => /"cloud_ip":"true"/)
65
+ .and_return(:status => 202, :body => sample_response)
66
+
67
+ expect(stderr).to match("mapping a new cloud IP when built")
68
+ expect(stderr).not_to match("ERROR")
69
+ expect(stdout).to match("srv-12345")
70
+ end
71
+ end
72
+
73
+ def sample_response
74
+ '{
75
+ "id": "srv-12345",
76
+ "image": {
77
+ "id": "img-12345"
78
+ },
79
+ "interfaces": [],
80
+ "server_type": {
81
+ "handle": "nano"
82
+ },
83
+ "zone": {
84
+ "handle": "gb1-a"
85
+ },
86
+ "cloud_ips": [],
87
+ "snapshots": []
88
+ }'
89
+ end
17
90
  end
18
91
  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: 2.6.0
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Leach
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2017-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-brightbox
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.11.0
19
+ version: 0.13.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.11.0
26
+ version: 0.13.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: gli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -746,7 +746,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
746
746
  version: '0'
747
747
  requirements: []
748
748
  rubyforge_project: brightbox-cli
749
- rubygems_version: 2.2.5
749
+ rubygems_version: 2.6.2
750
750
  signing_key:
751
751
  specification_version: 4
752
752
  summary: The Brightbox cloud management system
@@ -1,170 +0,0 @@
1
- = Brightbox Cloud Command Line Interface
2
-
3
- `brightbox-cli` is a set of cli tools to interact with the Brightbox Cloud API.
4
-
5
- You will need a user account on the Brightbox Cloud in order to make use of
6
- these tools.
7
-
8
- You can sign up at https://manage.brightbox.com
9
-
10
- {<img src="https://travis-ci.org/brightbox/brightbox-cli.png?branch=master" alt="Build Status" />}[https://travis-ci.org/brightbox/brightbox-cli]
11
-
12
- == UPGRADE NOTES
13
-
14
- Version 1.0.0 adds a new top level `brightbox` command for the suite.
15
-
16
- This may clash with our `brightbox` (brightbox-deployment) gem which, before
17
- version 2.4.0, used `brightbox` as the name for it's binary. Please ensure you
18
- update your `brightbox` gem to avoid using the wrong command.
19
-
20
- We have included backwards compatible binaries for all the older CLI commands
21
- (brightbox-accounts, brightbox-servers etc...) but recommend getting used to the
22
- new form.
23
-
24
- == Installation instructions
25
-
26
- Install from Rubygems
27
-
28
- $ gem install brightbox-cli
29
-
30
- == Usage
31
-
32
- The Brightbox CLI is a suite of tools that are accessible through the
33
- `brightbox` command in a similar way to how you access `git` commands.
34
-
35
- For a list of available commands use:
36
-
37
- $ brightbox help
38
-
39
- To add client (account based) credentials use:
40
-
41
- $ brightbox config client_add cli-2igtb theclientsecret
42
- Using config file /home/ubuntu/.brightbox/config
43
- Creating new api client config cli-2igtb
44
-
45
- To browse available resources use the resource name as the command:
46
-
47
- $ brightbox servers
48
- ... List of servers
49
- $ brightbox images
50
- ... List of images
51
-
52
- Command structure may be subject to change.
53
-
54
- === Using GPG to secure passwords
55
-
56
- If you use an OAuth application to access your accounts
57
- (https://www.brightbox.com/docs/guides/manager/oauth-applications/) then you
58
- frequently need to renter your password.
59
-
60
- From v1.5.0 you can store your password locally encrypted by GPG (https://www.gnupg.org/)
61
- which will decrypt the password when needed. This will prompt for your GPG key
62
- if not available to the GPG agent using your OS's configured pinentry program.
63
-
64
- You need to have setup GPG with your own keys and have configured the pinentry
65
- to prompt you when the key is locked.
66
-
67
- The password file is named after your configuration's alias:
68
-
69
- $ brightbox config
70
- alias client_id secret api_url auth_url
71
- ------------------------------------------------------------------------------------------------------------------
72
- *main app-12345 xxxxxxxxxxxxxxx https://api.gb1.brightbox.com https://api.gb1.brightbox.com
73
- ------------------------------------------------------------------------------------------------------------------
74
-
75
- The alias here is `main`. To prepare the password run this command:
76
-
77
- $ gpg --encrypt --recipient gpg@example.com > ~/.brightbox/main.password.gpg
78
- (type your password)<RETURN>
79
- <CTRL+D>
80
- # Test it with...
81
- $ gpg --decrypt ~/.brightbox/main.password.gpg
82
- password!2015
83
- $ brightbox accounts
84
- INFO: client_id: app-12345 (main)
85
- INFO: Decrypting /home/user/.brightbox/main.password.gpg to obtain password
86
- gpg: encrypted with 2048-bit RSA key, ID ABCDE890, created 2015-01-01
87
- "Jason Null <gpg@example.com>"
88
- Your API credentials have been updated, please re-run your command.
89
-
90
- Now when making commands you should only have to unlock your keyring to avoid
91
- typing your password.
92
-
93
- If you are prompted to enter your password still then the file may be named
94
- incorrectly or there may be an issue with your GPG configuration.
95
-
96
- To remove the password delete the `~/.brightbox/main.password.gpg` file.
97
-
98
- == Usage guides
99
-
100
- * http://docs.brightbox.com/reference/cli
101
- * http://brightbox.com
102
- * http://docs.brightbox.com/reference/api/
103
-
104
- == BASH Auto-completion
105
-
106
- A bash shell auto-completion script is provided to allow
107
- autocompletion of all sub-commands, options and resource
108
- identifiers. It is automatically configured by the Debian/Ubuntu
109
- packages, but if you're installing from a gem you can manually tell
110
- bash about it like this:
111
-
112
- complete -C _brightbox-bash-completer -o filenames brightbox
113
-
114
- The command `_brightbox-bash-completer` should be installed in the
115
- system path when you install the gem. If for whatever reason it is not
116
- in the path, just specify the full path to it:
117
-
118
- complete -C /full/path/to/bin/_brightbox-bash-completer -o filenames brightbox
119
-
120
- == Testing
121
-
122
- You should be able to run the specs and features with the following steps:
123
-
124
- $ bundle install
125
- $ bundle exec rake
126
-
127
- The specs use VCR to playback filtered recordings from real API sessions. This
128
- process is not perfect, please report an issue
129
-
130
- == Alternatives
131
-
132
- There are a number of alternative ways to interact with the Brightbox Cloud.
133
-
134
- * The Web GUI - https://manage.brightbox.com/
135
- * fog - https://github.com/fog/fog
136
- * knife plugin - https://github.com/rubiojr/knife-brightbox
137
- * Vagrant plugin - https://github.com/NeilW/vagrant-brightbox
138
-
139
- == Packaging
140
-
141
- === Vendoring libraries
142
-
143
- gems can be vendored into `lib/brightbox-cli/vendor/` for packaging and will be
144
- prioritised over any gems.
145
-
146
- === Debian/Ubuntu packaging
147
-
148
- Packaging scripts are available in https://github.com/NeilW/brightbox-cli-debian-packaging
149
-
150
- == License
151
-
152
- Copyright (c) 2010-2013 John Leach, Brightbox Systems Ltd <john@brightbox.co.uk>
153
-
154
- Permission is hereby granted, free of charge, to any person obtaining a copy
155
- of this software and associated documentation files (the "Software"), to deal
156
- in the Software without restriction, including without limitation the rights
157
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
158
- copies of the Software, and to permit persons to whom the Software is
159
- furnished to do so, subject to the following conditions:
160
-
161
- The above copyright notice and this permission notice shall be included in
162
- all copies or substantial portions of the Software.
163
-
164
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
165
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
166
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
167
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
168
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
169
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
170
- THE SOFTWARE.