train 0.29.0 → 0.29.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/lib/train/file.rb +13 -0
- data/lib/train/file/local/unix.rb +0 -4
- data/lib/train/file/remote/unix.rb +0 -4
- data/lib/train/transports/mock.rb +3 -0
- data/lib/train/version.rb +1 -1
- data/test/unit/transports/mock_test.rb +34 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f08c1d5dc97551bd522b203489d60896b2d12a3
|
4
|
+
data.tar.gz: dc98c76bf9a16796e8ff4873ca6976fbfdb8a2fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5c09fc411b4359394bb34e875f8db1e9255b8e86e61db758254f1d748d060a2b2adefb9b40968ed0b5ed348fbf9eb738b830eafbdd83f8619402c6003be80bc
|
7
|
+
data.tar.gz: b5fbd002908a670d9352782d5455feffb3595816cce1fb86d0e41e118f7fcd3702a1379c93534dba7608b1d68e99b132d71f67dc85efffeaabda28045a7019b8
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [0.29.
|
4
|
-
[Full Changelog](https://github.com/chef/train/compare/v0.
|
3
|
+
## [0.29.1](https://github.com/chef/train/tree/0.29.1) (2017-11-13)
|
4
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.29.0...0.29.1)
|
5
5
|
|
6
6
|
**Merged pull requests:**
|
7
7
|
|
8
|
+
- Allow for a nil value when mocking OS [\#212](https://github.com/chef/train/pull/212) ([adamleff](https://github.com/adamleff))
|
9
|
+
- Ensure a `mounted?` method exists for all File classes, including Mock [\#211](https://github.com/chef/train/pull/211) ([adamleff](https://github.com/adamleff))
|
10
|
+
|
11
|
+
## [v0.29.0](https://github.com/chef/train/tree/v0.29.0) (2017-11-13)
|
12
|
+
[Full Changelog](https://github.com/chef/train/compare/v0.28.0...v0.29.0)
|
13
|
+
|
14
|
+
**Merged pull requests:**
|
15
|
+
|
16
|
+
- Release 0.29.0 [\#210](https://github.com/chef/train/pull/210) ([adamleff](https://github.com/adamleff))
|
8
17
|
- Reverting accidental push to master re: \#204 [\#208](https://github.com/chef/train/pull/208) ([adamleff](https://github.com/adamleff))
|
9
18
|
- clearer error if no auth methods are available [\#207](https://github.com/chef/train/pull/207) ([thommay](https://github.com/thommay))
|
10
19
|
- Build a complete mock OS object [\#206](https://github.com/chef/train/pull/206) ([adamleff](https://github.com/adamleff))
|
data/lib/train/file.rb
CHANGED
@@ -140,5 +140,18 @@ module Train
|
|
140
140
|
@path
|
141
141
|
end
|
142
142
|
end
|
143
|
+
|
144
|
+
# if the OS-specific file class supports inquirying as to whether the
|
145
|
+
# file/device is mounted, the #mounted method should return a command
|
146
|
+
# object whose stdout will not be nil if indeed the device is mounted.
|
147
|
+
#
|
148
|
+
# if the OS-specific file class does not support checking for mount
|
149
|
+
# status, the method should not be implemented and this method will
|
150
|
+
# return false.
|
151
|
+
def mounted?
|
152
|
+
return false unless respond_to?(:mounted)
|
153
|
+
|
154
|
+
!mounted.nil? && !mounted.stdout.nil? && !mounted.stdout.empty?
|
155
|
+
end
|
143
156
|
end
|
144
157
|
end
|
@@ -74,6 +74,9 @@ class Train::Transports::Mock
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def mock_os(value = {})
|
77
|
+
# if a user passes a nil value, set to an empty hash so the merge still succeeds
|
78
|
+
value ||= {}
|
79
|
+
|
77
80
|
os_params = { name: 'unknown', family: 'unknown', release: 'unknown', arch: 'unknown' }.merge(value)
|
78
81
|
@os = OS.new(self, os_params)
|
79
82
|
end
|
data/lib/train/version.rb
CHANGED
@@ -81,6 +81,40 @@ describe 'mock transport' do
|
|
81
81
|
connection.os.redhat?.must_equal true
|
82
82
|
connection.os[:family].must_equal 'centos'
|
83
83
|
end
|
84
|
+
|
85
|
+
it 'allows the setting of the name' do
|
86
|
+
connection.mock_os({ name: 'foo' })
|
87
|
+
connection.os[:name].must_equal 'foo'
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'allows setting of the family' do
|
91
|
+
connection.mock_os({ family: 'foo' })
|
92
|
+
connection.os[:family].must_equal 'foo'
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'allows setting of the release' do
|
96
|
+
connection.mock_os({ release: '1.2.3' })
|
97
|
+
connection.os[:release].must_equal '1.2.3'
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'allows setting of the arch' do
|
101
|
+
connection.mock_os({ arch: 'amd123' })
|
102
|
+
connection.os[:arch].must_equal 'amd123'
|
103
|
+
end
|
104
|
+
|
105
|
+
it 'allow setting of multiple values' do
|
106
|
+
connection.mock_os({ name: 'foo', family: 'bar' })
|
107
|
+
connection.os[:name].must_equal 'foo'
|
108
|
+
connection.os[:family].must_equal 'bar'
|
109
|
+
connection.os[:arch].must_equal 'unknown'
|
110
|
+
connection.os[:release].must_equal 'unknown'
|
111
|
+
end
|
112
|
+
|
113
|
+
it 'properly handles a nil value' do
|
114
|
+
connection.mock_os(nil)
|
115
|
+
connection.os[:name].must_equal 'unknown'
|
116
|
+
connection.os[:family].must_equal 'unknown'
|
117
|
+
end
|
84
118
|
end
|
85
119
|
|
86
120
|
describe 'when accessing a mocked file' do
|