chef-sugar 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/chef/sugar/architecture.rb +2 -1
- data/lib/chef/sugar/shell.rb +12 -8
- data/lib/chef/sugar/vagrant.rb +2 -2
- data/lib/chef/sugar/version.rb +1 -1
- data/metadata.rb +1 -1
- data/recipes/default.rb +1 -1
- data/spec/unit/chef/sugar/architecture_spec.rb +12 -6
- data/spec/unit/chef/sugar/shell_spec.rb +6 -0
- data/spec/unit/chef/sugar/vagrant_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7235d14da8dc38078d5628514c42b4207f899a0
|
4
|
+
data.tar.gz: dd480e8c7951928e2474a0d7a1f68fb9504be3a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 842a39ed8a9ecfc1fbcd5d125002c16cd16433ee03b74a5f89baf943f5339208473083b08ad88efef182f8055d72b46bb32a1d9f90f90233f6c170dae75b1aed
|
7
|
+
data.tar.gz: 9e2d7737880a73558af1bb24299f07be8f88172bcf5fbb0b6a02aac2859ebbf753b5acffa3590010485591f96398ef9eb33cb8b55e7d0244d0fa40b3d64c285d
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@ Chef Sugar Changelog
|
|
2
2
|
=========================
|
3
3
|
This file is used to list changes made in each version of the chef-sugar cookbook and gem.
|
4
4
|
|
5
|
+
v2.3.1 (2014-10-07)
|
6
|
+
-------------------
|
7
|
+
### Improvements
|
8
|
+
- Check all 64-bit architectures that may be reported by Ohai
|
9
|
+
|
10
|
+
### Bug Fixes
|
11
|
+
- Be more tolerant of `nil` values return from sub functions
|
12
|
+
- Check to make sure `node['domain']` is not `nil` before calling `#include?`
|
13
|
+
|
5
14
|
v2.3.0 (2014-09-24)
|
6
15
|
-------------------
|
7
16
|
### Improvements
|
data/lib/chef/sugar/shell.rb
CHANGED
@@ -73,7 +73,7 @@ class Chef
|
|
73
73
|
#
|
74
74
|
# @param [String] cmd
|
75
75
|
# the command to check
|
76
|
-
# @param [String]
|
76
|
+
# @param [String] expected_version
|
77
77
|
# the version to check
|
78
78
|
# @param [String] flag
|
79
79
|
# the flag to use to check the version of the binary
|
@@ -82,13 +82,17 @@ class Chef
|
|
82
82
|
# true if the command exists and is at the given version, false
|
83
83
|
# otherwise
|
84
84
|
#
|
85
|
-
def installed_at_version?(cmd,
|
86
|
-
installed?(cmd)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
85
|
+
def installed_at_version?(cmd, expected_version, flag = '--version')
|
86
|
+
return false if !installed?(cmd)
|
87
|
+
|
88
|
+
version = version_for(cmd, flag)
|
89
|
+
return false if version.nil?
|
90
|
+
|
91
|
+
if expected_version.is_a?(Regexp)
|
92
|
+
!version.match(expected_version).nil?
|
93
|
+
else
|
94
|
+
version.include?(expected_version)
|
95
|
+
end
|
92
96
|
end
|
93
97
|
|
94
98
|
#
|
data/lib/chef/sugar/vagrant.rb
CHANGED
@@ -55,7 +55,7 @@ class Chef
|
|
55
55
|
# @return (see vagrant?)
|
56
56
|
#
|
57
57
|
def vagrant_domain?(node)
|
58
|
-
node.key?('domain') && node['domain'].include?('vagrantup.com')
|
58
|
+
node.key?('domain') && !node['domain'].nil? && node['domain'].include?('vagrantup.com')
|
59
59
|
end
|
60
60
|
|
61
61
|
#
|
@@ -65,7 +65,7 @@ class Chef
|
|
65
65
|
# @return (see vagrant?)
|
66
66
|
#
|
67
67
|
def vagrant_user?(node)
|
68
|
-
node.key?('etc') && node['etc'].key?('passwd') &&
|
68
|
+
node.key?('etc') && node['etc'].key?('passwd') && node['etc']['passwd'].key?('vagrant')
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
data/lib/chef/sugar/version.rb
CHANGED
data/metadata.rb
CHANGED
data/recipes/default.rb
CHANGED
@@ -3,10 +3,14 @@ require 'spec_helper'
|
|
3
3
|
describe Chef::Sugar::Architecture do
|
4
4
|
it_behaves_like 'a chef sugar'
|
5
5
|
|
6
|
+
_64_bit_machines = %w(x86_64 ppc64 s390x ia64 sparc64 aarch64 arch64 arm64)
|
7
|
+
|
6
8
|
describe '#_64_bit?' do
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
_64_bit_machines.each do |arch|
|
10
|
+
it "returns true when the system is #{arch}" do
|
11
|
+
node = { 'kernel' => { 'machine' => arch } }
|
12
|
+
expect(described_class._64_bit?(node)).to be true
|
13
|
+
end
|
10
14
|
end
|
11
15
|
|
12
16
|
it 'returns false when the system is not 64 bit' do
|
@@ -21,9 +25,11 @@ describe Chef::Sugar::Architecture do
|
|
21
25
|
expect(described_class._32_bit?(node)).to be true
|
22
26
|
end
|
23
27
|
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
_64_bit_machines.each do |arch|
|
29
|
+
it "returns false when the system is #{arch}" do
|
30
|
+
node = { 'kernel' => { 'machine' => arch } }
|
31
|
+
expect(described_class._32_bit?(node)).to be false
|
32
|
+
end
|
27
33
|
end
|
28
34
|
end
|
29
35
|
end
|
@@ -76,6 +76,12 @@ describe Chef::Sugar::Shell do
|
|
76
76
|
expect(described_class.installed_at_version?('mongo', '4.5.6')).to be false
|
77
77
|
end
|
78
78
|
|
79
|
+
it 'returns false if #version_for is nil' do
|
80
|
+
allow(described_class).to receive(:which).and_return(true)
|
81
|
+
allow(described_class).to receive(:version_for).and_return(nil)
|
82
|
+
expect(described_class.installed_at_version?('mongo', '4.5.6')).to be false
|
83
|
+
end
|
84
|
+
|
79
85
|
it 'returns false if the command is not installed' do
|
80
86
|
allow(described_class).to receive(:which).and_return(nil)
|
81
87
|
expect(described_class.installed_at_version?('mongo', '1.0.0')).to be false
|
@@ -14,6 +14,16 @@ describe Chef::Sugar::Vagrant do
|
|
14
14
|
expect(described_class.vagrant?(node)).to be true
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'returns false when the domain is nil' do
|
18
|
+
node = { 'domain' => nil }
|
19
|
+
expect(described_class.vagrant?(node)).to be false
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'returns false when the domain is not vagrantup.com' do
|
23
|
+
node = { 'domain' => 'sethvargo.com' }
|
24
|
+
expect(described_class.vagrant?(node)).to be false
|
25
|
+
end
|
26
|
+
|
17
27
|
it 'returns true when the vagrant user exists on the system' do
|
18
28
|
node = { 'etc' => { 'passwd' => { 'vagrant' => {} } } }
|
19
29
|
expect(described_class.vagrant?(node)).to be true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-sugar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.3.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Seth Vargo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|