marionette 0.0.5 → 0.0.6

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.
@@ -15,7 +15,7 @@ module HeadStartApp
15
15
  def initialize(options = nil)
16
16
 
17
17
  # Set default(s)
18
- options = { :uri => "tcp://127.0.0.1:5555" } if options.nil?
18
+ options = { :uri => `cat /etc/marionette.tcp` } if options.nil?
19
19
 
20
20
  # Set URI
21
21
  @uri = URI(options[:uri])
@@ -27,7 +27,20 @@ module HeadStartApp
27
27
  # Processes and returns response
28
28
  def receive
29
29
 
30
- # Stand by for a response
30
+ # Poll server until it is receive-able
31
+ poller = ZMQ::Poller.new
32
+ poller.register_readable @socket
33
+
34
+ while true do
35
+
36
+ poll_reply = poller.poll 500
37
+ key = poll_reply.keys.first # fetch the first and only hash key
38
+
39
+ break if poll_reply[key][:revents] == 1 # fetch revents
40
+
41
+ end
42
+
43
+ # Receive message
31
44
  begin
32
45
 
33
46
  response = socket.recv_string
@@ -19,14 +19,10 @@ module HeadStartApp
19
19
  # Starts send and response thread
20
20
  def start
21
21
 
22
- # Kill existing and create new pull-loop thread
23
- # @thread.kill unless @thread.nil?
24
- # Thread.abort_on_exception = true
25
- # @thread = Thread.new do
26
- while true do
27
- pull
28
- end
29
- # end
22
+ # Continually pull down requests
23
+ while true do
24
+ pull
25
+ end
30
26
 
31
27
  end
32
28
 
@@ -98,25 +94,14 @@ module HeadStartApp
98
94
  # Fetches facts collection
99
95
  def facter_run
100
96
 
101
- Facter.loadfacts
102
- @message = Facter.collection.to_hash
103
-
97
+ # Load facts from cli to reduce ruby memory footprint
98
+ facts = `facter`
99
+ facts = facts.split "\n"
100
+ facts.collect! {|f| ff=f.split("=>"); {ff[0].strip.to_sym => ff[1]}}.compact
101
+ @message = facts
102
+
104
103
  end
105
104
 
106
- # Some stats
107
- # - to be set up as a fact(s) later
108
- def stats
109
-
110
- stats = {}
111
- stats[:disk] = `df -h -P` rescue nil
112
- stats[:network] = `vnstat` rescue nil
113
- stats[:memory] = `vmstat -a` rescue nil
114
- stats[:process] = `monit status` rescue nil
115
- stats[:cpu] = `mpstat -P ALL | awk 'NR>2' | cut -c14-` rescue nil
116
- stats
117
-
118
- end
119
-
120
105
  end
121
106
 
122
107
  end
@@ -6,7 +6,7 @@ module HeadStartApp
6
6
 
7
7
  # Set default(s)
8
8
  ip = `sudo /sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
9
- options = { :uri => "tcp://#{ip}:5555" } if options.nil?
9
+ options = { :uri => "tcp://#{ip.strip}:5555" } if options.nil?
10
10
 
11
11
  # Set up marionette as a service to start at boot.
12
12
  # define task:
@@ -1,5 +1,5 @@
1
1
  module HeadStartApp
2
2
  module Marionette
3
- VERSION = "0.0.5"
3
+ VERSION = "0.0.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marionette
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 5
10
- version: 0.0.5
9
+ - 6
10
+ version: 0.0.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Dan Lee
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-10 00:00:00 -08:00
18
+ date: 2011-01-11 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency