coreos-deploy 0.2.0 → 0.3.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/coreos +30 -2
  3. data/lib/coreos/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e1e85fd5cbbf3539fe6957601df0a8d5f83b631d
4
- data.tar.gz: b69af451d262540f7a6b4f7e5e85159fbf268fcb
3
+ metadata.gz: 8b739662457f02ac1317563581493056e3295865
4
+ data.tar.gz: bb764556d9e354a97117bc6331ce3d3178e752bb
5
5
  SHA512:
6
- metadata.gz: 1b5ca9acb22f7125b6ce8fc4f6856eada2bac581c80a20b14e17a009a8cc93fc865403c5e8bb90e5e208ad6d49772a84cba7ef3b52183d2bdf9efa0b8a4df36e
7
- data.tar.gz: 9fc521f7487a6284a6a50acef519072c28857b82124024eec657fe83aa88470d30052019cae394a73a3bb423a90aa319442ca3eadd057c2f3e215869abdd3d13
6
+ metadata.gz: b53a14db773377d7a37bae9cbed7ae821b6f8f303dac57ae24d1af6fe5621a60f4a1a2ded8bd6f33fd6209357b58d01091513f9cd8cba43a2cf1dec02e5523b9
7
+ data.tar.gz: df6d8bf178191600634648276b3e695494757f19e911474d82c2621b7a467323f73ef28df3134c01aba2afb9dc86aeb501c32941442b97966fafdb5b58961382
data/bin/coreos CHANGED
@@ -10,7 +10,7 @@ def loop_ssh_command(ssh, command)
10
10
  end
11
11
 
12
12
  class CoreOS < Thor
13
- desc "deploy HOST", "deploys all services in ./coreos/HOST/*.service to HOST"
13
+ desc "deploy HOST", "deploys all services in ./coreos/$HOST/*.service to HOST"
14
14
  option :services, :type => :array
15
15
 
16
16
  def deploy(host)
@@ -57,7 +57,7 @@ class CoreOS < Thor
57
57
  puts "==> Copying service files to #{host}"
58
58
  system "scp #{base_directory}/*.service #{host}:"
59
59
 
60
- Net::SSH.start("#{host}", ENV['USER'] ) do |ssh|
60
+ Net::SSH.start(host, ENV['USER']) do |ssh|
61
61
  if login
62
62
  loop_ssh_command ssh, "docker login #{login}"
63
63
  end
@@ -99,6 +99,34 @@ class CoreOS < Thor
99
99
  end
100
100
  end
101
101
  end
102
+
103
+ desc "logs HOSTS", "attaches to journalctl logs for services in HOSTS"
104
+ def logs(*hosts)
105
+ abort "./coreos does not exist" unless File.exists? "./coreos"
106
+ directories = Dir.entries("./coreos").select { |s| s.start_with? *hosts }
107
+ hosts = directories.map { |d| File.basename d }
108
+
109
+ connections = []
110
+
111
+ for host in hosts
112
+ base_directory = "./coreos/#{host}"
113
+ abort "Directory '#{base_directory}' does not exist" unless File.exists? base_directory
114
+
115
+ service_files = Dir.entries(base_directory).select { |s| s.end_with? ".service" }
116
+ services = service_files.map { |s| File.basename s }
117
+
118
+ puts "#{host} ==> #{services}"
119
+ connections << Net::SSH.start(host, ENV['USER'])
120
+ connections.last.exec "sudo journalctl -f -u #{services.join " -u "}"
121
+ end
122
+
123
+ condition = Proc.new { |s| s.busy? }
124
+
125
+ loop do
126
+ connections.delete_if { |ssh| !ssh.process(0.1, &condition) }
127
+ break if connections.empty?
128
+ end
129
+ end
102
130
  end
103
131
 
104
132
  CoreOS.start(ARGV)
@@ -1,3 +1,3 @@
1
1
  module Coreos
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coreos-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Letterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2014-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler