amiral 0.1.10 → 0.1.11

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.
@@ -5,6 +5,7 @@ require 'amiral/providers/apt-update'
5
5
  require 'amiral/providers/ping'
6
6
  require 'amiral/providers/facts'
7
7
  require 'amiral/providers/provider-list'
8
+ require 'amiral/providers/last-line'
8
9
  require 'amiral/providers/invalid'
9
10
 
10
11
 
@@ -17,6 +18,7 @@ module Amiral
17
18
  "puppet-agent" => Amiral::Providers::PuppetAgent,
18
19
  "apt-update" => Amiral::Providers::AptGetUpdate,
19
20
  "service" => Amiral::Providers::Service,
21
+ "last-line" => Amiral::Providers::LastLine,
20
22
  "invalid" => Amiral::Providers::Invalid
21
23
  }
22
24
  end
@@ -0,0 +1,25 @@
1
+ require 'popen4'
2
+
3
+ module Amiral
4
+ module Providers
5
+ class LastLine
6
+
7
+ def execute message
8
+
9
+ cmd = message['command']['args'].join " "
10
+
11
+ out = err = nil
12
+ status = POpen4::popen4(cmd){|stdout, stderr, stdin, pid|
13
+ out = stdout.read
14
+ err = stderr.read
15
+ }
16
+ {
17
+ :exit => 0,
18
+ :short => "status: #{status.exitstatus}, out: #{err.split(/\n/).last}",
19
+ :out => out,
20
+ :err => err
21
+ }
22
+ end # def execute
23
+ end # class
24
+ end # module
25
+ end
@@ -1,3 +1,3 @@
1
1
  module Amiral
2
- VERSION = '0.1.10'
2
+ VERSION = '0.1.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amiral
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
12
+ date: 2012-11-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
@@ -131,6 +131,7 @@ files:
131
131
  - lib/amiral/providers/apt-update.rb
132
132
  - lib/amiral/providers/facts.rb
133
133
  - lib/amiral/providers/invalid.rb
134
+ - lib/amiral/providers/last-line.rb
134
135
  - lib/amiral/providers/ping.rb
135
136
  - lib/amiral/providers/provider-list.rb
136
137
  - lib/amiral/providers/puppet-agent.rb