smith 0.8.6 → 0.8.7
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.
- checksums.yaml +4 -4
- data/bin/smithctl +1 -1
- data/config/smithrc.toml +7 -0
- data/lib/smith.rb +4 -0
- data/lib/smith/agent_process.rb +4 -2
- data/lib/smith/bootstrap.rb +14 -12
- data/lib/smith/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ece67408d7e69a0d140c6c71a829995ca2b3aa37
|
4
|
+
data.tar.gz: f8021c6a1f14de124f37dd5e7615cda0ea355815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c001cd85c559a060809a20db61b62a50d3eeb87829e0f9c9efb1f601f21b1155bf79076964f163aa2f32c07d69628ff3e3ac13e8dbee6e856b5743221872aa6b
|
7
|
+
data.tar.gz: 527a5f514f80b67fddfd2ad9fdf1cd19f5529339e40c0c20b8588f93d8cbe90f170864d3857cb1077ffd244221ce4096662f787697c77cd3bf5e85624931aa31
|
data/bin/smithctl
CHANGED
@@ -106,7 +106,7 @@ Usage:
|
|
106
106
|
# Setup signal handlers to clean up.
|
107
107
|
|
108
108
|
%w{TERM INT QUIT}.each do |sig|
|
109
|
-
signal_handler.install_signal_handler(sig) {
|
109
|
+
signal_handler.install_signal_handler(sig) { Smith.stop(true) }
|
110
110
|
end
|
111
111
|
|
112
112
|
control.send_command(command, args) do |result|
|
data/config/smithrc.toml
CHANGED
@@ -21,6 +21,13 @@ kqueue = true
|
|
21
21
|
pid_directory = "~/.smith/run"
|
22
22
|
cache_directory = "~/.smith/cache"
|
23
23
|
|
24
|
+
# These directories get added to the Ruby $LOAD_PATH for agents to require code.
|
25
|
+
lib_directories = ["lib"]
|
26
|
+
# Shared codebase with a basic web app:
|
27
|
+
# lib_directories = ["lib", "app"]
|
28
|
+
# Shared codebase with a Rails app:
|
29
|
+
# lib_directories = ["lib", "app/models", "vendor"]
|
30
|
+
|
24
31
|
# This is the directory that will contain the agent groups
|
25
32
|
group_directory = "groups"
|
26
33
|
|
data/lib/smith.rb
CHANGED
data/lib/smith/agent_process.rb
CHANGED
@@ -170,7 +170,7 @@ module Smith
|
|
170
170
|
# Start an agent. This forks and execs the bootstrapper class
|
171
171
|
# which then becomes responsible for managing the agent process.
|
172
172
|
def self.start_process(agent_process)
|
173
|
-
fork do
|
173
|
+
pid = fork do
|
174
174
|
# Detach from the controlling terminal
|
175
175
|
unless Process.setsid
|
176
176
|
raise 'Cannot detach from controlling terminal'
|
@@ -195,8 +195,10 @@ module Smith
|
|
195
195
|
exec(binary, bootstrapper.to_s, agent_process.name, agent_process.uuid)
|
196
196
|
end
|
197
197
|
|
198
|
+
logger.info { "Detaching: #{agent_process.name}, UUID: #{agent_process.uuid}, PID: #{pid}" }
|
199
|
+
|
198
200
|
# We don't want any zombies.
|
199
|
-
Process.detach(
|
201
|
+
Process.detach(pid)
|
200
202
|
end
|
201
203
|
|
202
204
|
# FIXME: This doesn't appear to be being called.
|
data/lib/smith/bootstrap.rb
CHANGED
@@ -132,24 +132,26 @@ module Smith
|
|
132
132
|
logger.error { "Terminating: #{@agent_name}, UUID: #{@agent_uuid}, PID: #{@pid.pid}." }
|
133
133
|
end
|
134
134
|
|
135
|
-
# Add
|
136
|
-
#
|
135
|
+
# Add directories with library code to the load path. This assumes that
|
136
|
+
# the required files reside at the same level as the agent directory.
|
137
|
+
#
|
138
|
+
# Always defaults to `lib` if a `lib_directories` list is not provided
|
139
|
+
# by the configuration.
|
137
140
|
#
|
138
141
|
# $ROOT_PATH/agents
|
139
142
|
# .../lib
|
140
143
|
#
|
141
|
-
#
|
142
|
-
#
|
143
|
-
# This needs to be better thought out.
|
144
|
-
# TODO think this through some more.
|
144
|
+
# Where $ROOT_PATH is dependent on the agent directory.
|
145
145
|
def add_agent_load_path(path)
|
146
146
|
Smith.agent_directories.each do |path|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
147
|
+
Smith.lib_directories.each do |lib_dir|
|
148
|
+
lib_path = path.parent.join(lib_dir)
|
149
|
+
if lib_path.exist?
|
150
|
+
logger.info { "Adding #{lib_path} to load path." }
|
151
|
+
$LOAD_PATH << lib_path
|
152
|
+
else
|
153
|
+
logger.info { "#{lib_dir} directory not found in: #{path.parent}." }
|
154
|
+
end
|
153
155
|
end
|
154
156
|
end
|
155
157
|
end
|
data/lib/smith/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Heycock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amqp
|
@@ -104,6 +104,9 @@ dependencies:
|
|
104
104
|
name: protobuf
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.0'
|
107
110
|
- - "~>"
|
108
111
|
- !ruby/object:Gem::Version
|
109
112
|
version: '3.4'
|
@@ -111,6 +114,9 @@ dependencies:
|
|
111
114
|
prerelease: false
|
112
115
|
version_requirements: !ruby/object:Gem::Requirement
|
113
116
|
requirements:
|
117
|
+
- - "~>"
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '3.0'
|
114
120
|
- - "~>"
|
115
121
|
- !ruby/object:Gem::Version
|
116
122
|
version: '3.4'
|