bosh-info 0.0.1

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bosh-differ.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jamie van Dyke
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,310 @@
1
+ # Bosh::Info
2
+
3
+ This is a simple little gem for now, banged together just to get some useful information between cf-releases. It could be so much more.
4
+
5
+ ## Installation
6
+
7
+ Install from rubygems:
8
+
9
+ $ gem install bosh-info
10
+
11
+ ## Usage
12
+
13
+ It only does one thing for now, and that's show differences between releases. Specifically property changes in spec files.
14
+
15
+ Example:
16
+
17
+ ```
18
+ $ bosh-info specs --from v134 --to v138 --cf-release /a/fearoffish/cf-release
19
+ ------------------------------------
20
+ Job: cloud_controller_ng
21
+ Removed:
22
+
23
+ ---
24
+ packages:
25
+ - ruby_next
26
+ properties:
27
+ vcap_redis.address:
28
+ description: deprecated
29
+ vcap_redis.port:
30
+ description: deprecated
31
+ vcap_redis.password:
32
+ description: deprecated
33
+ ccng.cc_partition:
34
+ default: default
35
+ ccng.use_nginx:
36
+ default: 'true'
37
+
38
+ Added:
39
+
40
+ ---
41
+ packages:
42
+ - ruby
43
+ properties:
44
+ api_version:
45
+ default: 2.0.0
46
+ description:
47
+ ccng.tasks_disabled:
48
+ default: false
49
+ description: Disable tasks endpoint
50
+ name:
51
+ default: vcap
52
+ build:
53
+ default: '2222'
54
+ version:
55
+ default: '2'
56
+ support_address:
57
+ default: http://support.cloudfoundry.com
58
+ description:
59
+ default: Cloud Foundry sponsored by Pivotal
60
+ ccng.cc_partition:
61
+ default: ng
62
+ ccng.use_nginx:
63
+ default: true
64
+ ccdb_ng.max_connections:
65
+ default: 32
66
+ ccdb_ng.pool_timeout:
67
+ default: 10
68
+ login.enabled:
69
+ default: true
70
+
71
+ ------------------------------------
72
+ Job: collector
73
+ Removed:
74
+
75
+ --- {}
76
+
77
+ Added:
78
+
79
+ ---
80
+ properties:
81
+ collector.intervals.discover:
82
+ description: the interval in seconds that the collector attempts to discover components
83
+ default: 60
84
+ collector.intervals.healthz:
85
+ description: the interval in seconds that healthz is checked
86
+ default: 30
87
+ collector.intervals.local_metrics:
88
+ description: the interval in seconds that local_metrics are checked
89
+ default: 30
90
+ collector.intervals.nats_ping:
91
+ description: the interval in seconds that the collector pings nats to record latency
92
+ default: 30
93
+ collector.intervals.prune:
94
+ description: the interval in seconds that the collector attempts to prune unresponsive
95
+ components
96
+ default: 300
97
+ collector.intervals.varz:
98
+ description: the interval in seconds that varz is checked
99
+ default: 30
100
+
101
+ ------------------------------------
102
+ Job: dea_logging_agent
103
+ Removed:
104
+
105
+ --- {}
106
+
107
+ Added:
108
+
109
+ ---
110
+ name: dea_logging_agent
111
+ templates:
112
+ dea_logging_agent_ctl.erb: bin/dea_logging_agent_ctl
113
+ dea_logging_agent.json.erb: config/dea_logging_agent.json
114
+ packages:
115
+ - common
116
+ - dea_logging_agent
117
+ properties:
118
+ loggregator.debug:
119
+ description: boolean value to turn on verbose logging for loggregator system (dea
120
+ agent & loggregator server)
121
+ default: false
122
+ loggregator.server:
123
+ description: loggregator server in host:port format
124
+ loggregator.status.user:
125
+ description: username used to log into varz endpoint
126
+ loggregator.status.password:
127
+ description: password used to log into varz endpoint
128
+ loggregator.status.port:
129
+ description: port used to run the varz endpoint
130
+ nats.user:
131
+ description: Username for cc client to connect to NATS
132
+ nats.password:
133
+ description: Password for cc client to connect to NATS
134
+ nats.address:
135
+ description: IP address of Cloud Foundry NATS server
136
+ nats.port:
137
+ description: IP port of Cloud Foundry NATS server
138
+
139
+ ------------------------------------
140
+ Job: dea_next
141
+ Removed:
142
+
143
+ ---
144
+ packages:
145
+ - ruby_next
146
+ - imagemagick
147
+
148
+ Added:
149
+
150
+ ---
151
+ packages:
152
+ - ruby
153
+ properties:
154
+ dea_next.directory_server_protocol:
155
+ description: The protocol to use when communicating with the directory server
156
+ ("http" or "https")
157
+ default: https
158
+ dea_next.kernel_network_tuning_enabled:
159
+ description: with latest kernel version, no kernel network tunings allowed with
160
+ in warden cpi containers
161
+ default: true
162
+ disk_quota_enabled:
163
+ description: disk quota must be disabled to use warden-inside-warden with the
164
+ warden cpi
165
+ default: true
166
+ syslog_aggregator:
167
+ description: Syslog aggregator stuff
168
+ dea_next.stacks:
169
+ default:
170
+ - lucid64
171
+
172
+ ------------------------------------
173
+ Job: health_manager_next
174
+ Removed:
175
+
176
+ ---
177
+ packages:
178
+ - ruby_next
179
+
180
+ Added:
181
+
182
+ ---
183
+ packages:
184
+ - ruby
185
+
186
+ ------------------------------------
187
+ Job: loggregator
188
+ Removed:
189
+
190
+ --- {}
191
+
192
+ Added:
193
+
194
+ ---
195
+ name: loggregator
196
+ templates:
197
+ loggregator_ctl.erb: bin/loggregator_ctl
198
+ loggregator.json.erb: config/loggregator.json
199
+ uaa_token.pub.erb: config/uaa_token.pub
200
+ packages:
201
+ - common
202
+ - loggregator
203
+ properties:
204
+ loggregator.debug:
205
+ description: boolean value to turn on verbose logging for loggregator system (dea
206
+ agent & loggregator server)
207
+ default: false
208
+ loggregator.status.user:
209
+ description: username used to log into varz endpoint
210
+ loggregator.status.password:
211
+ description: password used to log into varz endpoint
212
+ loggregator.status.port:
213
+ description: port used to run the varz endpoint
214
+ loggregator.maxRetainedLogMessages:
215
+ description: number of log messages to retain per application
216
+ default: 10
217
+ cc.srv_api_uri:
218
+ description: API URI of cloud controller
219
+ nats.user:
220
+ description: Username for cc client to connect to NATS
221
+ nats.password:
222
+ description: Password for cc client to connect to NATS
223
+ nats.address:
224
+ description: IP address of Cloud Foundry NATS server
225
+ nats.port:
226
+ description: IP port of Cloud Foundry NATS server
227
+ system_domain:
228
+ description: Domain reserved for CF operator, base URL where the login, uaa, and
229
+ other non-user apps listen
230
+ uaa.jwt.verification_key:
231
+ description: ssl cert defined in the manifest by the UAA, required by the cc to
232
+ communicate with UAA
233
+
234
+ ------------------------------------
235
+ Job: login
236
+ Removed:
237
+
238
+ ---
239
+ packages:
240
+ - ruby_next
241
+
242
+ Added:
243
+
244
+ ---
245
+ packages:
246
+ - ruby
247
+ properties:
248
+ login.protocol:
249
+ default: http
250
+ description: The scheme in which login server should use to contact the UAA
251
+ login.port:
252
+ default: 8080
253
+
254
+ ------------------------------------
255
+ Job: saml_login
256
+ Removed:
257
+
258
+ ---
259
+ packages:
260
+ - ruby_next
261
+
262
+ Added:
263
+
264
+ ---
265
+ packages:
266
+ - ruby
267
+
268
+ ------------------------------------
269
+ Job: syslog_aggregator
270
+ Removed:
271
+
272
+ ---
273
+ templates:
274
+ nats_capture_run.erb: sv/nats_capture/run
275
+ nats_capture_log: sv/nats_capture/log/run
276
+ nats_capture_config: config/nats_capture_config
277
+ packages:
278
+ - ruby_next
279
+
280
+ Added:
281
+
282
+ ---
283
+ templates:
284
+ nats_stream_forwarder.rb: bin/nats_stream_forwarder.rb
285
+ nats_stream_forwarder_ctl: bin/nats_stream_forwarder_ctl
286
+ packages:
287
+ - ruby
288
+
289
+ ------------------------------------
290
+ Job: uaa
291
+ Removed:
292
+
293
+ ---
294
+ packages:
295
+ - ruby_next
296
+
297
+ Added:
298
+
299
+ ---
300
+ packages:
301
+ - ruby
302
+ ```
303
+
304
+ ## Contributing
305
+
306
+ 1. Fork it
307
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
308
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
309
+ 4. Push to the branch (`git push origin my-new-feature`)
310
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/bin/bosh-info ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby
2
+ $:.push File.dirname(__FILE__) + '/../lib'
3
+
4
+ require "rubygems"
5
+ require "bundler/setup"
6
+
7
+ require "bosh/info"
8
+ require "bosh/info/thor_cli"
9
+
10
+ Bosh::Info::ThorCli.start
data/bosh-info.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bosh/info/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bosh-info"
8
+ spec.version = Bosh::Info::VERSION
9
+ spec.authors = ["Jamie van Dyke"]
10
+ spec.email = ["jamie@fearoffish.com"]
11
+ spec.description = %q{Grabs information on BOSH releases}
12
+ spec.summary = %q{Example: Diff the files in a bosh release and output in various formats}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+
24
+ spec.add_dependency "thor", "~> 0.18"
25
+ spec.add_dependency "redcard"
26
+ spec.add_dependency "interact"
27
+ spec.add_dependency "easy_diff"
28
+ spec.add_dependency "term-ansicolor"
29
+ end
@@ -0,0 +1,86 @@
1
+ module Bosh; module Info; module Cli; module Commands; end; end; end; end
2
+
3
+ require 'easy_diff'
4
+ require 'yaml'
5
+ require "bosh/info/cli/helpers"
6
+
7
+ # Runs SSH to the microbosh server
8
+ class Bosh::Info::Cli::Commands::Specs
9
+ include Bosh::Info::Cli::Helpers
10
+
11
+ def initialize(options)
12
+ @options = options
13
+ end
14
+
15
+ def perform
16
+ spec_diff(@options[:from], @options[:to] || 'HEAD')
17
+ end
18
+
19
+ protected
20
+
21
+ def spec_diff(from, to="HEAD")
22
+ # yeah, not sure if this is the best way but it will do for now
23
+ spec_string = `cd #{@options[:cf_release]}; PAGER='' git diff --unified=1000000 #{from} #{to || 'HEAD'} -- jobs/\*/spec 2> /dev/null`
24
+ if spec_string == ""
25
+ puts "Did you specify your cf-release folder? This one looks empty or wrong."
26
+ exit
27
+ end
28
+ specs = find_diffs(spec_string, from, to)
29
+ output_diff(specs)
30
+ end
31
+
32
+ def find_diffs(spec_string, from, to)
33
+ specs = {}
34
+ spec_string.split("\n").each do |spec_string|
35
+ if new_file = spec_string.match(/^diff --git (.*) .*/)
36
+ full_filename = new_file[1].split("/")[1..-1].join("/")
37
+ job = new_file[1].split("/")[-2]
38
+ removed, added = file_as_hash(full_filename, from, to)
39
+ specs[job] = {
40
+ full_filename: full_filename,
41
+ job: job,
42
+ removed: removed,
43
+ added: added
44
+ }
45
+ end
46
+ end
47
+ specs
48
+ end
49
+
50
+ def file_as_hash(file, from, to)
51
+ before = YAML.load `cd #{@options[:cf_release]}; PAGER='' git show #{from}:#{file} 2> /dev/null`
52
+ after = YAML.load `cd #{@options[:cf_release]}; PAGER='' git show #{to}:#{file} 2> /dev/null`
53
+ begin
54
+ removed, added = before.easy_diff after
55
+ rescue => x
56
+ return [before || {}, after || {}]
57
+ end
58
+ [remove_empties(removed), remove_empties(added)]
59
+ end
60
+
61
+ def remove_empties(hash)
62
+ if hash.kind_of?(Hash)
63
+ hash.each do |key, value|
64
+ if value.is_a?(Enumerable)
65
+ remove_empties(value)
66
+ if value.empty?
67
+ hash.delete(key)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+
74
+ def output_diff(specs)
75
+ specs.each do |file, values|
76
+ puts "------------------------------------"
77
+ puts "Job: #{values[:job]}".blue
78
+ puts "Removed:"
79
+ puts
80
+ puts values[:removed].to_yaml.red
81
+ puts "Added:"
82
+ puts
83
+ puts values[:added].to_yaml.green
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,8 @@
1
+ require 'fileutils'
2
+
3
+ module Bosh::Info::Cli::Helpers::Git
4
+ include FileUtils::Verbose
5
+
6
+
7
+
8
+ end
@@ -0,0 +1,7 @@
1
+ module Bosh; module Info; module Cli; module Helpers; end; end; end; end
2
+
3
+ require "bosh/info/cli/helpers/git"
4
+
5
+ module Bosh::Info::Cli::Helpers
6
+ include Bosh::Info::Cli::Helpers::Git
7
+ end
@@ -0,0 +1,5 @@
1
+ require 'term/ansicolor'
2
+
3
+ class String
4
+ include Term::ANSIColor
5
+ end
@@ -0,0 +1,17 @@
1
+ require "thor"
2
+ require "bosh/info"
3
+
4
+ module Bosh::Info
5
+ class ThorCli < Thor
6
+
7
+ desc "specs", "Show job spec file differences between git tags"
8
+ option :cf_release, default: ".", desc: "The folder that contains cf-release"
9
+ option :from, required: true, desc: "The tag or sha in history to compare"
10
+ option :to, required: false, desc: "The tag or sha in future to compare", banner: "HEAD"
11
+ def specs
12
+ require "bosh/info/cli/commands/specs"
13
+ specs_cmd = Bosh::Info::Cli::Commands::Specs.new(options)
14
+ specs_cmd.perform
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ module Bosh
2
+ module Info
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/bosh/info.rb ADDED
@@ -0,0 +1,14 @@
1
+ # Requires Ruby language 1.9 and MRI or Rubinius
2
+ require "redcard"
3
+ RedCard.verify :mri, :ruby, :rubinius, "1.9"
4
+
5
+ require "bosh/info/core_ext/string"
6
+ require "bosh/info/version"
7
+ require "bundler/setup"
8
+
9
+ Bundler.require
10
+
11
+ module Bosh
12
+ module Info
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,173 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bosh-info
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Jamie van Dyke
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-08-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: thor
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '0.18'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '0.18'
62
+ - !ruby/object:Gem::Dependency
63
+ name: redcard
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: interact
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: easy_diff
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: term-ansicolor
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: Grabs information on BOSH releases
127
+ email:
128
+ - jamie@fearoffish.com
129
+ executables:
130
+ - bosh-info
131
+ extensions: []
132
+ extra_rdoc_files: []
133
+ files:
134
+ - .gitignore
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - bin/bosh-info
140
+ - bosh-info.gemspec
141
+ - lib/bosh/info.rb
142
+ - lib/bosh/info/cli/commands/specs.rb
143
+ - lib/bosh/info/cli/helpers.rb
144
+ - lib/bosh/info/cli/helpers/git.rb
145
+ - lib/bosh/info/core_ext/string.rb
146
+ - lib/bosh/info/thor_cli.rb
147
+ - lib/bosh/info/version.rb
148
+ homepage: ''
149
+ licenses:
150
+ - MIT
151
+ post_install_message:
152
+ rdoc_options: []
153
+ require_paths:
154
+ - lib
155
+ required_ruby_version: !ruby/object:Gem::Requirement
156
+ none: false
157
+ requirements:
158
+ - - ! '>='
159
+ - !ruby/object:Gem::Version
160
+ version: '0'
161
+ required_rubygems_version: !ruby/object:Gem::Requirement
162
+ none: false
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ requirements: []
168
+ rubyforge_project:
169
+ rubygems_version: 1.8.23
170
+ signing_key:
171
+ specification_version: 3
172
+ summary: ! 'Example: Diff the files in a bosh release and output in various formats'
173
+ test_files: []