chef 15.6.10-universal-mingw32 → 15.7.30-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/README.md +2 -2
  4. data/lib/chef/chef_fs/file_system/chef_server/cookbooks_dir.rb +22 -5
  5. data/lib/chef/cookbook/cookbook_version_loader.rb +12 -6
  6. data/lib/chef/cookbook_loader.rb +55 -2
  7. data/lib/chef/cookbook_uploader.rb +2 -0
  8. data/lib/chef/cookbook_version.rb +17 -0
  9. data/lib/chef/dist.rb +3 -3
  10. data/lib/chef/event_loggers/windows_eventlog.rb +1 -1
  11. data/lib/chef/knife/bootstrap.rb +5 -0
  12. data/lib/chef/knife/bootstrap/templates/chef-full.erb +11 -11
  13. data/lib/chef/knife/cookbook_upload.rb +75 -45
  14. data/lib/chef/knife/core/bootstrap_context.rb +5 -5
  15. data/lib/chef/knife/core/windows_bootstrap_context.rb +1 -1
  16. data/lib/chef/knife/supermarket_install.rb +1 -1
  17. data/lib/chef/log/winevt.rb +1 -1
  18. data/lib/chef/mixin/openssl_helper.rb +21 -0
  19. data/lib/chef/monkey_patches/net_http.rb +0 -38
  20. data/lib/chef/provider/cron.rb +54 -9
  21. data/lib/chef/provider/cron/aix.rb +9 -2
  22. data/lib/chef/provider/launchd.rb +1 -1
  23. data/lib/chef/provider/user/aix.rb +1 -1
  24. data/lib/chef/provider/user/mac.rb +17 -22
  25. data/lib/chef/provider/windows_task.rb +2 -2
  26. data/lib/chef/resource/archive_file.rb +5 -2
  27. data/lib/chef/resource/cron.rb +29 -0
  28. data/lib/chef/resource/cron_d.rb +29 -0
  29. data/lib/chef/resource/openssl_x509_certificate.rb +32 -21
  30. data/lib/chef/resource/sudo.rb +13 -4
  31. data/lib/chef/version.rb +2 -2
  32. data/lib/chef/version_string.rb +3 -126
  33. data/spec/data/cookbooks/apache2/metadata.json +33 -0
  34. data/spec/data/cookbooks/java/metadata.json +33 -0
  35. data/spec/functional/event_loggers/windows_eventlog_spec.rb +5 -5
  36. data/spec/integration/knife/chef_fs_data_store_spec.rb +7 -2
  37. data/spec/integration/knife/cookbook_upload_spec.rb +10 -0
  38. data/spec/integration/knife/deps_spec.rb +11 -0
  39. data/spec/integration/knife/upload_spec.rb +115 -14
  40. data/spec/unit/cookbook/cookbook_version_loader_spec.rb +7 -4
  41. data/spec/unit/knife/cookbook_upload_spec.rb +79 -18
  42. data/spec/unit/mixin/openssl_helper_spec.rb +42 -0
  43. data/spec/unit/provider/cron_spec.rb +127 -0
  44. data/spec/unit/provider/user/aix_spec.rb +2 -2
  45. metadata +8 -6
@@ -854,4 +854,46 @@ describe Chef::Mixin::OpenSSLHelper do
854
854
  end
855
855
  end
856
856
  end
857
+
858
+ describe "#cert_need_renewall?" do
859
+ require "tempfile"
860
+
861
+ before(:each) do
862
+ @certfile = Tempfile.new("certfile")
863
+ end
864
+
865
+ context "When the cert file doesnt not exist" do
866
+ it "returns true" do
867
+ expect(instance.cert_need_renewall?("/tmp/bad_filename", 3650)).to be_truthy
868
+ end
869
+ end
870
+
871
+ context "When the cert file does exist, but does not contain a valid Certificate" do
872
+ it "returns true" do
873
+ @certfile.write("I_am_not_a_cert_I_am_a_free_man")
874
+ @certfile.close
875
+ expect(instance.cert_need_renewall?(@certfile.path, 3650)).to be_truthy
876
+ end
877
+ end
878
+
879
+ context "When the cert file does exist, and does not contain a soon to expire certficitate" do
880
+ it "returns false" do
881
+ @certfile.write("-----BEGIN CERTIFICATE-----\nMIIDODCCAiCgAwIBAgIVAPCkjE+wlZ1PgXwgvFgXKzhSpUkvMA0GCSqGSIb3DQEB\nCwUAMA0xCzAJBgNVBAMMAkNBMB4XDTE5MTIyNTEyNTY1NVoXDTI5MTIyMjEyNTY1\nNVowDTELMAkGA1UEAwwCQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB\nAQC9bDWs5akf85UEMj8kry4DYNuAnaL4GnMs6XukQtp3dso+FgbKprgVogyepnet\nE+GlQq32u/n4y8K228kB6NoCn+c/yP+4QlKUBt0xSzQbSUuAE/5xZoKi/kH1ZsQ/\nuKXN/tIHagApEUGn5zqc8WBvWPliRAqiklwj8WtSw1WRa5eCdaVtln3wKuvPnYR5\n/V4YBHyHNhtlfXJBMtEaXm1rRzJGun+FdcrsCfcIFXp8lWobF+EVP8fRwqFTEtT6\nRXv6RT8sHy53a0KNTm8qnbacfr1MofgUuhzLjOrbIVvXpnRLeOkv8XW5rSH+zgsC\nZFK3bJ3j6UVbFQV4jXwlAWVrAgMBAAGjgY4wgYswDgYDVR0PAQH/BAQDAgGmMA8G\nA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFK4S2PNu6bpjxkJxedNaxfCrwtD4MEkG\nA1UdIwRCMECAFK4S2PNu6bpjxkJxedNaxfCrwtD4oRGkDzANMQswCQYDVQQDDAJD\nQYIVAPCkjE+wlZ1PgXwgvFgXKzhSpUkvMA0GCSqGSIb3DQEBCwUAA4IBAQBGk+u3\n9N3PLWNOwYrqK7fD4yceWnz4UsV9uN1IU5PQTgYBaGyAZvU+VJluZZeDj7QjwbUW\ngISclvW/pSWpUVW3O0sfAM97u+5UMYHz4W5Bgq8CtdOKHgdZHKhzBePhmou11zO0\nZ6uQ7bkh0/REqKO7TFKaMMnakEhFXoDrS1EiB4W69KVXyrBVzVm5LK7uvOAQAeMp\nnEk3Oz+5pmKjSCf1cEd2jzAgDbaVrIvxICPgXAlNrKukmRW/0UHqDDVBfF7PioD2\nptlQFxWIkih6s/clwhsBFBwV1yyCirYfjhzmKPPLZUmx10okudLzaKrRbkPxrzbC\nmKEZoV+Nz2CNrGm5\n-----END CERTIFICATE-----\n")
882
+ @certfile.close
883
+ expect(instance.cert_need_renewall?(@certfile.path, 5)).to be_falsey
884
+ end
885
+ end
886
+
887
+ context "When the cert file does exist, and does contain a soon to expire certficitate" do
888
+ it "returns true" do
889
+ @certfile.write("-----BEGIN CERTIFICATE-----\nMIIDODCCAiCgAwIBAgIVAPCkjE+wlZ1Pg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mx10okudLzaKrRbkPxrzbC\nmKEZoV+Nz2CNrGm5\n-----END CERTIFICATE-----\n")
890
+ @certfile.close
891
+ expect(instance.cert_need_renewall?(@certfile.path, 3650)).to be_truthy
892
+ end
893
+ end
894
+
895
+ after(:each) do
896
+ @certfile.unlink
897
+ end
898
+ end
857
899
  end
@@ -1081,4 +1081,131 @@ describe Chef::Provider::Cron do
1081
1081
  end
1082
1082
  end
1083
1083
  end
1084
+
1085
+ describe "#env_var_str" do
1086
+ context "when no env vars are set" do
1087
+ it "returns an empty string" do
1088
+ expect(@provider.send(:env_var_str)).to be_empty
1089
+ end
1090
+ end
1091
+ let(:mailto) { "foo@example.com" }
1092
+ context "When set directly" do
1093
+ it "returns string with value" do
1094
+ @new_resource.mailto mailto
1095
+ expect(@provider.send(:env_var_str)).to include(mailto)
1096
+ end
1097
+ end
1098
+ context "When set within the hash" do
1099
+ context "env properties" do
1100
+ it "returns string with a warning" do
1101
+ @new_resource.environment "MAILTO" => mailto
1102
+ expect(logger).to receive(:warn).with("cronhole some stuff: the environment property contains the 'MAILTO' variable, which should be set separately as a property.")
1103
+ expect(@provider.send(:env_var_str)).to include(mailto)
1104
+ end
1105
+ end
1106
+ context "other properties" do
1107
+ it "returns string with no warning" do
1108
+ @new_resource.environment "FOOMAILTO" => mailto
1109
+ expect(logger).not_to receive(:warn).with("cronhole some stuff: the environment property contains the 'MAILTO' variable, which should be set separately as a property.")
1110
+ expect(@provider.send(:env_var_str)).to include(mailto)
1111
+ end
1112
+ it "and a line break within properties" do
1113
+ @new_resource.environment "FOOMAILTO" => mailto, "BARMAILTO" => mailto
1114
+ expect(@provider.send(:env_var_str)).to eq("FOOMAILTO=foo@example.com\nBARMAILTO=foo@example.com")
1115
+ end
1116
+ end
1117
+ context "both env and other properties" do
1118
+ it "returns string with line break within the properties" do
1119
+ @new_resource.mailto mailto
1120
+ @new_resource.environment "FOOMAILTO" => mailto
1121
+ expect(@provider.send(:env_var_str)).to eq("MAILTO=\"foo@example.com\"\nFOOMAILTO=foo@example.com")
1122
+ end
1123
+ end
1124
+ end
1125
+ end
1126
+
1127
+ describe "#duration_str" do
1128
+ context "time as a frequency" do
1129
+ it "returns string" do
1130
+ @new_resource.time :yearly
1131
+ expect(@provider.send(:duration_str)).to eq("@yearly")
1132
+ end
1133
+ end
1134
+ context "time as a duration" do
1135
+ it "defaults to * (No Specific Value)" do
1136
+ @new_resource.minute "1"
1137
+ expect(@provider.send(:duration_str)).to eq("1 * * * *")
1138
+ end
1139
+ it "returns cron format string" do
1140
+ @new_resource.minute "1"
1141
+ @new_resource.hour "2"
1142
+ @new_resource.day "3"
1143
+ @new_resource.month "4"
1144
+ @new_resource.weekday "5"
1145
+ expect(@provider.send(:duration_str)).to eq("1 2 3 4 5")
1146
+ end
1147
+ end
1148
+ end
1149
+
1150
+ describe "#time_out_str" do
1151
+ context "When not given" do
1152
+ it "Returns an empty string" do
1153
+ expect(@provider.send(:time_out_str)).to be_empty
1154
+ end
1155
+ end
1156
+ context "When given" do
1157
+ let(:time_out_str_val) { " timeout 10;" }
1158
+ context "as String" do
1159
+ it "returns string" do
1160
+ @new_resource.time_out "10"
1161
+ expect(@provider.send(:time_out_str)).to eq time_out_str_val
1162
+ end
1163
+ end
1164
+ context "as Integer" do
1165
+ it "returns string" do
1166
+ @new_resource.time_out "10"
1167
+ expect(@provider.send(:time_out_str)).to eq time_out_str_val
1168
+ end
1169
+ end
1170
+ context "as Hash" do
1171
+ it "returns string" do
1172
+ @new_resource.time_out "duration" => "10"
1173
+ expect(@provider.send(:time_out_str)).to eq time_out_str_val
1174
+ end
1175
+ it "also contains properties" do
1176
+ @new_resource.time_out "duration" => "10", "foreground" => "true", "signal" => "FOO"
1177
+ expect(@provider.send(:time_out_str)).to eq " timeout --foreground --signal FOO 10;"
1178
+ end
1179
+ end
1180
+ end
1181
+ end
1182
+
1183
+ describe "#cmd_str" do
1184
+ context "With command" do
1185
+ let(:cmd) { "FOOBAR" }
1186
+ before {
1187
+ @new_resource.command cmd
1188
+ }
1189
+ it "returns a string with command" do
1190
+ expect(@provider.send(:cmd_str)).to include(cmd)
1191
+ end
1192
+ it "string ends with a next line" do
1193
+ expect(@provider.send(:cmd_str)[-1]).to eq("\n")
1194
+ end
1195
+ end
1196
+ context "Without command, passed" do
1197
+ context "as nil" do
1198
+ it "returns an empty string with a next line" do
1199
+ @new_resource.command nil
1200
+ expect(@provider.send(:cmd_str)).to eq(" \n")
1201
+ end
1202
+ end
1203
+ context "as an empty string" do
1204
+ it "returns an empty string with a next line" do
1205
+ @new_resource.command ""
1206
+ expect(@provider.send(:cmd_str)).to eq(" \n")
1207
+ end
1208
+ end
1209
+ end
1210
+ end
1084
1211
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2017, Chef Software Inc.
1
+ # Copyright:: Copyright 2017-2019, Chef Software Inc.
2
2
  #
3
3
  # License:: Apache License, Version 2.0
4
4
  #
@@ -51,7 +51,7 @@ describe Chef::Provider::User::Aix do
51
51
  end
52
52
 
53
53
  it "should call chpasswd correctly" do
54
- expect(provider).to receive(:shell_out_compacted!).with("echo 'adam:Ostagazuzulum' | chpasswd -e").and_return true
54
+ expect(provider).to receive(:shell_out_compacted!).with("echo 'adam:Ostagazuzulum' | chpasswd -c -e").and_return true
55
55
  provider.manage_user
56
56
  end
57
57
  end
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: 15.6.10
4
+ version: 15.7.30
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 15.6.10
19
+ version: 15.7.30
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: 15.6.10
26
+ version: 15.7.30
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: chef-utils
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 15.6.10
33
+ version: 15.7.30
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 15.6.10
40
+ version: 15.7.30
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: train-core
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -1692,6 +1692,7 @@ files:
1692
1692
  - spec/data/cookbooks/angrybash/metadata.rb
1693
1693
  - spec/data/cookbooks/angrybash/recipes/default.rb
1694
1694
  - spec/data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl
1695
+ - spec/data/cookbooks/apache2/metadata.json
1695
1696
  - spec/data/cookbooks/apache2/metadata.rb
1696
1697
  - spec/data/cookbooks/apache2/recipes/default.rb
1697
1698
  - spec/data/cookbooks/borken/metadata.rb
@@ -1705,6 +1706,7 @@ files:
1705
1706
  - spec/data/cookbooks/ignorken/templates/ubuntu-12.10/not_me.rb
1706
1707
  - spec/data/cookbooks/irssi/files/default/irssi.response
1707
1708
  - spec/data/cookbooks/java/files/default/java.response
1709
+ - spec/data/cookbooks/java/metadata.json
1708
1710
  - spec/data/cookbooks/java/metadata.rb
1709
1711
  - spec/data/cookbooks/name-mismatch-versionnumber/README.md
1710
1712
  - spec/data/cookbooks/name-mismatch-versionnumber/metadata.rb