escualo 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1920e5a93953d72791592fcdddc60524c037384d
4
- data.tar.gz: 61741d127b8bcbf8c0af9885c255ba1629fca4da
3
+ metadata.gz: 432ee25813d9e628b9ee1dcd7854f6c5f4ad26fd
4
+ data.tar.gz: fa4492ebbe50f6e552d8b6a3750c46248da78bf0
5
5
  SHA512:
6
- metadata.gz: ef23cd97b873bb69fcb09d32ed0ae2b6f1775df637eb3171e84c5f2e21b12ec58b71d8375f79b0a4fba40400f2f04c0e095116a107cd15bdf5c050e10465ebbd
7
- data.tar.gz: 798e17ff92292ff69b5307a15c523a8bf9dbd04f464748ca17bc574453db1880d6e532038e2304c4f4499137b427b57d6ebe24a1484759d2df45a200ccb8b89c
6
+ metadata.gz: 1a0a3c01d37d9eaf25cf86a3379985994e4f976cf419c8ad7152d74e40a64980e6b5415e84cdc1435e5d0ca6dd100903db162b27dcc49acfc149d9733587da83
7
+ data.tar.gz: 51c6aaa54956684835e5b982ce40522c2635b1b9a501a054120626882b16148ef2cfb5c0966f481285d4d48d30d822b0f7b20060f0e627698b7dec1cbba81c8e
@@ -1,7 +1,7 @@
1
- def run_commands_for!(script, extra='', ssh)
1
+ def run_commands_for!(script, extra='', ssh, options)
2
2
  script.map { |it| "escualo #{it} #{extra}" }.each do |command|
3
3
  puts "Running `#{command}`"
4
- puts ssh.shell.exec! command
4
+ ssh.shell.perform! command, options
5
5
  end
6
6
  end
7
7
 
@@ -19,15 +19,20 @@ command 'script' do |c|
19
19
  c.description = 'Runs a escualo configuration'
20
20
  c.action do |args, options|
21
21
  file = YAML.load_file args.first
22
+ local_ssh = Net::SSH::Connection::LocalSession.new
22
23
 
23
24
  step 'Running local commands...' do
24
- run_commands_for! file['local'], ssh_options, Net::SSH::Connection::LocalSession.new
25
+ run_commands_for! file['local'], ssh_options, local_ssh, options
25
26
  end
26
27
 
27
28
  step 'Running remote commands...' do
28
29
  Net::SSH.start($hostname, $username, $ssh_options.compact) do |ssh|
29
- run_commands_for! file['remote'], ssh
30
+ run_commands_for! file['remote'], ssh, options
30
31
  end
31
32
  end
33
+
34
+ step 'Running deploy commands...' do
35
+ run_commands_for! file['deploy'], ssh_options, local_ssh, options
36
+ end
32
37
  end
33
38
  end
@@ -60,12 +60,12 @@ module Escualo
60
60
  end
61
61
 
62
62
  def self.create_codechange_script(ssh, name)
63
- ssh.upload_template! "/var/scripts/#{name}/codechange", "codechange.sh", name: name
63
+ ssh.upload_template! "/var/scripts/#{name}/codechange", 'codechange.sh', name: name
64
64
  ssh.exec! "chmod +x /var/scripts/#{name}/codechange"
65
65
  end
66
66
 
67
67
  def self.configure_upstart(ssh, options)
68
- ssh.upload_template! "/etc/init/#{name}.conf", 'upstart.conf', options
68
+ ssh.upload_template! "/etc/init/#{options[:name]}.conf", 'upstart.conf', options
69
69
  end
70
70
  end
71
71
  end
@@ -13,6 +13,7 @@ module Escualo
13
13
  libreadline6-dev \
14
14
  curl \
15
15
  git \
16
+ monit \
16
17
  libssl-dev \
17
18
  ruby2.0 \
18
19
  ruby2.0-dev \
@@ -34,18 +35,19 @@ module Escualo
34
35
  end
35
36
 
36
37
  def self.setup_monit(ssh, options)
37
- ssh.exec! %Q{
38
- service monit stop && \
39
- cd /tmp && \
40
- wget https://mmonit.com/monit/dist/binary/5.16/monit-#{options.monit_version}-linux-x64.tar.gz && \
41
- tar -xzf monit-#{options.monit_version}-linux-x64.tar.gz && \
42
- cp monit-#{options.monit_version}/bin/monit /usr/bin/monit && \
43
- ln -s /etc/monit/monitrc /etc/monitrc && \
44
- service monit start && \
45
- 'set httpd port 2812 and' > /etc/monit/conf.d/web-server && \
46
- ' allow 0.0.0.0/0.0.0.0' >> /etc/monit/conf.d/web-server && \
47
- ' allow admin:#{options.monit_password}' >> /etc/monit/conf.d/web-server && \
48
- monit reload}
38
+ ssh.perform! %Q{
39
+ service monit stop
40
+ cd /tmp &&
41
+ wget https://mmonit.com/monit/dist/binary/5.16/monit-#{options.monit_version}-linux-x64.tar.gz &&
42
+ tar -xzf monit-#{options.monit_version}-linux-x64.tar.gz &&
43
+ cp monit-#{options.monit_version}/bin/monit /usr/bin/monit
44
+ ln -s /etc/monit/monitrc /etc/monitrc
45
+ service monit start
46
+ 'set httpd port 2812 and' > /etc/monit/conf.d/web-server
47
+ ' allow 0.0.0.0/0.0.0.0' >> /etc/monit/conf.d/web-server
48
+ ' allow admin:#{options.monit_password}' >> /etc/monit/conf.d/web-server
49
+ monit reload
50
+ }, options
49
51
  end
50
52
 
51
53
  def self.install_gems(ssh, options)
@@ -2,7 +2,7 @@ module Escualo
2
2
  module Remote
3
3
  def self.attach(dir, name)
4
4
  remote_name = "escualo-#{name}-#{$hostname}"
5
- remote_url = "ssh://#{$username}@#{$hostname}:#{$ssh_options[:port]}/var/repo/#{name}.git"
5
+ remote_url = "ssh://#{$username}@#{$hostname}:#{$ssh_port}/var/repo/#{name}.git"
6
6
  %x{cd #{dir} && git remote add #{remote_name} #{remote_url}}
7
7
  end
8
8
 
@@ -1,4 +1,4 @@
1
1
  module Escualo
2
- VERSION = '0.2.5'
2
+ VERSION = '0.2.6'
3
3
  BASE_VERSION = '3.1'
4
4
  end
data/lib/ssh/session.rb CHANGED
@@ -11,10 +11,10 @@ class Net::SSH::Connection::Session
11
11
  ch.exec command do |ch, success|
12
12
  raise 'could not execute command' unless success
13
13
  ch.on_data do |c, data|
14
- $stdout.print data
14
+ $stdout.print data unless garbage? data
15
15
  end
16
16
  ch.on_extended_data do |c, type, data|
17
- $stderr.print data
17
+ $stderr.print data unless garbage? data
18
18
  end
19
19
  end
20
20
  end
@@ -25,6 +25,12 @@ class Net::SSH::Connection::Session
25
25
  Shell.new self
26
26
  end
27
27
 
28
+ private
29
+
30
+ def garbage?(data)
31
+ data.start_with?('bash: cannot set terminal process group') || data.start_with?('bash: no job control in this shell')
32
+ end
33
+
28
34
  class Shell
29
35
  attr_reader :ssh
30
36
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escualo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Franco Leonardo Bulgarelli