brightbox-cli 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0678676cc55013c6898bee325427d0c02bb2fe54
4
+ data.tar.gz: b5239144c91e70eefd0af9b738a93e951da60412
5
+ SHA512:
6
+ metadata.gz: c686363ed9d54106512b609ea7bb999fae4cdb2acdf59cbe52fb8f187d8c7b0e14746f9940b1840bffff964b257be3b76b0c3ac0810bfe329a4d6699e7657157
7
+ data.tar.gz: 124cf8b8199b53f2eb08039b296a4fe396c8f7e1b1b718457b6845638e06010890c2493b4c31109970c194137a558d96312add6ff5c0d037449352daef346045
data/.travis.yml CHANGED
@@ -5,8 +5,4 @@ rvm:
5
5
  - 1.9.2
6
6
  - 1.9.3
7
7
  - 2.0.0
8
- matrix:
9
- allow_failures:
10
- - rvm: 1.8.7
11
- - rvm: ree
12
8
 
data/Gemfile.lock CHANGED
@@ -1,13 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- brightbox-cli (1.0.0)
4
+ brightbox-cli (1.1.0)
5
5
  excon
6
- fog (~> 1.15.0)
6
+ fog (~> 1.17.0)
7
7
  gli (~> 2.8)
8
8
  highline (~> 1.6)
9
9
  hirb (~> 0.6)
10
10
  json
11
+ mime-types (~> 1.25)
11
12
  nokogiri (~> 1.5.0)
12
13
 
13
14
  GEM
@@ -16,10 +17,10 @@ GEM
16
17
  builder (3.2.2)
17
18
  coderay (1.0.9)
18
19
  diff-lcs (1.2.4)
19
- excon (0.25.3)
20
- fog (1.15.0)
20
+ excon (0.27.6)
21
+ fog (1.17.0)
21
22
  builder
22
- excon (~> 0.25.0)
23
+ excon (~> 0.27.0)
23
24
  formatador (~> 0.2.0)
24
25
  mime-types
25
26
  multi_json (~> 1.0)
@@ -28,16 +29,16 @@ GEM
28
29
  nokogiri (~> 1.5)
29
30
  ruby-hmac
30
31
  formatador (0.2.4)
31
- gli (2.8.0)
32
- highline (1.6.19)
32
+ gli (2.8.1)
33
+ highline (1.6.20)
33
34
  hirb (0.7.1)
34
- json (1.8.0)
35
+ json (1.8.1)
35
36
  metaclass (0.0.1)
36
37
  method_source (0.8.1)
37
38
  mime-types (1.25)
38
39
  mocha (0.14.0)
39
40
  metaclass (~> 0.0.1)
40
- multi_json (1.8.0)
41
+ multi_json (1.8.2)
41
42
  net-scp (1.1.2)
42
43
  net-ssh (>= 2.6.5)
43
44
  net-ssh (2.7.0)
@@ -336,7 +336,9 @@ SPEC = { "brightbox" =>
336
336
  "-t=" => "--hc-timeout=",
337
337
  "--hc-timeout=" => [%w{5000 10000 15000}],
338
338
  "-y=" => "--hc-type=",
339
- "--hc-type=" => [%w{http tcp}]
339
+ "--hc-type=" => [%w{http tcp}],
340
+ "--ssl-cert" => true,
341
+ "--ssl-key" => true
340
342
  },
341
343
  "update" =>
342
344
  {
@@ -360,6 +362,9 @@ SPEC = { "brightbox" =>
360
362
  "--hc-timeout=" => [%w{5000 10000 15000}],
361
363
  "-y=" => "--hc-type=",
362
364
  "--hc-type=" => [%w{http tcp}],
365
+ "--ssl-cert" => true,
366
+ "--ssl-key" => true,
367
+ "--remove-ssl" => true,
363
368
  :include => find_identifiers("lba-")
364
369
  },
365
370
  "list" => find_identifiers("lba-"),
@@ -411,6 +416,7 @@ SPEC = { "brightbox" =>
411
416
  "list" => find_identifiers("srv-"),
412
417
  "show" => find_identifiers("srv-"),
413
418
  "shutdown" => find_identifiers("srv-"),
419
+ "snapshot" => find_identifiers("srv-"),
414
420
  "start" => find_identifiers("srv-"),
415
421
  "stop" => find_identifiers("srv-")
416
422
  },
@@ -20,8 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_dependency "gli", "~> 2.8"
23
- s.add_dependency "fog", "~> 1.15.0"
23
+ s.add_dependency "fog", "~> 1.17.0"
24
24
  s.add_dependency "nokogiri", "~> 1.5.0" # 1.5.x last versions with 1.8.7 support
25
+ s.add_dependency "mime-types", "~> 1.25"
25
26
  s.add_dependency "excon"
26
27
  s.add_dependency "json"
27
28
 
@@ -43,6 +43,12 @@ module Brightbox
43
43
  c.default_value "3"
44
44
  c.flag [:d, "hc-down"]
45
45
 
46
+ c.desc "Filepath to the SSL certificate file to use."
47
+ c.flag ["ssl-cert"]
48
+
49
+ c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
50
+ c.flag ["ssl-key"]
51
+
46
52
  c.action do |global_options, options, args|
47
53
 
48
54
  raise "You must specify which servers to balance connections to" if args.empty?
@@ -76,6 +82,18 @@ module Brightbox
76
82
  end
77
83
  end
78
84
 
85
+ # SSL argumens
86
+ ssl_cert_path = options["ssl-cert"]
87
+ ssl_key_path = options["ssl-key"]
88
+
89
+ if ssl_cert_path.nil? ^ ssl_key_path.nil?
90
+ raise "Both SSL arguments (ssl-cert and ssl-key) are required."
91
+ end
92
+ if ssl_cert_path && ssl_key_path
93
+ ssl_cert = File.read(File.expand_path(ssl_cert_path))
94
+ ssl_key = File.read(File.expand_path(ssl_key_path))
95
+ end
96
+
79
97
  nodes = args.collect { |i| { :node => i } }
80
98
 
81
99
  msg = "Creating a new load balancer"
@@ -84,6 +102,8 @@ module Brightbox
84
102
  :name => options[:n],
85
103
  :healthcheck => healthcheck,
86
104
  :listeners => listeners,
105
+ :certificate_pem => ssl_cert,
106
+ :certificate_private_key => ssl_key,
87
107
  :nodes => nodes)
88
108
  render_table([lb], global_options)
89
109
  end
@@ -13,10 +13,22 @@ module Brightbox
13
13
  raise "Couldn't find lb #{id}"
14
14
  end
15
15
 
16
- table_opts = global_options.merge({
16
+ table_opts = global_options.merge(
17
17
  :vertical => true,
18
- :fields => [:id, :status, :name, "created_at", "deleted_at", :policy, :cloud_ips, :nodes, :listeners, :healthcheck]
19
- })
18
+ :fields => [
19
+ :id,
20
+ :status,
21
+ :name,
22
+ :created_at,
23
+ :deleted_at,
24
+ :policy,
25
+ :ssl_subject,
26
+ :ssl_expires_at,
27
+ :cloud_ips,
28
+ :nodes,
29
+ :listeners,
30
+ :healthcheck
31
+ ])
20
32
 
21
33
  render_table(lbs, table_opts)
22
34
 
@@ -36,6 +36,15 @@ module Brightbox
36
36
  c.desc "Healthcheck threshold down. Number of failed healthchecks for the node to be considered down."
37
37
  c.flag [:d, "hc-down"]
38
38
 
39
+ c.desc "Filepath to the SSL certificate file to use."
40
+ c.flag ["ssl-cert"]
41
+
42
+ c.desc "Filepath to the private key used to sign SSL certificate (OpenSSL supported formats)."
43
+ c.flag ["ssl-key"]
44
+
45
+ c.desc "Clears SSL details from the load balancer."
46
+ c.switch ["remove-ssl"], :negatable => false
47
+
39
48
  c.action do |global_options, options, args|
40
49
 
41
50
  lb_id = args.shift
@@ -78,6 +87,29 @@ module Brightbox
78
87
  lbopts[:policy] = options[:p]
79
88
  end
80
89
 
90
+ # SSL argumens
91
+ ssl_cert_path = options["ssl-cert"]
92
+ ssl_key_path = options["ssl-key"]
93
+ remove_ssl = options["remove-ssl"]
94
+
95
+ if remove_ssl && (ssl_cert_path || ssl_key_path)
96
+ raise "Cannot set an SSL argument whilst removing the certificate!"
97
+ end
98
+
99
+ if ssl_cert_path.nil? ^ ssl_key_path.nil?
100
+ raise "Both SSL arguments (ssl-cert and ssl-key) are required."
101
+ end
102
+
103
+ if ssl_cert_path && ssl_key_path
104
+ lbopts[:certificate_pem] = File.read(File.expand_path(ssl_cert_path))
105
+ lbopts[:certificate_private_key] = File.read(File.expand_path(ssl_key_path))
106
+ end
107
+
108
+ if remove_ssl
109
+ lbopts[:certificate_pem] = ""
110
+ lbopts[:certificate_private_key] = ""
111
+ end
112
+
81
113
  lbopts.nilify_blanks
82
114
 
83
115
  lb = LoadBalancer.find lb_id
@@ -8,37 +8,34 @@ module Brightbox
8
8
  c.desc "Path to public ssh key file"
9
9
  c.long_desc "This is the path to the public ssh key that you'd like to use
10
10
  for new servers. You can specify '-' to read from stdin"
11
- c.flag [:f, "ssh-key"]
11
+ c.flag [:f, "ssh-key"]
12
12
 
13
- c.desc "Name"
14
- c.flag [:n, "name"]
13
+ c.desc "Name"
14
+ c.flag [:n, "name"]
15
15
 
16
- c.action do |global_options, options, args|
16
+ c.action do |global_options, options, args|
17
17
 
18
- raise "You must specify the user id as the first argument" if args.empty?
18
+ raise "You must specify the user id as the first argument" if args.empty?
19
19
 
20
- user = User.find args.first
20
+ user = User.find args.first
21
21
 
22
- if options[:f] == "-"
23
- user.ssh_key = STDIN.read
24
- elsif options[:f]
25
- File.open(File.expand_path(options[:f])) { |f| user.ssh_key = f.read }
26
- end
27
-
28
- if options[:n]
29
- user.name = options[:n]
30
- end
22
+ if options[:f] == "-"
23
+ user.ssh_key = STDIN.read
24
+ elsif options[:f]
25
+ File.open(File.expand_path(options[:f])) { |f| user.ssh_key = f.read }
26
+ end
31
27
 
32
- user.save
28
+ user.name = options[:n] if options[:n]
33
29
 
34
- table_opts = global_options.merge({
35
- :vertical => true,
36
- :fields => [:id, :name, :email_address, :ssh_key ]
37
- })
30
+ user.save
38
31
 
39
- render_table([user], table_opts)
32
+ table_opts = global_options.merge(
33
+ :vertical => true,
34
+ :fields => [:id, :name, :email_address, :ssh_key]
35
+ )
40
36
 
41
- end
37
+ render_table([user], table_opts)
42
38
  end
43
39
  end
44
40
  end
41
+ end
@@ -10,11 +10,14 @@ module Brightbox
10
10
  end
11
11
 
12
12
  def to_row
13
- attributes.merge({ :nodes => node_ids,
13
+ attributes.merge(
14
+ :ssl_subject => certificate_subject,
15
+ :ssl_expires_at => certificate_expires_at,
16
+ :nodes => node_ids,
14
17
  :created_on => created_on,
15
18
  :listeners => listeners,
16
19
  :cloud_ips => cloud_ip_ids
17
- })
20
+ )
18
21
  end
19
22
 
20
23
  def created_on
@@ -1,3 +1,3 @@
1
1
  module Brightbox
2
- VERSION = "1.0.0" unless defined?(Brightbox::VERSION)
2
+ VERSION = "1.1.0" unless defined?(Brightbox::VERSION)
3
3
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brightbox-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
- prerelease:
4
+ version: 1.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - John Leach
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-10-03 00:00:00.000000000 Z
11
+ date: 2013-11-18 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: gli
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,23 +27,20 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: fog
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: 1.15.0
33
+ version: 1.17.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: 1.15.0
40
+ version: 1.17.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: nokogiri
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,47 +48,55 @@ dependencies:
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
54
  version: 1.5.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: mime-types
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.25'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.25'
62
69
  - !ruby/object:Gem::Dependency
63
70
  name: excon
64
71
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
72
  requirements:
67
- - - ! '>='
73
+ - - '>='
68
74
  - !ruby/object:Gem::Version
69
75
  version: '0'
70
76
  type: :runtime
71
77
  prerelease: false
72
78
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
79
  requirements:
75
- - - ! '>='
80
+ - - '>='
76
81
  - !ruby/object:Gem::Version
77
82
  version: '0'
78
83
  - !ruby/object:Gem::Dependency
79
84
  name: json
80
85
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
86
  requirements:
83
- - - ! '>='
87
+ - - '>='
84
88
  - !ruby/object:Gem::Version
85
89
  version: '0'
86
90
  type: :runtime
87
91
  prerelease: false
88
92
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
93
  requirements:
91
- - - ! '>='
94
+ - - '>='
92
95
  - !ruby/object:Gem::Version
93
96
  version: '0'
94
97
  - !ruby/object:Gem::Dependency
95
98
  name: hirb
96
99
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
100
  requirements:
99
101
  - - ~>
100
102
  - !ruby/object:Gem::Version
@@ -102,7 +104,6 @@ dependencies:
102
104
  type: :runtime
103
105
  prerelease: false
104
106
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
107
  requirements:
107
108
  - - ~>
108
109
  - !ruby/object:Gem::Version
@@ -110,7 +111,6 @@ dependencies:
110
111
  - !ruby/object:Gem::Dependency
111
112
  name: highline
112
113
  requirement: !ruby/object:Gem::Requirement
113
- none: false
114
114
  requirements:
115
115
  - - ~>
116
116
  - !ruby/object:Gem::Version
@@ -118,7 +118,6 @@ dependencies:
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
- none: false
122
121
  requirements:
123
122
  - - ~>
124
123
  - !ruby/object:Gem::Version
@@ -126,23 +125,20 @@ dependencies:
126
125
  - !ruby/object:Gem::Dependency
127
126
  name: rake
128
127
  requirement: !ruby/object:Gem::Requirement
129
- none: false
130
128
  requirements:
131
- - - ! '>='
129
+ - - '>='
132
130
  - !ruby/object:Gem::Version
133
131
  version: '0'
134
132
  type: :development
135
133
  prerelease: false
136
134
  version_requirements: !ruby/object:Gem::Requirement
137
- none: false
138
135
  requirements:
139
- - - ! '>='
136
+ - - '>='
140
137
  - !ruby/object:Gem::Version
141
138
  version: '0'
142
139
  - !ruby/object:Gem::Dependency
143
140
  name: vcr
144
141
  requirement: !ruby/object:Gem::Requirement
145
- none: false
146
142
  requirements:
147
143
  - - ~>
148
144
  - !ruby/object:Gem::Version
@@ -150,7 +146,6 @@ dependencies:
150
146
  type: :development
151
147
  prerelease: false
152
148
  version_requirements: !ruby/object:Gem::Requirement
153
- none: false
154
149
  requirements:
155
150
  - - ~>
156
151
  - !ruby/object:Gem::Version
@@ -158,7 +153,6 @@ dependencies:
158
153
  - !ruby/object:Gem::Dependency
159
154
  name: rspec
160
155
  requirement: !ruby/object:Gem::Requirement
161
- none: false
162
156
  requirements:
163
157
  - - ~>
164
158
  - !ruby/object:Gem::Version
@@ -166,7 +160,6 @@ dependencies:
166
160
  type: :development
167
161
  prerelease: false
168
162
  version_requirements: !ruby/object:Gem::Requirement
169
- none: false
170
163
  requirements:
171
164
  - - ~>
172
165
  - !ruby/object:Gem::Version
@@ -174,17 +167,15 @@ dependencies:
174
167
  - !ruby/object:Gem::Dependency
175
168
  name: mocha
176
169
  requirement: !ruby/object:Gem::Requirement
177
- none: false
178
170
  requirements:
179
- - - ! '>='
171
+ - - '>='
180
172
  - !ruby/object:Gem::Version
181
173
  version: '0'
182
174
  type: :development
183
175
  prerelease: false
184
176
  version_requirements: !ruby/object:Gem::Requirement
185
- none: false
186
177
  requirements:
187
- - - ! '>='
178
+ - - '>='
188
179
  - !ruby/object:Gem::Version
189
180
  version: '0'
190
181
  description: Scripts to interact with the Brightbox cloud API
@@ -592,39 +583,41 @@ files:
592
583
  homepage: http://docs.brightbox.com/cli
593
584
  licenses:
594
585
  - MIT
595
- post_install_message: ! "The CLI command is now `brightbox` with subcommands for the
596
- resources.\nSuch as `brightbox config` or `brightbox servers`.\n\n `brightbox --help`
597
- lists all the commands.\n\nThe old hypenated versions of the commands (e.g. `brightbox-servers`)\nare
598
- deprecated and may be removed in the future.\n\nIf you have been using the old \"brightbox\"
599
- gem please ensure you have\nthe latest version to be able to use the `brightbox-capify`
600
- command.\n\nTo enable Bash auto-completion you can do the following:\n\n complete
601
- -C _brightbox-bash-completer -o filenames brightbox\n\n"
586
+ metadata: {}
587
+ post_install_message: |+
588
+ The CLI command is now `brightbox` with subcommands for the resources.
589
+ Such as `brightbox config` or `brightbox servers`.
590
+
591
+ `brightbox --help` lists all the commands.
592
+
593
+ The old hypenated versions of the commands (e.g. `brightbox-servers`)
594
+ are deprecated and may be removed in the future.
595
+
596
+ If you have been using the old "brightbox" gem please ensure you have
597
+ the latest version to be able to use the `brightbox-capify` command.
598
+
599
+ To enable Bash auto-completion you can do the following:
600
+
601
+ complete -C _brightbox-bash-completer -o filenames brightbox
602
+
602
603
  rdoc_options: []
603
604
  require_paths:
604
605
  - lib
605
606
  required_ruby_version: !ruby/object:Gem::Requirement
606
- none: false
607
607
  requirements:
608
- - - ! '>='
608
+ - - '>='
609
609
  - !ruby/object:Gem::Version
610
610
  version: '0'
611
- segments:
612
- - 0
613
- hash: 743872907520673837
614
611
  required_rubygems_version: !ruby/object:Gem::Requirement
615
- none: false
616
612
  requirements:
617
- - - ! '>='
613
+ - - '>='
618
614
  - !ruby/object:Gem::Version
619
615
  version: '0'
620
- segments:
621
- - 0
622
- hash: 743872907520673837
623
616
  requirements: []
624
617
  rubyforge_project: brightbox-cli
625
- rubygems_version: 1.8.23
618
+ rubygems_version: 2.0.3
626
619
  signing_key:
627
- specification_version: 3
620
+ specification_version: 4
628
621
  summary: The Brightbox cloud management system
629
622
  test_files:
630
623
  - spec/brightbox_spec.rb