Release/2.6 (#147)
* added 2.3 changes to changelog * added more to changelog * added more to the changelog * version bump * added smoke test for ard.rb resource * updated xcode version to 10.0 in default.rb * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * update to test cookbook xcode.rb to include mojave * update xcode.rb for mojave support * use default xcode recipe for testing * regex for platforms supporting the current Xcode * add remote access suite, create test recipe for ard, implement smoke test * update ard resource default action, and control * add el cap * update inspec tests * improve the ARD smoke test * Use more meaningful values instead of magic numbers (#139) * - Add definitions for each of the kickstarter bits, except for observe_only bit 8 - Use the definitions for the test * Respond to PR comments and clean up inspec matchers * remove unneeded tests * add a test for activation check * update title and description of remote-control control * remove live_stream option * update to changelog (#140) * updated CHANGELOG.md with 1.9-1.13 * add 1.6-1.8 to changelog * add 1.2-1.5 to changelog * remove extra lines and 2.5 template * remove extra 2.4 header * Prevent additional Command Line Tools from appearing in softwareupdate (#143) * delete sentinel file after CLT install * update spec with output from Mojave * update expectation * add method to determine macos version * refactor available method name * add method to install latest platform specific clt * add integration test to verify bug 142 is resolved * run new control * add spec test for high sierra * detect platform specific CLT with the highest Xcode version * stub swu output instead of available * test and expect Xcode 10 instead of 9.4.1 * use new xcode list from Apple, fix find and replace typo * Add deprecation notice for the machine_name resource (#146) * updated changelog * update high sierra boxes to latest (#148) * fix foodcritic issue 009 with spotlight resource * remove xcode-beta suite. see ya next year, WWDC * update changelog with cinsistency * update mojave box version
This commit is contained in:
Родитель
74177c45c3
Коммит
39287f41c6
34
.kitchen.yml
34
.kitchen.yml
|
@ -16,6 +16,7 @@ verifier:
|
|||
- test/integration/default
|
||||
|
||||
platforms:
|
||||
|
||||
- name: el-capitan-chef13
|
||||
driver:
|
||||
box: microsoft/os-x-el-capitan
|
||||
|
@ -47,14 +48,28 @@ platforms:
|
|||
- name: high-sierra-chef13
|
||||
driver:
|
||||
box: microsoft/macos-high-sierra
|
||||
version: 10.13.5
|
||||
version: 10.13.6-v2
|
||||
provisioner:
|
||||
product_version: 13
|
||||
|
||||
- name: high-sierra-chef14
|
||||
driver:
|
||||
box: microsoft/macos-high-sierra
|
||||
version: 10.13.5
|
||||
version: 10.13.6-v2
|
||||
provisioner:
|
||||
product_version: 14
|
||||
|
||||
- name: mojave-chef13
|
||||
driver:
|
||||
box: microsoft/macos-mojave
|
||||
version: 10.14.01
|
||||
provisioner:
|
||||
product_version: 13
|
||||
|
||||
- name: mojave-chef14
|
||||
driver:
|
||||
box: microsoft/macos-mojave
|
||||
version: 10.14.01
|
||||
provisioner:
|
||||
product_version: 14
|
||||
|
||||
|
@ -100,13 +115,7 @@ suites:
|
|||
verifier:
|
||||
controls:
|
||||
- xcode-and-simulators
|
||||
|
||||
- name: xcode-beta
|
||||
run_list:
|
||||
- recipe[macos_test::xcode_beta]
|
||||
verifier:
|
||||
controls:
|
||||
- xcode-beta
|
||||
- command-line-tool-sentinel
|
||||
|
||||
- name: certificate
|
||||
run_list:
|
||||
|
@ -139,3 +148,10 @@ suites:
|
|||
- keychain-creation
|
||||
- login-keychain-creation
|
||||
- default-keychain-creation
|
||||
|
||||
- name: remote-access
|
||||
run_list:
|
||||
- recipe[macos_test::remote_access]
|
||||
verifier:
|
||||
controls:
|
||||
- remote-control
|
||||
|
|
134
CHANGELOG.md
134
CHANGELOG.md
|
@ -1,8 +1,25 @@
|
|||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [2.6.0] - 2018-10-03
|
||||
### Added
|
||||
- Apple has limited some kickstart command functionality in macOS Mojave, preventing screen
|
||||
control in some invocations. We verified the `ard` resource's implementation of the `kickstart` script still functions.
|
||||
|
||||
- Updated Xcode default version to 10.0.
|
||||
|
||||
- The team crossed the great Mojave Desert, collapsed from dehydration, all just to obtain its support. In other words we now support macOS Mojave.
|
||||
|
||||
### Fixed
|
||||
- Prevented the `xcode` resource from leaving available Command Line Tools downloads
|
||||
in Software Updates.
|
||||
|
||||
### Deprecated
|
||||
- The `machine_name` resource has been deprecated in favor of the macOS support in the `hostname` resource in Chef 14. It will be removed in the release of v3.0 of the macOS cookbook.
|
||||
|
||||
## [2.5.0] - 2018-09-10
|
||||
### Added
|
||||
- Added `CHANGELOG.md`, About time right? ([Issue #122](https://github.com/Microsoft/macos-cookbook/issues/122)).
|
||||
- Added functional `path` property to Xcode resource. ([Issue #116](https://github.com/Microsoft/macos-cookbook/issues/116)).
|
||||
- Added ChefSpec resource tests for Xcode.
|
||||
|
||||
|
@ -20,3 +37,120 @@ CommandLineTools libraries.
|
|||
### Fixed
|
||||
- Fixed `keychain` resource documentation link.
|
||||
- Update `metadata_util` library to consider Spotlight server status before manipulating indexing state. ([Issue #45](https://github.com/Microsoft/macos-cookbook/issues/45)).
|
||||
|
||||
## [2.3.0] - 2018-06-28
|
||||
### Added
|
||||
- Like a trained ninja of the night, the `macos_user` now has a `hidden` property, making it impossible to detect from the login screen.
|
||||
- Moved to a new set of internal Vagrant macOS boxes, which have much more minimal initial configuration. This ensures that our resources run from a more out-of-the-box macOS experience.
|
||||
|
||||
### Fixed
|
||||
- Fixed bug where deletion of a user was failing when using the macos_user resource.
|
||||
- For those of you who like to set their user and password as the same characters, we fixed an issue in the certificate resource for non-Vagrant use cases, you know for normal human beings who like a secure environment.
|
||||
|
||||
## [2.2.0] - 2018-05-29
|
||||
### Added
|
||||
- Foodcritics can be pretty harsh in their critiquing of food. They also have some pretty in depth rules we need to comply with, so we updated machine_name to comply with the new FoodCritic rule FC115.
|
||||
- Added guard config to automatically run relevant unit tests when a file is changed.
|
||||
- Update to InSpec control filenames to match the standard. This allows for better understanding of the tests.
|
||||
|
||||
## [2.1.0] - 2018-05-16
|
||||
### Added
|
||||
- Created an autologin functionality on 10.13.4 to allow for machine to automatically login to the machine.
|
||||
|
||||
## [2.0.0] - 2018-05-09
|
||||
### Removed
|
||||
- Removed the Mono recipe as it is not in the scope of this cookbook.
|
||||
- Removed Apple Configurator recipe as a bug with the `mas` dependency does not function in High Sierra.
|
||||
|
||||
## [1.14.0] - 2018-05-01
|
||||
### Added
|
||||
- Updated the `keep_awake` recipe and spec tests to not require node attribute stubbing when wrapped in another cookbook.
|
||||
|
||||
## [1.13.0] - 2018-04-25
|
||||
### Added
|
||||
- Added a CONTRIBUTING.md to outline the Chef Community Guidelines for code contribution.
|
||||
|
||||
### Fixed
|
||||
- Fixed an issue with ChefSpec when wrapping the `keep_awake` recipe.
|
||||
- Fixed an idempotence issue with the keychain resource.
|
||||
|
||||
## [1.12.0] - 2018-04-16
|
||||
### Added
|
||||
- Added new keychain resource
|
||||
- Introduced three new library classes `Power`, `Environment`, and `ScreenSaver`.
|
||||
- Updated README.md to reflect single build definition.
|
||||
- Added feature to make disk sleep default to `Never`.
|
||||
|
||||
## [1.11.0] - 2018-04-11
|
||||
### Added
|
||||
- Added the ability to install Xcode beta builds to the `xcode` resource.
|
||||
- Added support for Chef 14.
|
||||
|
||||
## [1.10.0] - 2018-03-26
|
||||
### Added
|
||||
- Added feature that allows node attributes to be set for Developer Apple ID credentials while downloading Xcode from Apple.
|
||||
- Added ability to install Command Line tools from the `xcode-install` gem.
|
||||
|
||||
### Fixed
|
||||
- Increased timeout for Xcode download for issue where method `bundle_version_correct` fails and unsuccessfully tries to access node attributes in Xcode library.
|
||||
- Resolved issue where adding users and groups would fail tests.
|
||||
|
||||
## [1.9.0] - 2018-03-21
|
||||
### Added
|
||||
- Added support for other hypervisors and keep away logic.
|
||||
- Implemented `-t` option in `certificate` resource to allow apps to access imported key.
|
||||
- Add `utf-8` encoding type to `plist` resource to make it more robust.
|
||||
|
||||
## [1.8.0] - 2018-03-12
|
||||
### Added
|
||||
- Added a `dns_domain` property to `machine_name` resource to support FQDNs.
|
||||
- Added TESTING.md documentation.
|
||||
- Changed `binary` property to `encoding` to support xml and binary plist formats.
|
||||
|
||||
### Removed
|
||||
- Removed support for `NetBIOSName` due to macOS bugs.
|
||||
|
||||
### Fixed
|
||||
- Fixed several bugs in `plist` resource.
|
||||
- Fixed typos in `machine_name` resource documentation.
|
||||
|
||||
## [1.7.0] - 2018-03-05
|
||||
### Added
|
||||
- Added the `certificate` resource, this resource manages the state of a given certificate for a specified keychain.
|
||||
|
||||
## [1.6.0] - 2018-02-20
|
||||
### Added
|
||||
- Added whitespace support for property list names and keys.
|
||||
|
||||
### Fixed
|
||||
- Fixed some depreciation bugs in the `macos_user` resource.
|
||||
- Fixed idempotency bug in `.kitchen.yml`.
|
||||
|
||||
## [1.5.0] - 2018-02-12
|
||||
### Added
|
||||
- Added new `system_preference` resource.
|
||||
|
||||
### Removed
|
||||
- Removed `systemsetup` resource.
|
||||
- Removed `.delivery` in favor of `kitchen test` and concurrency testing model.
|
||||
|
||||
### Fixed
|
||||
- Fixed issue where `plist` resources cause incomplete idempotence on second converge by making the `keep_awake` recipe idempotent. ([Issue #15](https://github.com/Microsoft/macos-cookbook/issues/15)).
|
||||
- Fixed issue where `macos_user` was not allowing users to be added to groups by creating a new `groups` property. ([Issue #40](https://github.com/Microsoft/macos-cookbook/issues/40)).
|
||||
- Fixed issue where `machine_name` resource does not set `LocalHostName` by making `machine_name` idempotent and having it properly set the `LocalHostName`. ([Issue #20](https://github.com/Microsoft/macos-cookbook/issues/20)).
|
||||
|
||||
## [1.3.0] - 2018-02-02
|
||||
### Added
|
||||
- Added helper modules for `systemsetup`.
|
||||
- Added new attributes to adjust the `keep_awake` functions.
|
||||
- Added better functionality to the `keep_awake` power resources.
|
||||
|
||||
### [1.2.0] - 2018-01-28
|
||||
### Added
|
||||
- Initial release of the macOS Cookbook.
|
||||
- Chef support for 10.10 to 10.13.
|
||||
- Added `xcode` resource.
|
||||
- Added `keep_awake` recipe.
|
||||
- Added `spotlight` resource.
|
||||
- Added `machine_name` resource.
|
||||
- Added `macos_user` resource.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
default['macos']['admin_user'] = 'vagrant'
|
||||
default['macos']['admin_password'] = 'vagrant'
|
||||
|
||||
default['macos']['xcode']['version'] = '9.4.1'
|
||||
default['macos']['xcode']['version'] = '10.0'
|
||||
|
||||
default['macos']['remote_login_enabled'] = true
|
||||
|
||||
|
|
|
@ -9,17 +9,34 @@ module MacOS
|
|||
FileUtils.touch install_sentinel
|
||||
FileUtils.chown 'root', 'wheel', install_sentinel
|
||||
|
||||
@version = if available_command_line_tools.empty?
|
||||
@version = if available.empty?
|
||||
'Unavailable from Software Update Catalog'
|
||||
else
|
||||
available_command_line_tools.last.tr('*', '').strip
|
||||
latest.tr('*', '').strip
|
||||
end
|
||||
end
|
||||
|
||||
def available_command_line_tools
|
||||
def latest
|
||||
versions = platform_specific.map { |product| Gem::Version.new xcode_version(product) }
|
||||
platform_specific.detect { |product| product.include? versions.max.version }
|
||||
end
|
||||
|
||||
def platform_specific
|
||||
available.select { |product_name| product_name.include? macos_version }
|
||||
end
|
||||
|
||||
def available
|
||||
softwareupdate_list.select { |product_name| product_name.include?('* Command Line Tools') }
|
||||
end
|
||||
|
||||
def xcode_version(product)
|
||||
product.match(/Xcode-(?<version>\d+\.\d+)/)['version']
|
||||
end
|
||||
|
||||
def macos_version
|
||||
shell_out(['/usr/bin/sw_vers', '-productVersion']).stdout.chomp[/10\.\d+/]
|
||||
end
|
||||
|
||||
def softwareupdate_list
|
||||
shell_out(['softwareupdate', '--list']).stdout.lines
|
||||
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 '2.5.0'
|
||||
version '2.6.0'
|
||||
|
||||
source_url 'https://github.com/Microsoft/macos-cookbook'
|
||||
issues_url 'https://github.com/Microsoft/macos-cookbook/issues'
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if node['platform_version'].match? Regexp.union '10.13'
|
||||
if node['platform_version'].match? Regexp.union /10.14|10.13/
|
||||
execute 'Disable Gatekeeper' do
|
||||
command ['spctl', '--master-disable']
|
||||
end
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
resource_name :ard
|
||||
default_action %i(activate configure)
|
||||
|
||||
BASE_COMMAND = '/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart'.freeze
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
resource_name :machine_name
|
||||
|
||||
deprecated 'The `machine_name` resource is deprecated, and will be removed in the release of v3.0 of the macOS cookbook.'
|
||||
|
||||
property :hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }, name_property: true
|
||||
property :computer_name, String, desired_state: true
|
||||
property :local_hostname, String, desired_state: true, coerce: proc { |name| conform_to_dns_standards(name) }
|
||||
|
|
|
@ -34,8 +34,8 @@ end
|
|||
action :set do
|
||||
volume = MetadataUtil.new(target_volume)
|
||||
|
||||
service 'spotlight server' do
|
||||
service_name 'mds'
|
||||
macosx_service 'metadata server' do
|
||||
service_name 'com.apple.metadata.mds'
|
||||
plist '/System/Library/LaunchDaemons/com.apple.metadata.mds.plist'
|
||||
action [:enable, :start]
|
||||
end
|
||||
|
|
|
@ -14,6 +14,10 @@ action :install_gem do
|
|||
live_stream true
|
||||
end
|
||||
|
||||
file '/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress' do
|
||||
action :delete
|
||||
end
|
||||
|
||||
chef_gem 'xcode-install' do
|
||||
options('--no-document --no-user-install')
|
||||
end
|
||||
|
|
|
@ -2,23 +2,57 @@ require 'spec_helper'
|
|||
include MacOS
|
||||
|
||||
describe MacOS::CommandLineTools do
|
||||
context 'when provided an available list of software update products' do
|
||||
context 'when provided an available list of software update products in Mojave' do
|
||||
before do
|
||||
allow(FileUtils).to receive(:touch).and_return(true)
|
||||
allow(FileUtils).to receive(:chown).and_return(true)
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:macos_version)
|
||||
.and_return('10.14')
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:softwareupdate_list)
|
||||
.and_return(["Software Update Tool\n",
|
||||
"Finding available software\n",
|
||||
"\n", "Finding available software\n",
|
||||
"Software Update found the following new or updated software:\n",
|
||||
" * Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2\n",
|
||||
"\tCommand Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.2\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.2), 177376K [recommended]\n"]
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (10.0), 190520K [recommended]\n",
|
||||
" * Command Line Tools (macOS Mojave version 10.14) for Xcode-10.0\n",
|
||||
"\tCommand Line Tools (macOS Mojave version 10.14) for Xcode (10.0), 187321K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.3\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.3), 187312K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.4), 187380K [recommended]\n"]
|
||||
)
|
||||
end
|
||||
it 'returns the latest recommended Command Line Tools product' do
|
||||
clt = MacOS::CommandLineTools.new
|
||||
expect(clt.version).to eq 'Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.2'
|
||||
expect(clt.version).to eq 'Command Line Tools (macOS Mojave version 10.14) for Xcode-10.0'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when provided an available list of software update products in High Sierra' do
|
||||
before do
|
||||
allow(FileUtils).to receive(:touch).and_return(true)
|
||||
allow(FileUtils).to receive(:chown).and_return(true)
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:macos_version)
|
||||
.and_return('10.13')
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:softwareupdate_list)
|
||||
.and_return(["Software Update Tool\n",
|
||||
"\n", "Finding available software\n",
|
||||
"Software Update found the following new or updated software:\n",
|
||||
" * Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2\n",
|
||||
"\tCommand Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (10.0), 190520K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.3\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.3), 187312K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.4), 187380K [recommended]\n"]
|
||||
)
|
||||
end
|
||||
it 'returns the latest recommended Command Line Tools product' do
|
||||
clt = MacOS::CommandLineTools.new
|
||||
expect(clt.version).to eq 'Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,12 +10,27 @@ describe 'xcode' do
|
|||
before(:each) do
|
||||
allow_any_instance_of(MacOS::DeveloperAccount).to receive(:authenticate_with_apple)
|
||||
.and_return(true)
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:available_command_line_tools)
|
||||
.and_return([" * Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2\n",
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:macos_version)
|
||||
.and_return('10.13')
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:softwareupdate_list)
|
||||
.and_return(["Software Update Tool\n",
|
||||
"\n", "Finding available software\n",
|
||||
"Software Update found the following new or updated software:\n",
|
||||
" * Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2\n",
|
||||
"\tCommand Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (10.0), 190520K [recommended]\n",
|
||||
" * Command Line Tools (macOS Mojave version 10.14) for Xcode-10.0\n",
|
||||
"\tCommand Line Tools (macOS Mojave version 10.14) for Xcode (10.0), 187321K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.3\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4\n"])
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.3), 187312K [recommended]\n",
|
||||
" * Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4\n",
|
||||
"\tCommand Line Tools (macOS High Sierra version 10.13) for Xcode (9.4), 187380K [recommended]\n"]
|
||||
)
|
||||
allow(MacOS::XCVersion).to receive(:available_versions)
|
||||
.and_return(["4.3 for Lion\n",
|
||||
.and_return(["10\n",
|
||||
"10.1 beta 2\n",
|
||||
"4.3 for Lion\n",
|
||||
"4.3.1 for Lion\n",
|
||||
"4.3.2 for Lion\n",
|
||||
"4.3.3 for Lion\n",
|
||||
|
@ -62,10 +77,9 @@ describe 'xcode' do
|
|||
"9.1\n",
|
||||
"9.2\n",
|
||||
"9.3\n",
|
||||
"9.3.1\n",
|
||||
"9.4\n",
|
||||
"9.4.1\n",
|
||||
"9.4.2 beta\n",
|
||||
"10 GM seed\n"]
|
||||
"9.4.1\n"]
|
||||
)
|
||||
allow(File).to receive(:exist?).and_call_original
|
||||
allow(FileUtils).to receive(:touch).and_return(true)
|
||||
|
@ -82,15 +96,15 @@ describe 'xcode' do
|
|||
end
|
||||
|
||||
recipe do
|
||||
xcode '9.4.1'
|
||||
xcode '10.0'
|
||||
end
|
||||
|
||||
it { is_expected.to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4') }
|
||||
it { is_expected.to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0') }
|
||||
|
||||
it { is_expected.to run_execute('install Xcode 9.4.1') }
|
||||
it { is_expected.to run_execute('install Xcode 10') }
|
||||
it { is_expected.to delete_link('/Applications/Xcode.app') }
|
||||
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-9.4.1.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-10.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('switch active Xcode to /Applications/Xcode.app') }
|
||||
end
|
||||
|
||||
|
@ -104,58 +118,58 @@ describe 'xcode' do
|
|||
end
|
||||
|
||||
recipe do
|
||||
xcode '9.4.1'
|
||||
xcode '10.0'
|
||||
end
|
||||
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4') }
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0') }
|
||||
|
||||
it { is_expected.to run_execute('install Xcode 9.4.1') }
|
||||
it { is_expected.to run_execute('install Xcode 10') }
|
||||
it { is_expected.to delete_link('/Applications/Xcode.app') }
|
||||
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-9.4.1.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-10.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('switch active Xcode to /Applications/Xcode.app') }
|
||||
end
|
||||
|
||||
context 'with requested Xcode installed, and with CLT installed' do
|
||||
before(:each) do
|
||||
allow(MacOS::XCVersion).to receive(:installed_xcodes)
|
||||
.and_return([{ '9.4.1' => '/Applications/Xcode.app' }])
|
||||
.and_return([{ '10.0' => '/Applications/Xcode.app' }])
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:installed?)
|
||||
.and_return(true)
|
||||
stub_command('test -L /Applications/Xcode.app').and_return(false)
|
||||
end
|
||||
|
||||
recipe do
|
||||
xcode '9.4.1'
|
||||
xcode '10.0'
|
||||
end
|
||||
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4') }
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0') }
|
||||
|
||||
it { is_expected.not_to run_execute('install Xcode 9.4.1') }
|
||||
it { is_expected.not_to run_execute('install Xcode 10') }
|
||||
it { is_expected.not_to delete_link('/Applications/Xcode.app') }
|
||||
|
||||
it { is_expected.not_to run_execute('move /Applications/Xcode-9.4.1.app to /Applications/Xcode.app') }
|
||||
it { is_expected.not_to run_execute('move /Applications/Xcode-10.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('switch active Xcode to /Applications/Xcode.app') }
|
||||
end
|
||||
|
||||
context 'with requested Xcode installed at a different path, and with CLT present' do
|
||||
before(:each) do
|
||||
allow(MacOS::XCVersion).to receive(:installed_xcodes)
|
||||
.and_return([{ '9.4.1' => '/Applications/Some_Weird_Path.app' }])
|
||||
.and_return([{ '10.0' => '/Applications/Some_Weird_Path.app' }])
|
||||
allow_any_instance_of(MacOS::CommandLineTools).to receive(:installed?)
|
||||
.and_return(true)
|
||||
stub_command('test -L /Applications/Xcode.app').and_return(false)
|
||||
end
|
||||
|
||||
recipe do
|
||||
xcode '9.4.1' do
|
||||
xcode '10.0' do
|
||||
path '/Applications/Chef_Managed_Xcode.app'
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4') }
|
||||
it { is_expected.not_to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0') }
|
||||
|
||||
it { is_expected.not_to run_execute('install Xcode 9.4.1') }
|
||||
it { is_expected.not_to run_execute('install Xcode 10') }
|
||||
it { is_expected.not_to delete_link('/Applications/Xcode.app') }
|
||||
|
||||
it { is_expected.to run_execute('move /Applications/Some_Weird_Path.app to /Applications/Chef_Managed_Xcode.app') }
|
||||
|
@ -172,17 +186,17 @@ describe 'xcode' do
|
|||
end
|
||||
|
||||
recipe do
|
||||
xcode '9.4.1' do
|
||||
xcode '10.0' do
|
||||
path '/Applications/Xcode.app'
|
||||
end
|
||||
end
|
||||
|
||||
it { is_expected.to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.4') }
|
||||
it { is_expected.to run_execute('install Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.0') }
|
||||
|
||||
it { is_expected.to run_execute('install Xcode 9.4.1') }
|
||||
it { is_expected.to run_execute('install Xcode 10') }
|
||||
it { is_expected.to delete_link('/Applications/Xcode.app') }
|
||||
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-9.4.1.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('move /Applications/Xcode-10.app to /Applications/Xcode.app') }
|
||||
it { is_expected.to run_execute('switch active Xcode to /Applications/Xcode.app') }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
ard 'activate and configure remote management for all users'
|
|
@ -1,13 +1 @@
|
|||
if node['platform_version'].match? Regexp.union '10.13'
|
||||
include_recipe 'macos::xcode'
|
||||
|
||||
elsif node['platform_version'].match? Regexp.union '10.12'
|
||||
xcode '9.2' do
|
||||
ios_simulators %w(11 10)
|
||||
end
|
||||
|
||||
elsif node['platform_version'].match? Regexp.union '10.11'
|
||||
xcode '8.2.1' do
|
||||
ios_simulators %w(10 9)
|
||||
end
|
||||
end
|
||||
include_recipe 'macos::xcode'
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
execute 'Disable Gatekeeper' do
|
||||
command ['spctl', '--master-disable']
|
||||
end
|
||||
|
||||
xcode '10.0' if node['platform_version'].match? Regexp.union '10.13'
|
|
@ -0,0 +1,34 @@
|
|||
title 'remote access'
|
||||
|
||||
# user_has_access = 1 << 31
|
||||
text_messages = 1 << 0
|
||||
control_observe = 1 << 1
|
||||
send_files = 1 << 2
|
||||
delete_files = 1 << 3
|
||||
generate_reports = 1 << 4
|
||||
open_quit_apps = 1 << 5
|
||||
change_settings = 1 << 6
|
||||
restart_shutdown = 1 << 7
|
||||
# observe_only = 1 << 8
|
||||
show_observe = 1 << 30
|
||||
|
||||
all_privileges = text_messages | control_observe | send_files |
|
||||
delete_files | generate_reports | open_quit_apps |
|
||||
change_settings | restart_shutdown | show_observe
|
||||
|
||||
control 'remote-control' do
|
||||
title 'ensure that remote access and control will function'
|
||||
desc "ensure that the Remote Management plist grants local users access, that
|
||||
all privileges are granted based on the mask #{all_privileges}, and that
|
||||
remote control is enabled"
|
||||
|
||||
describe command('/usr/libexec/PlistBuddy -c Print /Library/Preferences/com.apple.RemoteManagement.plist') do
|
||||
its('stdout') { should match 'ARD_AllLocalUsers = true' }
|
||||
its('stdout') { should match /#{all_privileges}/ }
|
||||
end
|
||||
|
||||
describe file('/Library/Application Support/Apple/Remote Desktop/RemoteManagement.launchd') do
|
||||
it { should exist }
|
||||
its('content') { should match 'enabled' }
|
||||
end
|
||||
end
|
|
@ -41,3 +41,18 @@ control 'xcode-beta' do
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
control 'command-line-tool-sentinel' do
|
||||
title 'Command Line Tools sentinel has been deleted'
|
||||
desc '
|
||||
Verify that the Command Line Tools sentinel has been deleted, and that
|
||||
there are no lingering CLT updates since we should have installed the latest
|
||||
'
|
||||
describe file('/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress') do
|
||||
it { should_not exist }
|
||||
end
|
||||
|
||||
describe command('/usr/sbin/softwareupdate --list') do
|
||||
its('stdout') { should_not include 'Command Line Tools' }
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче