engineyard-serverside 1.5.27.pre2 → 1.5.27.pre3

Sign up to get free protection for your applications and to get access to all the features.
@@ -56,7 +56,7 @@ module EY
56
56
  EY::Serverside::LoggedOutput.verbose = options[:verbose]
57
57
  EY::Serverside::LoggedOutput.logfile = File.join(ENV['HOME'], "#{options[:app]}-deploy.log")
58
58
 
59
- propagate
59
+ invoke :propagate
60
60
 
61
61
  EY::Serverside::Deploy.new(config).send(default_task)
62
62
  end
@@ -137,7 +137,7 @@ module EY
137
137
 
138
138
  EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
139
139
 
140
- propagate
140
+ invoke :propagate
141
141
 
142
142
  EY::Serverside::Server.all.each do |server|
143
143
  server.sync_directory app_dir
@@ -183,7 +183,7 @@ module EY
183
183
  config = EY::Serverside::Deploy::Configuration.new(options)
184
184
  EY::Serverside::Server.load_all_from_array(assemble_instance_hashes(config))
185
185
 
186
- propagate
186
+ invoke :propagate
187
187
 
188
188
  EY::Serverside::Deploy.new(config).restart_with_maintenance_page
189
189
  end
@@ -205,22 +205,31 @@ module EY
205
205
 
206
206
  desc "propagate", "Propagate the engineyard-serverside gem to the other instances in the cluster. This will install exactly version #{EY::Serverside::VERSION}."
207
207
  def propagate
208
- name = "engineyard-serverside"
209
- version = EY::Serverside::VERSION
210
- gem_filename = "#{name}-#{version}.gem"
208
+ config = EY::Serverside::Deploy::Configuration.new
209
+ gem_filename = "engineyard-serverside-#{EY::Serverside::VERSION}.gem"
211
210
  local_gem_file = File.join(Gem.dir, 'cache', gem_filename)
212
211
  remote_gem_file = File.join(Dir.tmpdir, gem_filename)
212
+ gem_binary = File.join(Gem.default_bindir, 'gem')
213
213
 
214
214
  servers = EY::Serverside::Server.all.find_all { |server| !server.local? }
215
215
 
216
216
  futures = EY::Serverside::Future.call(servers) do |server|
217
- installed = server.gem?(name, version)
218
- unless installed
219
- info "~> Installing #{name} on #{server.hostname}"
220
- server.copy(local_gem_file, remote_gem_file)
221
- installed = server.install_gem(remote_gem_file)
217
+ egrep_escaped_version = EY::Serverside::VERSION.gsub(/\./, '\.')
218
+ # the [,)] is to stop us from looking for e.g. 0.5.1, seeing
219
+ # 0.5.11, and mistakenly thinking 0.5.1 is there
220
+ has_gem_cmd = "#{gem_binary} list engineyard-serverside | grep \"engineyard-serverside\" | egrep -q '#{egrep_escaped_version}[,)]'"
221
+
222
+ if !server.run(has_gem_cmd) # doesn't have this exact version
223
+ puts "~> Installing engineyard-serverside on #{server.hostname}"
224
+
225
+ system(Escape.shell_command([
226
+ 'scp', '-i', "#{ENV['HOME']}/.ssh/internal",
227
+ "-o", "StrictHostKeyChecking=no",
228
+ local_gem_file,
229
+ "#{config.user}@#{server.hostname}:#{remote_gem_file}",
230
+ ]))
231
+ server.run("sudo #{gem_binary} install --no-rdoc --no-ri '#{remote_gem_file}'")
222
232
  end
223
- installed
224
233
  end
225
234
 
226
235
  EY::Serverside::Future.success?(futures)
@@ -83,37 +83,12 @@ module EY
83
83
  if local?
84
84
  logged_system(command)
85
85
  else
86
- logged_system(ssh_command + Escape.shell_command(["#{user}@#{hostname}", command]))
86
+ logged_system(ssh_command + " " + Escape.shell_command(["#{user}@#{hostname}", command]))
87
87
  end
88
88
  end
89
89
 
90
- def copy(local_file, remote_file)
91
- logged_system(scp_command + Escape.shell_command([local_file, "#{user}@#{hostname}:#{remote_file}"]))
92
- end
93
-
94
90
  def ssh_command
95
- "ssh #{ssh_options} "
96
- end
97
-
98
- def scp_command
99
- "scp #{ssh_options} "
100
- end
101
-
102
- def ssh_options
103
- "-i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
104
- end
105
-
106
- def gem?(name, version)
107
- run("#{gem_command} list -i #{name} -v '#{version}'")
108
- end
109
-
110
- def install_gem(path)
111
- # resin + ruby 1.8.6 need sudo privileges to install gems
112
- run("sudo #{gem_command} install -q --no-ri --no-rdoc #{path}")
113
- end
114
-
115
- def gem_command
116
- File.join(Gem.default_bindir, 'gem')
91
+ "ssh -i #{ENV['HOME']}/.ssh/internal -o StrictHostKeyChecking=no -o PasswordAuthentication=no"
117
92
  end
118
93
 
119
94
  end
@@ -1,5 +1,5 @@
1
1
  module EY
2
2
  module Serverside
3
- VERSION = '1.5.27.pre2'
3
+ VERSION = '1.5.27.pre3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: engineyard-serverside
3
3
  version: !ruby/object:Gem::Version
4
- hash: 2339881699
4
+ hash: 2511085049
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 1
8
8
  - 5
9
9
  - 27
10
10
  - pre
11
- - 2
12
- version: 1.5.27.pre2
11
+ - 3
12
+ version: 1.5.27.pre3
13
13
  platform: ruby
14
14
  authors:
15
15
  - EY Cloud Team