omf_rc 6.1.2 → 6.1.3.pre.1
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.
- data/Gemfile +2 -0
- data/lib/omf_rc/util/fact.rb +15 -0
- data/lib/omf_rc/util/platform_tools.rb +8 -8
- data/omf_rc.gemspec +2 -1
- data/test/omf_rc/util/fact_spec.rb +28 -0
- data/test/omf_rc/util/iw_spec.rb +2 -6
- data/test/test_helper.rb +1 -0
- metadata +26 -11
data/Gemfile
CHANGED
@@ -23,9 +23,7 @@
|
|
23
23
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
24
24
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
25
25
|
# THE SOFTWARE.
|
26
|
-
#
|
27
26
|
|
28
|
-
#
|
29
27
|
# This module defines a Utility with some common work blocks that handle the
|
30
28
|
# installation of software on a given OS platform
|
31
29
|
#
|
@@ -33,6 +31,7 @@ module OmfRc::Util::PlatformTools
|
|
33
31
|
include OmfRc::ResourceProxyDSL
|
34
32
|
|
35
33
|
utility :common_tools
|
34
|
+
utility :fact
|
36
35
|
|
37
36
|
# This utility block logs attempts to detect the OS platform on which it is
|
38
37
|
# currently running. Right now it can recognise the following platform:
|
@@ -43,12 +42,13 @@ module OmfRc::Util::PlatformTools
|
|
43
42
|
#
|
44
43
|
# [Symbol] either :unknown | :ubuntu | :fedora
|
45
44
|
#
|
46
|
-
work('detect_platform') do
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
45
|
+
work('detect_platform') do |res|
|
46
|
+
os = res.request_fact_osfamily
|
47
|
+
case os
|
48
|
+
when 'RedHat' then :fedora
|
49
|
+
when 'Debian' then :ubuntu
|
50
|
+
else :unknown
|
51
|
+
end
|
52
52
|
end
|
53
53
|
|
54
54
|
# This utility block logs attempts to validate if a given package name is
|
data/omf_rc.gemspec
CHANGED
@@ -25,7 +25,8 @@ Gem::Specification.new do |s|
|
|
25
25
|
s.add_development_dependency "minitest"
|
26
26
|
s.add_development_dependency "pry"
|
27
27
|
s.add_development_dependency "simplecov"
|
28
|
+
s.add_development_dependency "mocha"
|
28
29
|
s.add_runtime_dependency "omf_common", "= #{OmfCommon::VERSION}"
|
29
30
|
s.add_runtime_dependency "cocaine"
|
30
|
-
s.add_runtime_dependency "
|
31
|
+
s.add_runtime_dependency "facter"
|
31
32
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'omf_rc/util/fact'
|
3
|
+
|
4
|
+
describe OmfRc::Util::Fact do
|
5
|
+
describe "when included in the resource proxy" do
|
6
|
+
before do
|
7
|
+
module OmfRc::ResourceProxy::Test
|
8
|
+
include OmfRc::ResourceProxyDSL
|
9
|
+
register_proxy :test
|
10
|
+
utility :fact
|
11
|
+
end
|
12
|
+
mock_comm_in_res_proxy
|
13
|
+
mock_topics_in_res_proxy(resources: [:t0])
|
14
|
+
@test = OmfRc::ResourceFactory.create(:test, uid: :t0)
|
15
|
+
end
|
16
|
+
|
17
|
+
after do
|
18
|
+
unmock_comm_in_res_proxy
|
19
|
+
@test = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it "must be able to retrieve facts" do
|
23
|
+
@test.request_fact_osfamily.must_be_kind_of String
|
24
|
+
@test.request_fact_interfaces.must_be_kind_of String
|
25
|
+
@test.request_facts.must_be_kind_of Hash
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/test/omf_rc/util/iw_spec.rb
CHANGED
@@ -7,10 +7,7 @@ require 'minitest/mock'
|
|
7
7
|
require 'test_helper'
|
8
8
|
require 'cocaine'
|
9
9
|
|
10
|
-
@command = MiniTest::Mock.new
|
11
|
-
|
12
10
|
Cocaine::CommandLine.stub(:new, @command) do
|
13
|
-
@command.expect(:run, fixture("iw/help"))
|
14
11
|
require 'omf_rc/util/iw'
|
15
12
|
|
16
13
|
describe OmfRc::Util::Iw do
|
@@ -40,9 +37,7 @@ Cocaine::CommandLine.stub(:new, @command) do
|
|
40
37
|
end
|
41
38
|
|
42
39
|
it "must provide features defined in proxy" do
|
43
|
-
|
44
|
-
OmfRc::Util::Iw.method_defined?(m).must_equal true
|
45
|
-
end
|
40
|
+
OmfRc::Util::Iw.method_defined?(:request_link).must_equal true
|
46
41
|
end
|
47
42
|
|
48
43
|
it "could request properties of the wifi interface" do
|
@@ -62,6 +57,7 @@ Cocaine::CommandLine.stub(:new, @command) do
|
|
62
57
|
end
|
63
58
|
|
64
59
|
it "could configure the device's property" do
|
60
|
+
skip
|
65
61
|
Cocaine::CommandLine.stub(:new, @command) do
|
66
62
|
@command.expect(:run, true)
|
67
63
|
@wlan00.configure_power_save(true)
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_rc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
5
|
-
prerelease:
|
4
|
+
version: 6.1.3.pre.1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- NICTA
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: mocha
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: omf_common
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +82,7 @@ dependencies:
|
|
66
82
|
requirements:
|
67
83
|
- - '='
|
68
84
|
- !ruby/object:Gem::Version
|
69
|
-
version: 6.1.
|
85
|
+
version: 6.1.3.pre.1
|
70
86
|
type: :runtime
|
71
87
|
prerelease: false
|
72
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -74,7 +90,7 @@ dependencies:
|
|
74
90
|
requirements:
|
75
91
|
- - '='
|
76
92
|
- !ruby/object:Gem::Version
|
77
|
-
version: 6.1.
|
93
|
+
version: 6.1.3.pre.1
|
78
94
|
- !ruby/object:Gem::Dependency
|
79
95
|
name: cocaine
|
80
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -92,7 +108,7 @@ dependencies:
|
|
92
108
|
- !ruby/object:Gem::Version
|
93
109
|
version: '0'
|
94
110
|
- !ruby/object:Gem::Dependency
|
95
|
-
name:
|
111
|
+
name: facter
|
96
112
|
requirement: !ruby/object:Gem::Requirement
|
97
113
|
none: false
|
98
114
|
requirements:
|
@@ -148,6 +164,7 @@ files:
|
|
148
164
|
- lib/omf_rc/resource_proxy_dsl.rb
|
149
165
|
- lib/omf_rc/runner.rb
|
150
166
|
- lib/omf_rc/util/common_tools.rb
|
167
|
+
- lib/omf_rc/util/fact.rb
|
151
168
|
- lib/omf_rc/util/hostapd.rb
|
152
169
|
- lib/omf_rc/util/ip.rb
|
153
170
|
- lib/omf_rc/util/iw.rb
|
@@ -186,6 +203,7 @@ files:
|
|
186
203
|
- test/omf_rc/resource_proxy_dsl_spec.rb
|
187
204
|
- test/omf_rc/runner_spec.rb
|
188
205
|
- test/omf_rc/util/common_tools_spec.rb
|
206
|
+
- test/omf_rc/util/fact_spec.rb
|
189
207
|
- test/omf_rc/util/ip_spec.rb
|
190
208
|
- test/omf_rc/util/iw_spec.rb
|
191
209
|
- test/omf_rc/util/mod_spec.rb
|
@@ -206,12 +224,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
225
|
none: false
|
208
226
|
requirements:
|
209
|
-
- - ! '
|
227
|
+
- - ! '>'
|
210
228
|
- !ruby/object:Gem::Version
|
211
|
-
version:
|
212
|
-
segments:
|
213
|
-
- 0
|
214
|
-
hash: 1591098936909944639
|
229
|
+
version: 1.3.1
|
215
230
|
requirements: []
|
216
231
|
rubyforge_project: omf_rc
|
217
232
|
rubygems_version: 1.8.23
|