sfpagent 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sfpagent might be problematic. Click here for more details.
- data/README.md +37 -22
- data/VERSION +1 -1
- data/lib/sfpagent/module.rb +2 -1
- metadata +6 -6
data/README.md
CHANGED
@@ -15,19 +15,19 @@ Every software component could have a set of methods which could be called throu
|
|
15
15
|
|
16
16
|
Requirements
|
17
17
|
------------
|
18
|
-
- Ruby (>= 1.
|
18
|
+
- Ruby (>= 1.9.2)
|
19
19
|
- Ruby Gems
|
20
20
|
- sfp
|
21
21
|
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
- Ruby 1.
|
23
|
+
Tested On
|
24
|
+
---------
|
25
|
+
- Ruby: 1.9.2, 1.9.3, 2.0.0, JRuby-19mode
|
26
|
+
- OS: Ubuntu, Debian, MacOS X
|
26
27
|
|
27
|
-
$ apt-get install ruby ruby-dev libz-dev libaugeas-ruby
|
28
|
-
$ gem install json
|
29
|
-
$ gem install sfpagent
|
30
28
|
|
29
|
+
To install
|
30
|
+
----------
|
31
31
|
- Ruby 1.9.x
|
32
32
|
|
33
33
|
$ apt-get install ruby1.9.1 ruby1.9.1-dev libz-dev libaugeas-ruby1.9.1
|
@@ -47,32 +47,47 @@ As daemon
|
|
47
47
|
$ sfpagent -t
|
48
48
|
|
49
49
|
|
50
|
-
|
50
|
+
Home Directory
|
51
51
|
----------------
|
52
|
-
|
52
|
+
Home directory keeps all agent's local data such as:
|
53
53
|
- log file
|
54
54
|
- PID file
|
55
55
|
- model file
|
56
56
|
- installed modules
|
57
57
|
|
58
|
-
In default, the agent will use (and created if not exist) the following directory as
|
59
|
-
- **~/.sfpagent**, when the daemon is running with non-root user
|
60
|
-
- **/var/sfpagent**, when the daemon is running with root user
|
58
|
+
In default, the agent will use (and created if not exist) the following directory as _home directory_:
|
59
|
+
- **~/.sfpagent**, when the daemon is running with non-root user
|
60
|
+
- **/var/sfpagent**, when the daemon is running with root user
|
61
61
|
|
62
62
|
|
63
63
|
HTTP RESTful API
|
64
64
|
----------------
|
65
65
|
- GET
|
66
|
-
- /
|
67
|
-
- /
|
68
|
-
- /
|
69
|
-
- /
|
66
|
+
- /pid : save daemon's PID to a file (only requested from localhost)
|
67
|
+
- /state : return the current state
|
68
|
+
- /model : return the current model
|
69
|
+
- /sfp : return the SFP description of a module
|
70
|
+
- /modules : return a list of available modules
|
71
|
+
- /agents : return a list of agents database
|
72
|
+
- /log : return last 100 lines of log file
|
70
73
|
|
71
|
-
- POST
|
72
|
-
- /execute :
|
74
|
+
- POST
|
75
|
+
- /execute : receive an action's schema and execute it
|
73
76
|
|
74
77
|
- PUT
|
75
|
-
- /model
|
76
|
-
- /
|
77
|
-
|
78
|
-
|
78
|
+
- /model : receive a new model and then save it
|
79
|
+
- /model/cache : receive a "cache" model and then save it
|
80
|
+
- /modules : save the module if parameter "module" is provided
|
81
|
+
- /agents : save the agents' list if parameter "agents" is provided
|
82
|
+
- /bsig : receive BSig model and receive it in cached directory
|
83
|
+
- /bsig/satisfier : receive goal request from other agents and then start a satisfier thread in order to achieve it
|
84
|
+
|
85
|
+
- DELETE
|
86
|
+
- /model : delete existing model
|
87
|
+
- /model/cache : delete all cache models
|
88
|
+
- /model/cache/name : delete cache model of agent "name"
|
89
|
+
- /modules : delete all modules from module database
|
90
|
+
- /modules/name : delete module "name" from module database
|
91
|
+
- /agents : delete all agents from agent database
|
92
|
+
- /agents/name : delete "name" from agent database
|
93
|
+
- /bsig : delete existing BSig model
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/lib/sfpagent/module.rb
CHANGED
@@ -132,7 +132,7 @@ module Sfp::Resource
|
|
132
132
|
def use_http_proxy?(uri)
|
133
133
|
ENV['no_proxy'].to_s.split(',').each { |pattern|
|
134
134
|
pattern.chop! if pattern[-1] == '*'
|
135
|
-
return false if uri.
|
135
|
+
return false if uri.host[0, pattern.length] == pattern
|
136
136
|
}
|
137
137
|
true
|
138
138
|
end
|
@@ -203,6 +203,7 @@ class Sfp::Module::Shell
|
|
203
203
|
log.info Shellwords.shellescape(JSON.generate(parameters))
|
204
204
|
begin
|
205
205
|
output = `#{@main} #{Shellwords.shellescape(JSON.generate(parameters))}`
|
206
|
+
log.info output
|
206
207
|
JSON.parse(output)
|
207
208
|
rescue Exception => exp
|
208
209
|
log.info "Invalid module output: #{output}"
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-11-
|
12
|
+
date: 2013-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sfp
|
16
|
-
requirement: &
|
16
|
+
requirement: &20865400 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.3.17
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *20865400
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &20864580 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *20864580
|
36
36
|
description: A Ruby implementation of SFP agent.
|
37
37
|
email: herry13@gmail.com
|
38
38
|
executables:
|