auser-poolparty 0.2.88 → 0.2.89

Sign up to get free protection for your applications and to get access to all the features.
data/PostInstall.txt CHANGED
@@ -1,4 +1,4 @@
1
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 02:30 12/16/08)
1
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 16:58 12/16/08)
2
2
 
3
3
  To get started, run the generator:
4
4
 
@@ -7,9 +7,9 @@ module PoolParty
7
7
  has_package({:name => "haproxy"})
8
8
 
9
9
  # Service is required
10
- has_service(:name => "haproxy", :ensures => "running")
10
+ has_service(:name => "haproxy", :ensures => "running", :hasrestart => true)
11
11
  # Restart sysklogd after we update the haproxy.log
12
- has_service(:name => "sysklogd", :notify => get_service("haproxy"))
12
+ has_service(:name => "sysklogd")
13
13
 
14
14
  # Template variables
15
15
  has_variable(:name => "name_haproxy", :value => "#{cloud.name}")
@@ -90,7 +90,7 @@ module PoolParty
90
90
  blk.call(@opts, self) if blk
91
91
  end
92
92
 
93
- @opts.on('-V', '--version', 'Display the version') { puts @version ; exit 0 }
93
+ @opts.on('-V', '--version', 'Display the version') { output_version ; exit 0 }
94
94
  @opts.on_tail("-h", "--help", "Show this message") do
95
95
  puts @opts
96
96
  puts @extra_help
@@ -127,7 +127,7 @@ module PoolParty
127
127
  end
128
128
 
129
129
  def output_version
130
- puts @version
130
+ puts ::PoolParty::Version
131
131
  end
132
132
 
133
133
  end
@@ -38,10 +38,15 @@ module PoolParty
38
38
  end
39
39
 
40
40
  def setup_dev
41
+ return true if ::File.exists?("#{remote_keypair_path}") || master.nil?
41
42
  unless ::File.exists?("#{full_keypair_basename_path}.pub")
42
43
  cmd = "scp #{scp_array.join(" ")} #{Base.user}@#{master.ip}:.ssh/authorized_keys #{full_keypair_basename_path}.pub"
43
44
  vputs "Running #{cmd}"
44
- Kernel.system(cmd)
45
+ if %x[hostname].chomp == "master"
46
+ Kernel.system("cat ~/.ssh/authorized_keys > #{full_keypair_basename_path}.pub")
47
+ else
48
+ Kernel.system(cmd)
49
+ end
45
50
  end
46
51
  end
47
52
 
@@ -100,8 +105,8 @@ module PoolParty
100
105
  def keypair_paths
101
106
  [
102
107
  Base.base_keypair_path,
103
- Base.base_config_directory,
104
- Base.remote_storage_path
108
+ Base.remote_storage_path,
109
+ Base.base_config_directory
105
110
  ]
106
111
  end
107
112
 
@@ -91,10 +91,10 @@ end
91
91
  begin
92
92
  # when_no_pending_instances do
93
93
  if instance
94
- ec2.attach_volume(:volume_id => ebs_volume_id, :instance_id => instance.instance_id, :device => ebs_volume_device) if ebs_volume_id && ebs_volume_mount_point
94
+ attach_volume(instance)
95
95
  # Let's associate the address LAST so that we can still connect to the instance
96
- # for the other tasks here
97
- ec2.associate_address(:instance_id => instance.instance_id, :public_ip => set_master_ip_to) if set_master_ip_to
96
+ # for the other tasks here
97
+ associate_address(instance)
98
98
  reset_remoter_base!
99
99
  end
100
100
  # end
@@ -104,6 +104,17 @@ end
104
104
  reset_remoter_base!
105
105
  when_all_assigned_ips {wait "5.seconds"}
106
106
  end
107
+
108
+ def attach_volume(instance=nil)
109
+ vputs "Attaching volume #{ebs_volume_id} to the master at #{ebs_volume_device}"
110
+ instance = master
111
+ ec2.attach_volume(:volume_id => ebs_volume_id, :instance_id => instance.instance_id, :device => ebs_volume_device) if ebs_volume_id && ebs_volume_mount_point
112
+ end
113
+ def associate_address(instance=nil)
114
+ vputs "Associating master with #{set_master_ip_to}"
115
+ instance = master
116
+ ec2.associate_address(:instance_id => instance.instance_id, :public_ip => set_master_ip_to) if set_master_ip_to
117
+ end
107
118
 
108
119
  # Help create a keypair for the cloud
109
120
  # This is a helper to create the keypair and add them to the cloud for you
@@ -134,6 +145,17 @@ end
134
145
  # copy_file_to_storage_directory(pub_key)
135
146
  # copy_file_to_storage_directory(private_key)
136
147
  end
148
+ if set_master_ip_to && master.ip.to_s != set_master_ip_to.to_s
149
+ associate_address(master)
150
+ reset_remoter_base!
151
+
152
+ when_no_pending_instances do
153
+ when_all_assigned_ips do
154
+ vputs "Associated master with #{set_master_ip_to}"
155
+ end
156
+ end
157
+ end
158
+
137
159
  end
138
160
  def has_cert_and_key?
139
161
  pub_key && private_key
@@ -47,12 +47,11 @@ module PoolParty
47
47
  def remote_rsync_command
48
48
  "rsync -azP --exclude cache -e '#{remote_ssh_string}'"
49
49
  end
50
-
51
-
52
- # def scp_command(source, dest=target, remote_instance=master)
53
- # #TODO: check if source is Directory and add -r if it is
54
- # "scp #{source} #{remote_instance.ip}:#{dest} #{ssh_array.join(' ')}"
55
- # end
50
+
51
+ def scp_to_command(source, dest=target, remote_instance=master)
52
+ #TODO: check if source is Directory and add -r if it is
53
+ "scp #{source} #{remote_instance.ip}:#{dest} #{scp_array.join(' ')}"
54
+ end
56
55
 
57
56
  # Get the names of the nodes. Mainly used for puppet templating
58
57
  def list_of_node_names(options={})
@@ -9,14 +9,14 @@ module PoolParty
9
9
  def process_install!(testing=false)
10
10
  unless testing
11
11
  @cloud.rsync_storage_files_to(@instance)
12
- roles = provision_master? ? [:master] : [:slaves]
12
+ roles = provision_master? ? [:master] : [:single]
13
13
  run_capistrano(roles,:install)
14
14
  end
15
15
  end
16
16
  def process_configure!(testing=false)
17
17
  unless testing
18
18
  @cloud.rsync_storage_files_to(@instance)
19
- roles = provision_master? ? [:master] : [:slaves]
19
+ roles = provision_master? ? [:master] : [:single]
20
20
  run_capistrano(roles, :configure)
21
21
  end
22
22
  end
@@ -34,12 +34,14 @@ module PoolParty
34
34
  "master_provision_master_task",
35
35
  "after_install_tasks",
36
36
  "custom_configure_tasks",
37
- "run_provisioner_twice",
38
- "master_configure_master_task"
37
+ "before_configuration_tasks",
38
+ "master_configure_master_task",
39
+ "run_provisioner_twice"
39
40
  ]#.map {|a| a.to_sym }
40
41
  end
41
42
  def master_configure_tasks
42
43
  [
44
+ "before_configuration_tasks",
43
45
  "master_configure_master_task"
44
46
  ]#.map {|a| a.to_sym }
45
47
  end
@@ -69,6 +71,7 @@ module PoolParty
69
71
  arr << "role 'master.#{@cloud.name}'.to_sym, '#{@cloud.master.ip}'"
70
72
  arr << "role :master, '#{@cloud.master.ip}'"
71
73
  arr << "role :slaves, '#{@cloud.nonmaster_nonterminated_instances.map{|a| a.ip}.join('", "')}'" if @cloud.nonmaster_nonterminated_instances.size > 0
74
+ arr << "role :single, '#{@instance.ip}'" if @instance && @instance.ip
72
75
  end.join("\n")
73
76
  end
74
77
 
@@ -58,16 +58,17 @@ Capistrano::Configuration.instance(:must_exist).load do
58
58
  end
59
59
  desc "Update rubygems"
60
60
  def update_rubygems
61
- run "/usr/bin/gem update --system 2>1 > /dev/null && /usr/bin/gem update --system"
61
+ run "/usr/bin/gem update --system 2>1 > /dev/null;/usr/bin/gem update --system;echo 'gems updated'"
62
62
  end
63
63
  desc "Fix rubygems"
64
64
  def fix_rubygems
65
65
  # echo '#{open(::File.join(template_directory, "gem")).read}' > /usr/bin/gem &&
66
66
  # cp #{remote_storage_path}/gem /usr/bin/gem
67
67
  run <<-EOR
68
- if gem -v; then echo "gem is working"; else cp #{remote_storage_path}/gem /usr/bin/gem; fi &&
69
- /usr/bin/gem update --system 2>&1 > /dev/null;/usr/bin/gem update --system &&
70
- if gem -v; then echo "gem is working"; else cp #{remote_storage_path}/gem /usr/bin/gem; fi
68
+ if gem -v; then echo "gem is working"; else cp #{remote_storage_path}/gem /usr/bin/gem; fi;
69
+ /usr/bin/gem update --system 2>&1 > /dev/null;/usr/bin/gem update --system;
70
+ if gem -v; then echo "gem is working"; else cp #{remote_storage_path}/gem /usr/bin/gem; fi;
71
+ echo 'gems updated!'
71
72
  EOR
72
73
  end
73
74
  desc "Upgrade system"
@@ -97,7 +97,7 @@ Capistrano::Configuration.instance(:must_exist).load do
97
97
  end
98
98
  desc "Move poolparty keys"
99
99
  def move_poolparty_keys
100
- run "cp #{remote_storage_path}/#{@full_keypair_name} #{@remote_keypair_path}"
100
+ run "cp #{remote_storage_path}/#{full_keypair_name} #{remote_keypair_path}"
101
101
  end
102
102
  # end
103
103
  end
@@ -30,7 +30,7 @@ Capistrano::Configuration.instance(:must_exist).load do
30
30
  end
31
31
  desc "Add master ip to hosts file"
32
32
  def add_master_to_hosts_file
33
- run "if [ -z \"$(grep -v '#' /etc/hosts | grep 'master')\" ]; then echo '#{cloud.master.ip} puppet master' >> /etc/hosts; else echo 'host already set'; fi"
33
+ run "if [ -z \"$(grep -v '#' /etc/hosts | grep 'master' | grep '#{cloud.master.ip}' )\" ]; then echo '#{cloud.master.ip} puppet master' >> /etc/hosts; else echo 'host already set'; fi"
34
34
  end
35
35
  desc "Stop provisioner daemon"
36
36
  def stop_provisioner_daemon
@@ -4,6 +4,12 @@ module PoolParty
4
4
  MINOR = 2
5
5
  TINY = 89
6
6
 
7
- STRING = [MAJOR, MINOR, TINY].join('.')
7
+ STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
+ class Version
10
+ def self.to_s
11
+ [VERSION::MAJOR, VERSION::MINOR, VERSION::TINY].join('.')
12
+ end
13
+ end
14
+
9
15
  end
data/poolparty.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.88
4
+ version: 0.2.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -532,7 +532,7 @@ files:
532
532
  has_rdoc: true
533
533
  homepage: http://poolparty.rubyforge.org
534
534
  post_install_message: |-
535
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 02:30 12/16/08)
535
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 16:58 12/16/08)
536
536
 
537
537
  To get started, run the generator:
538
538
 
@@ -9,6 +9,9 @@ describe "ProvisionerBase" do
9
9
  @pb = PoolParty::Provisioner::ProvisionerBase.new(@remote_instance, @cloud)
10
10
  stub_list_from_remote_for(@cloud)
11
11
  stub_remoting_methods_for(@cloud)
12
+ Kernel.stub!(:sleep).and_return true
13
+ @cloud.stub!(:when_no_pending_instances).and_return true
14
+ @cloud.stub!(:when_all_assigned_ips).and_return true
12
15
  end
13
16
  describe "class methods" do
14
17
  it "should have install" do
data/website/index.html CHANGED
@@ -34,7 +34,7 @@
34
34
  <h1>PoolParty</h1>
35
35
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/poolparty"; return false'>
36
36
  <p>Get Version</p>
37
- <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.88</a>
37
+ <a href="http://rubyforge.org/projects/poolparty" class="numbers">0.2.89</a>
38
38
  </div>
39
39
  <h1>&#8216;Easy cloud computing&#8217;</h1>
40
40
  <h2>What</h2>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auser-poolparty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.88
4
+ version: 0.2.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ari Lerner
@@ -532,7 +532,7 @@ files:
532
532
  has_rdoc: true
533
533
  homepage: http://poolparty.rubyforge.org
534
534
  post_install_message: |-
535
- Get ready to jump in the pool, you just installed PoolParty! (Updated at 02:30 12/16/08)
535
+ Get ready to jump in the pool, you just installed PoolParty! (Updated at 16:58 12/16/08)
536
536
 
537
537
  To get started, run the generator:
538
538