chef-sugar 2.3.0 → 2.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: caa6d7d523f36a96b77fbbb6b405c77fe6245c8c
4
- data.tar.gz: c300171c8b01b7664afa7660eae39417c63f26f4
3
+ metadata.gz: d7235d14da8dc38078d5628514c42b4207f899a0
4
+ data.tar.gz: dd480e8c7951928e2474a0d7a1f68fb9504be3a2
5
5
  SHA512:
6
- metadata.gz: 605a75aafd4c650900c9963afbb97dfdc0dcc064ce24737de8d59c11491360d155e18e1cc34d6182564a5d0bc49f94156add3b819559f7eaf48c87ee6b0a483e
7
- data.tar.gz: 9daa3408b7a6a465c8f59df7a9043d7b726ac7dfefe00845a9113672d5e912f506fdc0156fd1ae858917d9529e8f79d7168737ffe5ddc6afe1b88c55cc2cbd41
6
+ metadata.gz: 842a39ed8a9ecfc1fbcd5d125002c16cd16433ee03b74a5f89baf943f5339208473083b08ad88efef182f8055d72b46bb32a1d9f90f90233f6c170dae75b1aed
7
+ data.tar.gz: 9e2d7737880a73558af1bb24299f07be8f88172bcf5fbb0b6a02aac2859ebbf753b5acffa3590010485591f96398ef9eb33cb8b55e7d0244d0fa40b3d64c285d
@@ -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
@@ -25,7 +25,8 @@ class Chef
25
25
  # @return [Boolean]
26
26
  #
27
27
  def _64_bit?(node)
28
- node['kernel']['machine'] == 'x86_64'
28
+ %w(x86_64 ppc64 s390x ia64 sparc64 aarch64 arch64 arm64)
29
+ .include?(node['kernel']['machine'])
29
30
  end
30
31
 
31
32
  #
@@ -73,7 +73,7 @@ class Chef
73
73
  #
74
74
  # @param [String] cmd
75
75
  # the command to check
76
- # @param [String] version
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, version, flag = '--version')
86
- installed?(cmd) &&
87
- if version.is_a?(Regexp)
88
- !version_for(cmd, flag).match(version).nil?
89
- else
90
- version_for(cmd, flag).include?(version)
91
- end
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
  #
@@ -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') && !!node['etc']['passwd']['vagrant']
68
+ node.key?('etc') && node['etc'].key?('passwd') && node['etc']['passwd'].key?('vagrant')
69
69
  end
70
70
  end
71
71
 
@@ -16,6 +16,6 @@
16
16
 
17
17
  class Chef
18
18
  module Sugar
19
- VERSION = '2.3.0'
19
+ VERSION = '2.3.1'
20
20
  end
21
21
  end
@@ -14,4 +14,4 @@ For the most up-to-date information and documentation, please visit the [Chef
14
14
  Sugar project page on GitHub](https://github.com/sethvargo/chef-sugar).
15
15
  EOH
16
16
 
17
- version '2.3.0'
17
+ version '2.3.1'
@@ -18,7 +18,7 @@
18
18
  #
19
19
 
20
20
  chef_gem('chef-sugar') do
21
- version '2.3.0'
21
+ version '2.3.1'
22
22
  action :nothing
23
23
  end.run_action(:install)
24
24
 
@@ -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
- it 'returns true when the system is 64 bit' do
8
- node = { 'kernel' => { 'machine' => 'x86_64' } }
9
- expect(described_class._64_bit?(node)).to be true
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
- it 'returns false when the system is not 32 bit' do
25
- node = { 'kernel' => { 'machine' => 'x86_64' } }
26
- expect(described_class._32_bit?(node)).to be false
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.0
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-09-24 00:00:00.000000000 Z
11
+ date: 2014-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler