sfpagent 0.3.0 → 0.3.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/VERSION +1 -1
- data/lib/sfpagent/bsig.rb +1 -1
- data/lib/sfpagent/helper.rb +24 -0
- data/lib/sfpagent/module.rb +2 -13
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/lib/sfpagent/bsig.rb
CHANGED
@@ -133,7 +133,7 @@ class Sfp::BSig
|
|
133
133
|
def achieve_local_goal(id, goal, operators, pi, mode)
|
134
134
|
current = get_current_state
|
135
135
|
flaws = compute_flaws(goal, current)
|
136
|
-
Sfp::Agent.logger.info "[#{mode}] flaws: #{flaws.inspect}"
|
136
|
+
#Sfp::Agent.logger.info "[#{mode}] flaws: #{flaws.inspect}"
|
137
137
|
|
138
138
|
return :no_flaw if flaws.length <= 0
|
139
139
|
|
data/lib/sfpagent/helper.rb
CHANGED
@@ -1,4 +1,28 @@
|
|
1
|
+
module Sfp
|
2
|
+
def self.to_ruby(object)
|
3
|
+
object = Sfp::Helper.deep_clone(object)
|
4
|
+
object.accept(Sfp::Helper::Sfp2Ruby)
|
5
|
+
object
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
1
9
|
module Sfp::Helper
|
10
|
+
Sfp2Ruby = Object.new
|
11
|
+
def Sfp2Ruby.visit(name, value, parent)
|
12
|
+
if name[0] == '_'
|
13
|
+
parent.delete(name)
|
14
|
+
elsif value.is_a?(Hash)
|
15
|
+
case value['_context']
|
16
|
+
when 'null'
|
17
|
+
parent[name] = nil
|
18
|
+
when 'any_value', 'constraint', 'procedure'
|
19
|
+
parent.delete(name)
|
20
|
+
when 'set'
|
21
|
+
parent[name] = value['_values']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
true
|
25
|
+
end
|
2
26
|
end
|
3
27
|
|
4
28
|
module Sfp::Helper::Net
|
data/lib/sfpagent/module.rb
CHANGED
@@ -24,7 +24,7 @@ module Sfp::Resource
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def update_model(model)
|
27
|
-
|
27
|
+
@model = Sfp.to_ruby(model)
|
28
28
|
end
|
29
29
|
|
30
30
|
def to_model
|
@@ -47,23 +47,12 @@ module Sfp::Resource
|
|
47
47
|
protected
|
48
48
|
def exec_seq(*commands)
|
49
49
|
commands = [commands.to_s] if not commands.is_a?(Array)
|
50
|
-
commands.each { |c| raise Exception, "
|
50
|
+
commands.each { |c| raise Exception, "Error on executing '#{c}'" if !system(c) }
|
51
51
|
end
|
52
52
|
|
53
53
|
def log
|
54
54
|
Sfp::Agent.logger
|
55
55
|
end
|
56
|
-
|
57
|
-
# copy source file to destination
|
58
|
-
# if source is an HTTP/HTTPS/FTP url, then use 'wget' to download the file
|
59
|
-
#
|
60
|
-
def copy(source, destination)
|
61
|
-
if source =~ /^(http|https|ftp):\/\/.+/
|
62
|
-
system "wget -O #{destination} #{source}"
|
63
|
-
else
|
64
|
-
system "cp #{source} #{destination}"
|
65
|
-
end
|
66
|
-
end
|
67
56
|
end
|
68
57
|
|
69
58
|
module Sfp::Module
|
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.3.
|
4
|
+
version: 0.3.1
|
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: &10379460 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: 0.3.16
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *10379460
|
25
25
|
description: A Ruby implementation of SFP agent.
|
26
26
|
email: herry13@gmail.com
|
27
27
|
executables:
|