train 0.29.0 → 0.29.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b82f61f801217ce81fc40bb5ad6a6e73a19da3de
4
- data.tar.gz: 25fb11d1d6930ecda79bb5d2e70030ddddcf976b
3
+ metadata.gz: 8f08c1d5dc97551bd522b203489d60896b2d12a3
4
+ data.tar.gz: dc98c76bf9a16796e8ff4873ca6976fbfdb8a2fe
5
5
  SHA512:
6
- metadata.gz: 1c752a556c55eadeaec19702a6db9ba3110b17b55418f3301a04d919ae899a3e806ed716ce5239515f33efb203e98d6678a8d0bed0f515a8cf0e4cbf22e1dc9f
7
- data.tar.gz: 51098591df48b28d34798dbf729c701f903889e55d63f48a38115aeea0a94d2eca48bcc32bba33b398700574f66db6d7f980aa2e50b1b9fda528edba9b96cba6
6
+ metadata.gz: d5c09fc411b4359394bb34e875f8db1e9255b8e86e61db758254f1d748d060a2b2adefb9b40968ed0b5ed348fbf9eb738b830eafbdd83f8619402c6003be80bc
7
+ data.tar.gz: b5fbd002908a670d9352782d5455feffb3595816cce1fb86d0e41e118f7fcd3702a1379c93534dba7608b1d68e99b132d71f67dc85efffeaabda28045a7019b8
@@ -1,10 +1,19 @@
1
1
  # Change Log
2
2
 
3
- ## [0.29.0](https://github.com/chef/train/tree/0.29.0) (2017-11-13)
4
- [Full Changelog](https://github.com/chef/train/compare/v0.28.0...0.29.0)
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))
@@ -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
@@ -50,10 +50,6 @@ module Train
50
50
  @backend.run_command("mount | grep -- ' on #{@spath} '")
51
51
  end
52
52
 
53
- def mounted?
54
- !mounted.nil? && !mounted.stdout.nil? && !mounted.stdout.empty?
55
- end
56
-
57
53
  def grouped_into?(sth)
58
54
  group == sth
59
55
  end
@@ -31,10 +31,6 @@ module Train
31
31
  )
32
32
  end
33
33
 
34
- def mounted?
35
- !mounted.nil? && !mounted.stdout.nil? && !mounted.stdout.empty?
36
- end
37
-
38
34
  def mounted
39
35
  @mounted ||=
40
36
  @backend.run_command("mount | grep -- ' on #{@spath} '")
@@ -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
@@ -3,5 +3,5 @@
3
3
  # Author:: Dominik Richter (<dominik.richter@gmail.com>)
4
4
 
5
5
  module Train
6
- VERSION = '0.29.0'.freeze
6
+ VERSION = '0.29.1'.freeze
7
7
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: train
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Richter