This commit is contained in:
Eric Hanko 2018-04-25 13:39:58 -07:00 коммит произвёл Jacob Zaval
Родитель 465c29d5f7
Коммит f5d46b602d
4 изменённых файлов: 18 добавлений и 4 удалений

Просмотреть файл

@ -65,7 +65,7 @@ to always keep macOS on and available.
| `node['macos']['time_zone']` | `'America/Los_Angeles'` |
**N.b.** When ChefSpec testing implementations of this recipe, the `node['hardware']['machine_model']`
attribute needs to be set to a Mac model identifier, e.g. `MacMini6,2`, in order
attribute needs to be set to a Mac model identifier, e.g. `MacMini6,2`, in order
for tests to pass:
```ruby

Просмотреть файл

@ -2,8 +2,17 @@ module MacOS
module SoftwareUpdates
def updates_available?
no_new_software_pattern = Regexp.union('No new software available.')
command = shell_out('softwareupdate', '--list', '--all')
command.stderr.chomp.match?(no_new_software_pattern)
available_updates_command = shell_out(software_update_command, '--list', '--all')
available_updates_command.stderr.chomp.match?(no_new_software_pattern)
end
def automatic_check_disabled?
schedule_check_command = shell_out(software_update_command, '--schedule')
schedule_check_command.stdout.chomp == 'Automatic check is off'
end
def software_update_command
'/usr/sbin/softwareupdate'
end
end
end

Просмотреть файл

@ -5,7 +5,7 @@ license 'MIT'
description 'Resources for configuring and provisioning macOS'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
chef_version '>= 13.0' if respond_to?(:chef_version)
version '1.13.0'
version '1.13.1'
source_url 'https://github.com/Microsoft/macos-cookbook'
issues_url 'https://github.com/Microsoft/macos-cookbook/issues'

Просмотреть файл

@ -11,3 +11,8 @@ plist 'disable automatic software update check' do
entry 'AutomaticCheckEnabled'
value false
end
execute 'disable software updates using commandline utility' do
command [software_update_command, '--schedule', 'off']
not_if { automatic_check_disabled? }
end