broham 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.14
1
+ 0.0.15
data/bin/broham CHANGED
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -34,7 +34,7 @@ class BrohamScript
34
34
  broham_args = Settings[:set]||{}
35
35
  BrohamScript.get_commandline_predicates :role_name
36
36
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
37
- new_bro = Broham.register(role_name)
37
+ new_bro = Broham.register(role_name, broham_args)
38
38
  dump_table [new_bro]
39
39
  end
40
40
 
@@ -43,7 +43,7 @@ class BrohamScript
43
43
  broham_args = Settings[:set]||{}
44
44
  BrohamScript.get_commandline_predicates :role_name
45
45
  $stderr.puts %Q{Registering #{role_name} -- #{broham_args}}
46
- new_bro = Broham.register_as_next(role_name)
46
+ new_bro = Broham.register_as_next(role_name, broham_args)
47
47
  dump_table [new_bro]
48
48
  end
49
49
 
@@ -78,6 +78,8 @@ class BrohamScript
78
78
  unregister_cmd
79
79
  when 'unregister_like', 'fuck_all_yall'
80
80
  unregister_like_cmd
81
+ when 'register_as_next'
82
+ register_as_next_cmd
81
83
  when 'get', 'word'
82
84
  get_cmd
83
85
  when ''
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{broham}
8
- s.version = "0.0.14"
8
+ s.version = "0.0.15"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Philip (flip) Kromer"]
12
- s.date = %q{2010-05-16}
12
+ s.date = %q{2010-06-08}
13
13
  s.description = %q{Bro! Broham always knows where his bros are, bro. Using broham, a newly-created cloud machine can annouce its availability for a certain role ("nfs_server" or "db_slave-2"), allowing any other interested nodes to discover its public_ip, private_ip, etc. See also: http://j.mp/amongbros}
14
14
  s.email = %q{flip@infochimps.org}
15
15
  s.executables = ["broham", "broham-diss", "broham-fuck_all_yall", "broham-get", "broham-hosts", "broham-register", "broham-register_as_next", "broham-sup", "broham-unregister", "broham-unregister_like", "broham-word", "broham-yo", "broham-yo_yo_yo"]
@@ -39,6 +39,7 @@ Gem::Specification.new do |s|
39
39
  "bin/broham-yo_yo_yo",
40
40
  "broham.gemspec",
41
41
  "lib/broham.rb",
42
+ "lib/broham/cluster.rb",
42
43
  "lib/broham/script.rb",
43
44
  "lib/broham/sdb.rb",
44
45
  "lib/broham/sdb/active_sdb.rb",
@@ -50,7 +51,7 @@ Gem::Specification.new do |s|
50
51
  s.homepage = %q{http://github.com/mrflip/broham}
51
52
  s.rdoc_options = ["--charset=UTF-8"]
52
53
  s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.6}
54
+ s.rubygems_version = %q{1.3.7}
54
55
  s.summary = %q{Broham: A simple, global, highly-available, none-too-bright service registry. Broham always knows where his bros are, bro.}
55
56
  s.test_files = [
56
57
  "spec/broham_spec.rb",
@@ -61,7 +62,7 @@ Gem::Specification.new do |s|
61
62
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
62
63
  s.specification_version = 3
63
64
 
64
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
65
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
65
66
  s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
66
67
  s.add_development_dependency(%q<yard>, [">= 0"])
67
68
  else
@@ -2,6 +2,7 @@
2
2
  require 'right_aws'
3
3
  require 'sdb/active_sdb'
4
4
  require 'broham/sdb'
5
+ require 'broham/cluster'
5
6
 
6
7
  # Machine information
7
8
  require 'ohai'
@@ -129,10 +130,11 @@ class Broham < RightAws::ActiveSdb::Base
129
130
  end
130
131
 
131
132
  def self.establish_connection options={}
133
+ return @connection if @connection
132
134
  options = { :logger => Log }.merge options
133
135
  access_key = options[:access_key] || Settings[:access_key]
134
136
  secret_access_key = options[:secret_access_key] || Settings[:secret_access_key]
135
- @connection ||= RightAws::ActiveSdb.establish_connection(access_key, secret_access_key, options)
137
+ @connection = RightAws::ActiveSdb.establish_connection(access_key, secret_access_key, options)
136
138
  end
137
139
 
138
140
  # Register an nfs server share
@@ -0,0 +1,51 @@
1
+ #
2
+ #
3
+ # This actually reaches into the settings hash and supplies
4
+ #
5
+ # (it's written like this so that chef
6
+ #
7
+ class BrohamNode < RightAws::ActiveSdb::Base
8
+ attr_accessor :settings
9
+
10
+ def self.set_cluster_info! settings
11
+ node = new(settings)
12
+ node.set_cluster_info!
13
+ node.settings
14
+ end
15
+
16
+ #
17
+ # Settings hash must contain
18
+ # * 'aws':: a hash with keys 'access_key' and 'secret_access_key' holding your AWS credentsials
19
+ # * 'cluster_name':: name of the cluster
20
+ # * 'cluster_role':: role within that cluster
21
+ #
22
+ # Method will set values for
23
+ # * 'cluster_role_index'
24
+ # * 'node_name'
25
+ #
26
+ def initialize settings
27
+ self.settings = settings
28
+ end
29
+
30
+ def set_cluster_info!
31
+ settings['cluster_role_index'] ||= broham_attr('idx')
32
+ end
33
+
34
+ # retrieve a simple scalar value from the broham info
35
+ def broham_attr attr
36
+ [ broham_info[attr] ].flatten.first
37
+ end
38
+
39
+ # Return cached copy of the broham registration, if any
40
+ #
41
+ def broham_info
42
+ return @broham_info if @broham_info
43
+ establish_connection
44
+ @broham_info ||= Broham.register_as_next("#{settings["cluster_name"]}-#{settings["cluster_role"]}")
45
+ end
46
+
47
+ def establish_connection
48
+ raise "Need to supply an AWS credentials hash with keys 'access_key' and 'secret_access_key'" if settings["aws"].blank?
49
+ Broham.establish_connection(:access_key => settings["aws"]["access_key"], :secret_access_key => settings["aws"]["secret_access_key"])
50
+ end
51
+ end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: broham
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 1
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 14
9
- version: 0.0.14
9
+ - 15
10
+ version: 0.0.15
10
11
  platform: ruby
11
12
  authors:
12
13
  - Philip (flip) Kromer
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-16 00:00:00 -05:00
18
+ date: 2010-06-08 00:00:00 -05:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rspec
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 2
@@ -35,9 +38,11 @@ dependencies:
35
38
  name: yard
36
39
  prerelease: false
37
40
  requirement: &id002 !ruby/object:Gem::Requirement
41
+ none: false
38
42
  requirements:
39
43
  - - ">="
40
44
  - !ruby/object:Gem::Version
45
+ hash: 3
41
46
  segments:
42
47
  - 0
43
48
  version: "0"
@@ -86,6 +91,7 @@ files:
86
91
  - bin/broham-yo_yo_yo
87
92
  - broham.gemspec
88
93
  - lib/broham.rb
94
+ - lib/broham/cluster.rb
89
95
  - lib/broham/script.rb
90
96
  - lib/broham/sdb.rb
91
97
  - lib/broham/sdb/active_sdb.rb
@@ -103,23 +109,27 @@ rdoc_options:
103
109
  require_paths:
104
110
  - lib
105
111
  required_ruby_version: !ruby/object:Gem::Requirement
112
+ none: false
106
113
  requirements:
107
114
  - - ">="
108
115
  - !ruby/object:Gem::Version
116
+ hash: 3
109
117
  segments:
110
118
  - 0
111
119
  version: "0"
112
120
  required_rubygems_version: !ruby/object:Gem::Requirement
121
+ none: false
113
122
  requirements:
114
123
  - - ">="
115
124
  - !ruby/object:Gem::Version
125
+ hash: 3
116
126
  segments:
117
127
  - 0
118
128
  version: "0"
119
129
  requirements: []
120
130
 
121
131
  rubyforge_project:
122
- rubygems_version: 1.3.6
132
+ rubygems_version: 1.3.7
123
133
  signing_key:
124
134
  specification_version: 3
125
135
  summary: "Broham: A simple, global, highly-available, none-too-bright service registry. Broham always knows where his bros are, bro."