sfpagent 0.2.3 → 0.2.4
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.
Potentially problematic release.
This version of sfpagent might be problematic. Click here for more details.
- data/VERSION +1 -1
- data/bin/install_module +8 -6
- data/lib/sfpagent/agent.rb +4 -1
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
data/bin/install_module
CHANGED
@@ -24,6 +24,10 @@ fi
|
|
24
24
|
# set a template command for sending the modules
|
25
25
|
cmd="curl -s -i -X PUT $address:$port/modules"
|
26
26
|
|
27
|
+
# setup directory for temporary files
|
28
|
+
dir="/tmp/"$(date +%s%N)"$RANDOM"
|
29
|
+
mkdir -p $dir
|
30
|
+
|
27
31
|
# for every module in the arguments:
|
28
32
|
# - archive the module's files to a temporary file
|
29
33
|
# - update the sending command by adding the module
|
@@ -32,8 +36,8 @@ cmd="curl -s -i -X PUT $address:$port/modules"
|
|
32
36
|
missing_module=0
|
33
37
|
for module in "$@" ; do
|
34
38
|
if [[ -d "$module" ]]; then
|
35
|
-
tar cvzhf
|
36
|
-
cmd="$cmd -F $module
|
39
|
+
tar cvzhf $dir/$module.tgz $module 1>/dev/null
|
40
|
+
cmd="$cmd -F $module=@$dir/$module.tgz"
|
37
41
|
else
|
38
42
|
echo "Module $module is not exist!"
|
39
43
|
missing_module=`expr $missing_module + 1`
|
@@ -49,10 +53,8 @@ if [[ $missing_module == 0 ]]; then
|
|
49
53
|
fi
|
50
54
|
fi
|
51
55
|
|
52
|
-
# delete temporary
|
53
|
-
|
54
|
-
rm -f /tmp/$module.tgz
|
55
|
-
done
|
56
|
+
# delete directory that holds temporary files
|
57
|
+
rm -rf $dir
|
56
58
|
|
57
59
|
if [[ $missing_module == 0 ]]; then
|
58
60
|
echo "status: ok"
|
data/lib/sfpagent/agent.rb
CHANGED
@@ -560,6 +560,7 @@ module Sfp
|
|
560
560
|
}
|
561
561
|
|
562
562
|
if updated
|
563
|
+
@@agents_database = agents
|
563
564
|
Thread.new {
|
564
565
|
# if updated then broadcast to other agents
|
565
566
|
http_data = {'agents' => JSON.generate(data)}
|
@@ -579,7 +580,9 @@ module Sfp
|
|
579
580
|
|
580
581
|
def self.get_agents
|
581
582
|
return {} if not File.exist?(AgentsDataFile)
|
582
|
-
|
583
|
+
modified_time = File.mtime(AgentsDataFile)
|
584
|
+
return @@agents_database if modified_time == @@agents_database_modified_time and
|
585
|
+
(Time.new - modified_time) < 60
|
583
586
|
@@agents_database_modified_time = File.mtime(AgentsDataFile)
|
584
587
|
@@agents_database = JSON[File.read(AgentsDataFile)]
|
585
588
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sfpagent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2013-08-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sfp
|
16
|
-
requirement: &
|
16
|
+
requirement: &7796160 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.3.12
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *7796160
|
25
25
|
description: A Ruby implementation of SFP agent.
|
26
26
|
email: herry13@gmail.com
|
27
27
|
executables:
|