chef 12.21.26 → 12.21.31
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/acceptance/top-cookbooks/.acceptance/acceptance-cookbook/libraries/top_cookbooks.rb +0 -6
- data/lib/chef/provider/ifconfig.rb +90 -22
- data/lib/chef/version.rb +1 -1
- data/spec/functional/resource/ifconfig_spec.rb +1 -1
- data/spec/functional/resource/mount_spec.rb +7 -3
- data/spec/functional/resource/user/useradd_spec.rb +4 -4
- data/spec/unit/provider/ifconfig_spec.rb +3 -8
- data/tasks/bundle_util.rb +1 -1
- metadata +4 -6
- data/acceptance/top-cookbooks/.kitchen.docker.yml +0 -9
- data/acceptance/top-cookbooks/.kitchen.git.yml +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c4ac5daf7e3fe4f19ee6d0bf73868f000bc4d4b
|
4
|
+
data.tar.gz: 42a30a4ade01072c82cc2545dc3c3a007473a183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5ac8366f084f8d38414fa4332f621b12a8388f00c8edfaae999c1d5fbb583b894de88f14b079af800e428d379c4d8653ae79d45951497f5aa0de3a1158280e9
|
7
|
+
data.tar.gz: 771fffd934ddc8672222a79e84d11a5a5ea76d504c8e13920dd2041f83fe3d1130ce10d83087e784b65a1a999b302c1e701031e19c2078e803c206435b2f4a1f
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
12.21.
|
1
|
+
12.21.31
|
@@ -6,12 +6,6 @@ class TopCookbooks < Chef::Resource
|
|
6
6
|
# Disabling all windows tests until winrm issue is properly settled.
|
7
7
|
#
|
8
8
|
action :run do
|
9
|
-
cookbook_kitchen "#{command} docker" do
|
10
|
-
end
|
11
|
-
|
12
|
-
cookbook_kitchen "#{command} git" do
|
13
|
-
end
|
14
|
-
|
15
9
|
cookbook_kitchen "#{command} learn-the-basics-ubuntu" do
|
16
10
|
repository "learn-chef/learn-chef-acceptance"
|
17
11
|
cookbook_relative_dir "cookbooks/learn-the-basics-ubuntu"
|
@@ -63,30 +63,98 @@ class Chef
|
|
63
63
|
@ifconfig_success = true
|
64
64
|
@interfaces = {}
|
65
65
|
|
66
|
-
@
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
66
|
+
@ifconfig_version = nil
|
67
|
+
|
68
|
+
@net_tools_version = shell_out("ifconfig --version")
|
69
|
+
@net_tools_version.stderr.each_line do |line|
|
70
|
+
if line =~ /^net-tools (\d+.\d+)/
|
71
|
+
@ifconfig_version = line.match(/^net-tools (\d+.\d+)/)[1]
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
if @ifconfig_version.nil?
|
76
|
+
raise "net-tools not found - this is required for ifconfig"
|
77
|
+
elsif @ifconfig_version.to_f < 2.0
|
78
|
+
# Example output for 1.60 is as follows: (sanitized but format intact)
|
79
|
+
# eth0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
|
80
|
+
# inet addr:192.168.1.1 Bcast:192.168.0.1 Mask:255.255.248.0
|
81
|
+
# inet6 addr: 0000::00:0000:0000:0000/64 Scope:Link
|
82
|
+
# UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
|
83
|
+
# RX packets:65158911 errors:0 dropped:0 overruns:0 frame:0
|
84
|
+
# TX packets:41723949 errors:0 dropped:0 overruns:0 carrier:0
|
85
|
+
# collisions:0 txqueuelen:1000
|
86
|
+
# RX bytes:42664658792 (39.7 GiB) TX bytes:52722603938 (49.1 GiB)
|
87
|
+
# Interrupt:30
|
88
|
+
@status = shell_out("ifconfig")
|
89
|
+
@status.stdout.each_line do |line|
|
90
|
+
if !line[0..9].strip.empty?
|
91
|
+
@int_name = line[0..9].strip
|
92
|
+
@interfaces[@int_name] = { "hwaddr" => (line =~ /(HWaddr)/ ? ($') : "nil").strip.chomp }
|
93
|
+
else
|
94
|
+
@interfaces[@int_name]["inet_addr"] = (line =~ /inet addr:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /inet addr:/
|
95
|
+
@interfaces[@int_name]["bcast"] = (line =~ /Bcast:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /Bcast:/
|
96
|
+
@interfaces[@int_name]["mask"] = (line =~ /Mask:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /Mask:/
|
97
|
+
@interfaces[@int_name]["mtu"] = (line =~ /MTU:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /MTU:/
|
98
|
+
@interfaces[@int_name]["metric"] = (line =~ /Metric:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /Metric:/
|
99
|
+
end
|
100
|
+
|
101
|
+
next unless @interfaces.key?(new_resource.device)
|
102
|
+
@interface = @interfaces.fetch(new_resource.device)
|
103
|
+
|
104
|
+
current_resource.target(new_resource.target)
|
105
|
+
current_resource.device(new_resource.device)
|
106
|
+
current_resource.inet_addr(@interface["inet_addr"])
|
107
|
+
current_resource.hwaddr(@interface["hwaddr"])
|
108
|
+
current_resource.bcast(@interface["bcast"])
|
109
|
+
current_resource.mask(@interface["mask"])
|
110
|
+
current_resource.mtu(@interface["mtu"])
|
111
|
+
current_resource.metric(@interface["metric"])
|
77
112
|
end
|
113
|
+
elsif @ifconfig_version.to_f >= 2.0
|
114
|
+
# Example output for 2.10-alpha is as follows: (sanitized but format intact)
|
115
|
+
# eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
|
116
|
+
# inet 192.168.1.1 netmask 255.255.240.0 broadcast 192.168.0.1
|
117
|
+
# inet6 0000::0000:000:0000:0000 prefixlen 64 scopeid 0x20<link>
|
118
|
+
# ether 00:00:00:00:00:00 txqueuelen 1000 (Ethernet)
|
119
|
+
# RX packets 2383836 bytes 1642630840 (1.5 GiB)
|
120
|
+
# RX errors 0 dropped 0 overruns 0 frame 0
|
121
|
+
# TX packets 1244218 bytes 977339327 (932.0 MiB)
|
122
|
+
# TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
123
|
+
@status = shell_out("ifconfig")
|
124
|
+
@status.stdout.each_line do |line|
|
125
|
+
addr_regex = /^(\w+):?(\d*):?\ .+$/
|
126
|
+
if line =~ addr_regex
|
127
|
+
if line.match(addr_regex).nil?
|
128
|
+
@int_name = "nil"
|
129
|
+
elsif line.match(addr_regex)[2] == ""
|
130
|
+
@int_name = line.match(addr_regex)[1]
|
131
|
+
@interfaces[@int_name] = Hash.new
|
132
|
+
@interfaces[@int_name]["mtu"] = (line =~ /mtu (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /mtu/ && @interfaces[@int_name]["mtu"].nil?
|
133
|
+
else
|
134
|
+
@int_name = "#{line.match(addr_regex)[1]}:#{line.match(addr_regex)[2]}"
|
135
|
+
@interfaces[@int_name] = Hash.new
|
136
|
+
@interfaces[@int_name]["mtu"] = (line =~ /mtu (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /mtu/ && @interfaces[@int_name]["mtu"].nil?
|
137
|
+
end
|
138
|
+
else
|
139
|
+
@interfaces[@int_name]["inet_addr"] = (line =~ /inet (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /inet/ && @interfaces[@int_name]["inet_addr"].nil?
|
140
|
+
@interfaces[@int_name]["bcast"] = (line =~ /broadcast (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /broadcast/ && @interfaces[@int_name]["bcast"].nil?
|
141
|
+
@interfaces[@int_name]["mask"] = (line =~ /netmask (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /netmask/ && @interfaces[@int_name]["mask"].nil?
|
142
|
+
@interfaces[@int_name]["hwaddr"] = (line =~ /ether (\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /ether/ && @interfaces[@int_name]["hwaddr"].nil?
|
143
|
+
@interfaces[@int_name]["metric"] = (line =~ /Metric:(\S+)/ ? Regexp.last_match(1) : "nil") if line =~ /Metric:/ && @interfaces[@int_name]["metric"].nil?
|
144
|
+
end
|
78
145
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
146
|
+
next unless @interfaces.key?(new_resource.device)
|
147
|
+
@interface = @interfaces.fetch(new_resource.device)
|
148
|
+
|
149
|
+
current_resource.target(new_resource.target)
|
150
|
+
current_resource.device(new_resource.device)
|
151
|
+
current_resource.inet_addr(@interface["inet_addr"])
|
152
|
+
current_resource.hwaddr(@interface["hwaddr"])
|
153
|
+
current_resource.bcast(@interface["bcast"])
|
154
|
+
current_resource.mask(@interface["mask"])
|
155
|
+
current_resource.mtu(@interface["mtu"])
|
156
|
+
current_resource.metric(@interface["metric"])
|
157
|
+
end
|
90
158
|
end
|
91
159
|
current_resource
|
92
160
|
end
|
data/lib/chef/version.rb
CHANGED
@@ -20,7 +20,7 @@ require "functional/resource/base"
|
|
20
20
|
require "chef/mixin/shell_out"
|
21
21
|
|
22
22
|
# run this test only for following platforms.
|
23
|
-
include_flag = !(%w{
|
23
|
+
include_flag = !(%w{amazon debian aix}.include?(ohai[:platform_family]) || (ohai[:platform_family] == "rhel" && ohai[:platform_version].to_i < 7))
|
24
24
|
|
25
25
|
describe Chef::Resource::Ifconfig, :requires_root, :skip_travis, :external => include_flag do
|
26
26
|
# This test does not work in travis because there is no eth0
|
@@ -22,7 +22,7 @@ require "chef/mixin/shell_out"
|
|
22
22
|
require "tmpdir"
|
23
23
|
|
24
24
|
# run this test only for following platforms.
|
25
|
-
include_flag = !(%w{
|
25
|
+
include_flag = !(%w{debian rhel amazon aix solaris2}.include?(ohai[:platform_family]))
|
26
26
|
|
27
27
|
describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => include_flag do
|
28
28
|
# Disabled in travis because it refuses to let us mount a ramdisk. /dev/ramX does not
|
@@ -35,15 +35,19 @@ describe Chef::Resource::Mount, :requires_root, :skip_travis, :external => inclu
|
|
35
35
|
def setup_device_for_mount
|
36
36
|
# use ramdisk for creating a test device for mount.
|
37
37
|
# This can cleaner if we have chef resource/provider for ramdisk.
|
38
|
-
case ohai[:
|
38
|
+
case ohai[:platform_family]
|
39
39
|
when "aix"
|
40
40
|
# On AIX, we can't create a ramdisk inside a WPAR, so we use
|
41
41
|
# a "namefs" mount against / to test
|
42
42
|
# https://www-304.ibm.com/support/knowledgecenter/ssw_aix_71/com.ibm.aix.performance/namefs_file_sys.htm
|
43
43
|
device = "/"
|
44
44
|
fstype = "namefs"
|
45
|
-
when "
|
45
|
+
when "debian", "rhel", "amazon"
|
46
46
|
device = "/dev/ram1"
|
47
|
+
unless File.exist?(device)
|
48
|
+
shell_out("mknod -m 660 #{device} b 1 0")
|
49
|
+
shell_out("chown root:disk #{device}")
|
50
|
+
end
|
47
51
|
shell_out("ls -1 /dev/ram*").stdout.each_line do |d|
|
48
52
|
if shell_out("mount | grep #{d}").exitstatus == "1"
|
49
53
|
# this device is not mounted, so use it.
|
@@ -646,10 +646,10 @@ describe Chef::Provider::User::Useradd, metadata do
|
|
646
646
|
expect(@error.message).to include("Cannot unlock the password")
|
647
647
|
end
|
648
648
|
elsif %w{rhel}.include?(OHAI_SYSTEM["platform_family"]) &&
|
649
|
-
OHAI_SYSTEM["platform_version"].to_f
|
650
|
-
#
|
651
|
-
#
|
652
|
-
#
|
649
|
+
(Chef::VersionConstraint.new("~> 6.8").include?(OHAI_SYSTEM["platform_version"].to_f) || Chef::VersionConstraint.new("~> 7.3").include?(OHAI_SYSTEM["platform_version"].to_f))
|
650
|
+
# RHEL 6.8 and 7.3 ship with a fixed `usermod` command
|
651
|
+
# Reference: https://access.redhat.com/errata/RHBA-2016:0864
|
652
|
+
# Reference: https://access.redhat.com/errata/RHBA-2016:2322
|
653
653
|
it "errors out trying to unlock the user" do
|
654
654
|
expect(@error).to be_a(Mixlib::ShellOut::ShellCommandFailed)
|
655
655
|
expect(@error.message).to include("You should set a password")
|
@@ -42,16 +42,11 @@ describe Chef::Provider::Ifconfig do
|
|
42
42
|
end
|
43
43
|
describe Chef::Provider::Ifconfig, "load_current_resource" do
|
44
44
|
before do
|
45
|
-
|
46
|
-
allow(@provider).to receive(:shell_out).and_return(
|
47
|
-
@provider.load_current_resource
|
48
|
-
end
|
49
|
-
it "should track state of ifconfig failure" do
|
50
|
-
expect(@provider.instance_variable_get("@status").exitstatus).not_to eq(0)
|
45
|
+
mixlib = Mixlib::ShellOut.new
|
46
|
+
allow(@provider).to receive(:shell_out).and_return(mixlib)
|
51
47
|
end
|
52
48
|
it "should thrown an exception when ifconfig fails" do
|
53
|
-
@provider.
|
54
|
-
expect { @provider.process_resource_requirements }.to raise_error Chef::Exceptions::Ifconfig
|
49
|
+
expect { @provider.load_current_resource }.to raise_error
|
55
50
|
end
|
56
51
|
end
|
57
52
|
describe Chef::Provider::Ifconfig, "action_add" do
|
data/tasks/bundle_util.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.21.
|
4
|
+
version: 12.21.31
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-config
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 12.21.
|
19
|
+
version: 12.21.31
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 12.21.
|
26
|
+
version: 12.21.31
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-cli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -527,8 +527,6 @@ files:
|
|
527
527
|
- acceptance/top-cookbooks/.acceptance/acceptance-cookbook/recipes/verify.rb
|
528
528
|
- acceptance/top-cookbooks/.gitignore
|
529
529
|
- acceptance/top-cookbooks/.kitchen.chocolatey.yml
|
530
|
-
- acceptance/top-cookbooks/.kitchen.docker.yml
|
531
|
-
- acceptance/top-cookbooks/.kitchen.git.yml
|
532
530
|
- acceptance/top-cookbooks/.kitchen.iis.yml
|
533
531
|
- acceptance/top-cookbooks/.kitchen.learn-the-basics-rhel.yml
|
534
532
|
- acceptance/top-cookbooks/.kitchen.learn-the-basics-ubuntu.yml
|
@@ -1,11 +0,0 @@
|
|
1
|
-
suites:
|
2
|
-
- name: git-default
|
3
|
-
# Ubuntu images need to run apt update
|
4
|
-
run_list: ["recipe[apt]","recipe[git]"]
|
5
|
-
includes: [ubuntu-14.04]
|
6
|
-
- name: git-source
|
7
|
-
run_list: ["recipe[git::source]"]
|
8
|
-
includes: [nonexistent]
|
9
|
-
- name: git-default-windows
|
10
|
-
run_list: ["recipe[git]"]
|
11
|
-
includes: [windows-2012r2]
|