summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml12
-rw-r--r--CHANGELOG.md8
-rw-r--r--Gemfile.lock10
-rw-r--r--ROADMAP.md11
-rw-r--r--VERSION2
-rw-r--r--chef-config/lib/chef-config/version.rb2
-rw-r--r--lib/chef/provider/ifconfig/debian.rb6
-rw-r--r--lib/chef/resource/ifconfig.rb1
-rw-r--r--lib/chef/resource/macos_userdefaults.rb126
-rw-r--r--lib/chef/resources.rb1
-rw-r--r--lib/chef/version.rb2
-rw-r--r--omnibus_overrides.rb2
-rw-r--r--spec/unit/resource/macos_user_defaults_spec.rb45
13 files changed, 196 insertions, 32 deletions
diff --git a/.travis.yml b/.travis.yml
index db5edab1ad..7f3a518d53 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -61,18 +61,18 @@ matrix:
- env:
UNIT_SPECS_24: 1
rvm: 2.4.3
- sudo: true
+ sudo: false
script:
- - sudo -E $(which bundle) exec rake spec:unit;
- - sudo -E $(which bundle) exec rake component_specs
+ - bundle exec rake spec:unit;
+ - bundle exec rake component_specs
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
- env:
UNIT_SPECS_25: 1
rvm: 2.5.0
- sudo: true
+ sudo: false
script:
- - sudo -E $(which bundle) exec rake spec:unit;
- - sudo -E $(which bundle) exec rake component_specs
+ - bundle exec rake spec:unit;
+ - bundle exec rake component_specs
bundler_args: --without ci docgen guard integration maintenance omnibus_package --frozen
- env:
CHEFSTYLE: 1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 85b9db1568..f47f0d905b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,15 +1,17 @@
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
-<!-- latest_release 14.0.69 -->
-## [v14.0.69](https://github.com/chef/chef/tree/v14.0.69) (2018-02-20)
+<!-- latest_release 14.0.71 -->
+## [v14.0.71](https://github.com/chef/chef/tree/v14.0.71) (2018-02-21)
#### Merged Pull Requests
-- updating paranoid to verify_host_key [#6869](https://github.com/chef/chef/pull/6869) ([tarcinil](https://github.com/tarcinil))
+- Disable sudo on unit tests [#6879](https://github.com/chef/chef/pull/6879) ([lamont-granquist](https://github.com/lamont-granquist))
<!-- latest_release -->
<!-- release_rollup since=13.7.16 -->
### Changes since 13.7.16 release
#### Merged Pull Requests
+- Disable sudo on unit tests [#6879](https://github.com/chef/chef/pull/6879) ([lamont-granquist](https://github.com/lamont-granquist)) <!-- 14.0.71 -->
+- Add macos_user_defaults resource from mac_os_x cookbook [#6878](https://github.com/chef/chef/pull/6878) ([tas50](https://github.com/tas50)) <!-- 14.0.70 -->
- updating paranoid to verify_host_key [#6869](https://github.com/chef/chef/pull/6869) ([tarcinil](https://github.com/tarcinil)) <!-- 14.0.69 -->
- make sure all proxy settings are dealt with [#6875](https://github.com/chef/chef/pull/6875) ([thommay](https://github.com/thommay)) <!-- 14.0.68 -->
- fix chefstyle [#6874](https://github.com/chef/chef/pull/6874) ([thommay](https://github.com/thommay)) <!-- 14.0.67 -->
diff --git a/Gemfile.lock b/Gemfile.lock
index bcee243d5e..b21f28e410 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -35,10 +35,10 @@ GIT
PATH
remote: .
specs:
- chef (14.0.69)
+ chef (14.0.71)
addressable
bundler (>= 1.10)
- chef-config (= 14.0.69)
+ chef-config (= 14.0.71)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -65,10 +65,10 @@ PATH
specinfra (~> 2.10)
syslog-logger (~> 1.6)
uuidtools (~> 2.1.5)
- chef (14.0.69-universal-mingw32)
+ chef (14.0.71-universal-mingw32)
addressable
bundler (>= 1.10)
- chef-config (= 14.0.69)
+ chef-config (= 14.0.71)
chef-zero (>= 13.0)
diff-lcs (~> 1.2, >= 1.2.4)
erubis (~> 2.7)
@@ -110,7 +110,7 @@ PATH
PATH
remote: chef-config
specs:
- chef-config (14.0.69)
+ chef-config (14.0.71)
addressable
fuzzyurl
mixlib-config (~> 2.0)
diff --git a/ROADMAP.md b/ROADMAP.md
deleted file mode 100644
index eeec513a3f..0000000000
--- a/ROADMAP.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Roadmap
-
-This file provides direction for the project as set forth by [RFC030#Roadmap](https://github.com/chef/chef-rfc/blob/master/rfc030-maintenance-policy.md#roadmap).
-
-It is drafted by the Project Lead and the Lieutenants, with input from Maintainers and Contributors.
-
-## 2016 Q1
-* Windows - core windows_feature
- - Move windows_feature from Windows cookbook, add caching
-* Windows - knife windows bootstrap, knife windows winrm in core
- - Migrate Windows bootstrapping functionality into core
diff --git a/VERSION b/VERSION
index d94560bab1..dfdd04d7de 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-14.0.69 \ No newline at end of file
+14.0.71 \ No newline at end of file
diff --git a/chef-config/lib/chef-config/version.rb b/chef-config/lib/chef-config/version.rb
index 2a6b521176..44c07a0d8d 100644
--- a/chef-config/lib/chef-config/version.rb
+++ b/chef-config/lib/chef-config/version.rb
@@ -21,7 +21,7 @@
module ChefConfig
CHEFCONFIG_ROOT = File.expand_path("../..", __FILE__)
- VERSION = "14.0.69"
+ VERSION = "14.0.71"
end
#
diff --git a/lib/chef/provider/ifconfig/debian.rb b/lib/chef/provider/ifconfig/debian.rb
index 369c222b7a..e1e978fdde 100644
--- a/lib/chef/provider/ifconfig/debian.rb
+++ b/lib/chef/provider/ifconfig/debian.rb
@@ -36,11 +36,11 @@ class Chef
<% if new_resource.onboot == "yes" %>auto <%= new_resource.device %><% end %>
<% case new_resource.bootproto
when "dhcp" %>
-iface <%= new_resource.device %> inet dhcp
+iface <%= new_resource.device %> <%= new_resource.family %> dhcp
<% when "bootp" %>
-iface <%= new_resource.device %> inet bootp
+iface <%= new_resource.device %> <%= new_resource.family %> bootp
<% else %>
-iface <%= new_resource.device %> inet static
+iface <%= new_resource.device %> <%= new_resource.family %> static
<% if new_resource.target %>address <%= new_resource.target %><% end %>
<% if new_resource.mask %>netmask <%= new_resource.mask %><% end %>
<% if new_resource.network %>network <%= new_resource.network %><% end %>
diff --git a/lib/chef/resource/ifconfig.rb b/lib/chef/resource/ifconfig.rb
index e9ef47d95b..8c7798566d 100644
--- a/lib/chef/resource/ifconfig.rb
+++ b/lib/chef/resource/ifconfig.rb
@@ -38,6 +38,7 @@ class Chef
property :target, String, name_property: true
property :hwaddr, String
property :mask, String
+ property :family, String, default: "inet"
property :inet_addr, String
property :bcast, String
property :mtu, String
diff --git a/lib/chef/resource/macos_userdefaults.rb b/lib/chef/resource/macos_userdefaults.rb
new file mode 100644
index 0000000000..c0066c84b5
--- /dev/null
+++ b/lib/chef/resource/macos_userdefaults.rb
@@ -0,0 +1,126 @@
+#
+# Copyright:: 2011-2018, Joshua Timberman
+# Copyright:: 2018, Chef Software, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "chef/resource"
+
+class Chef
+ class Resource
+ class MacosUserDefaults < Chef::Resource
+ # align with apple's marketing department
+ resource_name :macos_userdefaults
+ provides :mac_os_x_userdefaults
+ provides :macos_userdefaults
+
+ introduced "14.0"
+
+ description "Use the macos_userdefaults resource to manage the macOS user defaults"\
+ " system. The properties to the resource are passed to the defaults command"\
+ " and the parameters follow convention of the macOS command. See the defaults(1)"\
+ " man page for details on how the tool works."
+
+ property :domain,
+ String,
+ description: "The domain the defaults belong to.",
+ required: true
+
+ property :global,
+ [true, false],
+ description: "Whether the domain is global.",
+ default: false
+
+ property :key,
+ String,
+ description: "The preference key."
+
+ property :value,
+ [Integer, Float, String, true, false, Hash, Array],
+ description: "The value of the key.",
+ coerce: proc { |v| coerce_booleans(v) },
+ required: true
+
+ property :type,
+ String,
+ description: "Value type of the preference key.",
+ default: ""
+
+ property :user,
+ String,
+ description: "User for which to set the default."
+
+ property :sudo,
+ [true, false],
+ description: "Set to true if the setting requires privileged access to modify.",
+ default: false,
+ desired_state: false
+
+ property :is_set,
+ [true, false],
+ description: "",
+ default: false,
+ desired_state: false
+
+ # coerce various ways of representing a boolean into either 0 (false) or 1 (true)
+ # which is what the defaults CLI expects. Why? Well defaults itself accepts a few
+ # different formats, but when you do a read command it all comes back as 1 or 0.
+ def coerce_booleans(val)
+ return 1 if [true, "TRUE", "1", "true", "YES", "yes"].include?(val)
+ return 0 if [false, "FALSE", "0", "false", "NO", "no"].include?(val)
+ val
+ end
+
+ load_current_value do |desired|
+ drcmd = "defaults read '#{desired.domain}' "
+ drcmd << "'#{desired.key}' " if desired.key
+ shell_out_opts = {}
+ shell_out_opts[:user] = desired.user unless desired.user.nil?
+ vc = shell_out("#{drcmd} | grep -qx '#{desired.value}'", shell_out_opts)
+ is_set vc.exitstatus == 0 ? true : false
+ end
+
+ action :write do
+ description "Write the setting to the specified domain"
+
+ unless current_value.is_set
+ cmd = ["defaults write"]
+ cmd.unshift("sudo") if new_resource.sudo
+
+ cmd << if new_resource.global
+ "NSGlobalDomain"
+ else
+ "'#{new_resource.domain}'"
+ end
+
+ cmd << "'#{new_resource.key}'" if new_resource.key
+ value = new_resource.value
+ type = new_resource.type.empty? ? value_type(value) : new_resource.type
+ # creates a string of Key1 Value1 Key2 Value2...
+ value = value.map { |k, v| "\"#{k}\" \"#{v}\"" }.join(" ") if type == "dict"
+ if type == "array"
+ value = value.join("' '")
+ value = "'#{value}'"
+ end
+ cmd << "-#{type}" if type
+ cmd << value
+
+ declare_resource(:execute, cmd.join(" ")) do
+ user new_resource.user unless new_resource.user.nil?
+ end
+ end
+ end
+ end
+ end
+end
diff --git a/lib/chef/resources.rb b/lib/chef/resources.rb
index 60f3ad51f0..c10bf98b2f 100644
--- a/lib/chef/resources.rb
+++ b/lib/chef/resources.rb
@@ -49,6 +49,7 @@ require "chef/resource/launchd"
require "chef/resource/link"
require "chef/resource/log"
require "chef/resource/macports_package"
+require "chef/resource/macos_userdefaults"
require "chef/resource/mdadm"
require "chef/resource/mount"
require "chef/resource/ohai"
diff --git a/lib/chef/version.rb b/lib/chef/version.rb
index 31803dbe97..8d8e5151c5 100644
--- a/lib/chef/version.rb
+++ b/lib/chef/version.rb
@@ -23,7 +23,7 @@ require "chef/version_string"
class Chef
CHEF_ROOT = File.expand_path("../..", __FILE__)
- VERSION = Chef::VersionString.new("14.0.69")
+ VERSION = Chef::VersionString.new("14.0.71")
end
#
diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb
index 8da7dc9940..e40a322775 100644
--- a/omnibus_overrides.rb
+++ b/omnibus_overrides.rb
@@ -8,7 +8,7 @@ override "libffi", version: "3.2.1"
override "libiconv", version: "1.15"
override "liblzma", version: "5.2.3"
override "libtool", version: "2.4.2"
-override "libxml2", version: "2.9.5"
+override "libxml2", version: "2.9.7"
override "libxslt", version: "1.1.30"
override "libyaml", version: "0.1.7"
override "makedepend", version: "1.0.5"
diff --git a/spec/unit/resource/macos_user_defaults_spec.rb b/spec/unit/resource/macos_user_defaults_spec.rb
new file mode 100644
index 0000000000..6ef82853cc
--- /dev/null
+++ b/spec/unit/resource/macos_user_defaults_spec.rb
@@ -0,0 +1,45 @@
+#
+# Copyright:: Copyright 2018, Chef Software, Inc.
+# License:: Apache License, Version 2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+require "spec_helper"
+
+describe Chef::Resource::MacosUserDefaults do
+
+ let(:resource) { Chef::Resource::MacosUserDefaults.new("foo") }
+
+ it "has a resource name of :macos_userdefaults" do
+ expect(resource.resource_name).to eql(:macos_userdefaults)
+ end
+
+ it "has a default action of install" do
+ expect(resource.action).to eql([:write])
+ end
+
+ [true, "TRUE", "1", "true", "YES", "yes"].each do |val|
+ it "coerces value property from #{val} to 1" do
+ resource.value val
+ expect(resource.value).to eql(1)
+ end
+ end
+
+ [false, "FALSE", "0", "false", "NO", "no"].each do |val|
+ it "coerces value property from #{val} to 0" do
+ resource.value val
+ expect(resource.value).to eql(0)
+ end
+ end
+end