macos-cookbook/libraries/remote_management.rb

40 строки
1.2 KiB
Ruby
Исходник Обычный вид История

Release/3.0 (#193) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * Add deprecation notice for the machine_name resource (#146) * bump version to 3.0 for release branch * Drop chef13 support in .kitchen.yml * Remove machine_name resource in favor of hostname resource in Chef14 (#145) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * update inspec tests * remove live_stream option * Remove machine name custom resource and related tests * Add deprecation notice for the machine_name resource (#146) * Add spotlight spec test * Add back el-cap chef14 platform in .kitchen.yml * Release 3.0 will not support Chef 13 if this change is implemented * Remove El Capitan support Linting - Remove machine_name resource in favor of hostname resource in Chef14 (#145) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * update inspec tests * remove live_stream option * Remove machine name custom resource and related tests * Add deprecation notice for the machine_name resource (#146) * Add spotlight spec test * Add back el-cap chef14 platform in .kitchen.yml * Release 3.0 will not support Chef 13 if this change is implemented - Remove El Capitan support - Remove useless assignment in security_test - Enable password hash unit test - Markdown linting - Fix headers - Remove dollar signs from code blocks that do not include output - Update 10.13.3 to 10.13.6 * Bump supported Chef version in metadata.rb to 14 * Remove machine_name resource documentation * Add Azure Pipelines YAML (#185) * Remove duplicate .gitignore from test cookbook * Add azure-pipelines YAML with Chef unit/lint job * Add suites and update kitchen.yml name * Add pipelines YAML to chefignore * Add parameter input for kitchenFile * Remove branch ref for templates repository * Remove Xcode recipe, tests, and documentation (#187) * Remove default recipe and fix ChefSpec test for disable_software_updates recipe (#186) * Delete default recipe and related spec * Fix failing ChefSpec test for disable_software_updates recipe * remove default Xcode version attribute * set test recipe Xcode version * Remove disable_software_updates recipe, related tests, and documentation (#188) * update mailmap * create readme and resource for macos_automatic_software_updates * remove vagrant.rb * change name of resource to automatic_software_updates * add new automatic_software_updates resource * add spec test for automatic_software_updates * change name of resource * group under one action block * update spec test to check for app_store * update property names * update property names in resource * update property name in spec test * update value entry to recieve user inputed property * add block to test both true and false * Add Action description to software_update.md * spec tests with seperate it blocks, work in progress * uploaded some working tests * update resource to pass spec tests * make path to software update plist a variable * lint and beautify * create app store plist variable * add test cases for error handling * add exception handling for spec test cases * add error handling to resource to check against bad configs * add disable_software_updates.rb * update software_updates_test.rb to include all resource values * make software-update test suite idempotent * add more content to resource_software_update.md documentation * update documentation name * remove old file * add example to documentation * remove disable_software_update recipe * Revert "remove disable_software_update recipe" This reverts commit e034db13a8dd349ac2dbc2fe2ec1133da650bdca. * cookstyle * add integration test for macos_test disable software update recipe * update integration test for software update with content * update README.md * Revert "update README.md" This reverts commit f1c2f881b739fc542317f610d697a96d5fe88590. * update README.md * Update documentation/resource_automatic_software_updates.md Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update documentation/resource_automatic_software_updates.md Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * update spec test plist path entries with variable for cleaner code -Mark Merin * remove duplicate test file with bad InSpec syntax * fix indentation, update wording, and add inline image of the preferences * update wording in documentation * Replace ard resource with remote_management (#191) * change class name from ARD to RemoteManagement * update resource name in test * update resource name * update method names * remote unused actions * make RemoteManagement a class, static methods * create remote_management resource to replace ard * remove configuration action, create contexts to check idempotence * update test recipe to be more explicit * update spec to use shared examples and contexts * add full privs mask to configured? guard * remove old library spec * update docs * remove duplicate conditional checking * refactor plist to plist_content * refactor configured? to configured_for_all_users_and_privileges? * remove parens * update build yaml to include software-update test suite * update test suite name in kitchen.yml * update changelog with 3.0 changes * fix run_list recipe to look in macos_test folder for recipe * update run_list for software-updates test suite * update azure-pipelines.yml test suites list (#192) * update azure-pipelines.yml test suites list * Fix test recipe name for software_updates suite * Update InSpec output file name to match azure pipelines template * Remove Chef version from platform name * Remove chefVersion from the matrix strategy * Revert chefVersion removal from matrix strategy * Revert "Revert chefVersion removal from matrix strategy" This reverts commit ac03f78bca40e153d9d0fe22e95140602cadf635. * fix keychain creation guard preventing multi-converge from passing * add exclude for url suite * Revert "add exclude for url suite" This reverts commit b5ea6220770a80979abeb44007644a3b3d87da6b. * add guard in azure-pipelines.yml for xcode version on sierra platform * Revert "add guard in azure-pipelines.yml for xcode version on sierra platform" This reverts commit 5a9460d7bcc7b9e98e87daaf96dd22b7973ee68b. * don't exclude sierra from xcode testing * add '9.2' version to sierra url install * update build badge in README.md * fix typo * add fix for keychain to changelog * add removal of machine_name to changelog * fix caps * move spotlight resource test to resource folder * note spotlight test additions * note removal of default attribute for xcode version * remove dup lines * add changelog updates * add mock data back * add more mock data back * Update resource doc links - Fix broken link for renamed resource - Remove link to machine_name documentation - Update formatting to match Chef's resource links * update xcode doc with auth steps * officially unofficial * remove extra lines between properties to match other resources * update CHANGELOG with correct El Capitan prefix * install rb-readline gem for pry compatibility with unit test guard https://github.com/pry/pry/issues/1577
2019-03-04 21:07:16 +03:00
include Chef::Mixin::ShellOut
module MacOS
class RemoteManagement
class << self
def activated?
::File.exist? '/Library/Application Support/Apple/Remote Desktop/RemoteManagement.launchd'
end
def configured_for_all_users_and_privileges?
RemoteManagement.plist_content.include?('ARD_AllLocalUsers = true') &&
RemoteManagement.plist_content.include?(full_privileges)
end
def plist_content
shell_out('/usr/libexec/PlistBuddy -c Print /Library/Preferences/com.apple.RemoteManagement.plist').stdout
end
def full_privileges
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
show_observe = 1 << 30
(text_messages | control_observe | send_files |
delete_files | generate_reports | open_quit_apps |
change_settings | restart_shutdown | show_observe).to_s
end
end
end
end
2021-02-11 00:04:08 +03:00
Chef::DSL::Recipe.include(MacOS)
Release/3.0 (#193) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * Add deprecation notice for the machine_name resource (#146) * bump version to 3.0 for release branch * Drop chef13 support in .kitchen.yml * Remove machine_name resource in favor of hostname resource in Chef14 (#145) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * update inspec tests * remove live_stream option * Remove machine name custom resource and related tests * Add deprecation notice for the machine_name resource (#146) * Add spotlight spec test * Add back el-cap chef14 platform in .kitchen.yml * Release 3.0 will not support Chef 13 if this change is implemented * Remove El Capitan support Linting - Remove machine_name resource in favor of hostname resource in Chef14 (#145) * update syntax in ard_test.rb, added mojave test suites, removed test suites for el capitan * update inspec tests * remove live_stream option * Remove machine name custom resource and related tests * Add deprecation notice for the machine_name resource (#146) * Add spotlight spec test * Add back el-cap chef14 platform in .kitchen.yml * Release 3.0 will not support Chef 13 if this change is implemented - Remove El Capitan support - Remove useless assignment in security_test - Enable password hash unit test - Markdown linting - Fix headers - Remove dollar signs from code blocks that do not include output - Update 10.13.3 to 10.13.6 * Bump supported Chef version in metadata.rb to 14 * Remove machine_name resource documentation * Add Azure Pipelines YAML (#185) * Remove duplicate .gitignore from test cookbook * Add azure-pipelines YAML with Chef unit/lint job * Add suites and update kitchen.yml name * Add pipelines YAML to chefignore * Add parameter input for kitchenFile * Remove branch ref for templates repository * Remove Xcode recipe, tests, and documentation (#187) * Remove default recipe and fix ChefSpec test for disable_software_updates recipe (#186) * Delete default recipe and related spec * Fix failing ChefSpec test for disable_software_updates recipe * remove default Xcode version attribute * set test recipe Xcode version * Remove disable_software_updates recipe, related tests, and documentation (#188) * update mailmap * create readme and resource for macos_automatic_software_updates * remove vagrant.rb * change name of resource to automatic_software_updates * add new automatic_software_updates resource * add spec test for automatic_software_updates * change name of resource * group under one action block * update spec test to check for app_store * update property names * update property names in resource * update property name in spec test * update value entry to recieve user inputed property * add block to test both true and false * Add Action description to software_update.md * spec tests with seperate it blocks, work in progress * uploaded some working tests * update resource to pass spec tests * make path to software update plist a variable * lint and beautify * create app store plist variable * add test cases for error handling * add exception handling for spec test cases * add error handling to resource to check against bad configs * add disable_software_updates.rb * update software_updates_test.rb to include all resource values * make software-update test suite idempotent * add more content to resource_software_update.md documentation * update documentation name * remove old file * add example to documentation * remove disable_software_update recipe * Revert "remove disable_software_update recipe" This reverts commit e034db13a8dd349ac2dbc2fe2ec1133da650bdca. * cookstyle * add integration test for macos_test disable software update recipe * update integration test for software update with content * update README.md * Revert "update README.md" This reverts commit f1c2f881b739fc542317f610d697a96d5fe88590. * update README.md * Update documentation/resource_automatic_software_updates.md Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update documentation/resource_automatic_software_updates.md Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * Update spec/unit/resources/automatic_software_updates_spec.rb Co-Authored-By: v-anshie <v-anshie@microsoft.com> * update spec test plist path entries with variable for cleaner code -Mark Merin * remove duplicate test file with bad InSpec syntax * fix indentation, update wording, and add inline image of the preferences * update wording in documentation * Replace ard resource with remote_management (#191) * change class name from ARD to RemoteManagement * update resource name in test * update resource name * update method names * remote unused actions * make RemoteManagement a class, static methods * create remote_management resource to replace ard * remove configuration action, create contexts to check idempotence * update test recipe to be more explicit * update spec to use shared examples and contexts * add full privs mask to configured? guard * remove old library spec * update docs * remove duplicate conditional checking * refactor plist to plist_content * refactor configured? to configured_for_all_users_and_privileges? * remove parens * update build yaml to include software-update test suite * update test suite name in kitchen.yml * update changelog with 3.0 changes * fix run_list recipe to look in macos_test folder for recipe * update run_list for software-updates test suite * update azure-pipelines.yml test suites list (#192) * update azure-pipelines.yml test suites list * Fix test recipe name for software_updates suite * Update InSpec output file name to match azure pipelines template * Remove Chef version from platform name * Remove chefVersion from the matrix strategy * Revert chefVersion removal from matrix strategy * Revert "Revert chefVersion removal from matrix strategy" This reverts commit ac03f78bca40e153d9d0fe22e95140602cadf635. * fix keychain creation guard preventing multi-converge from passing * add exclude for url suite * Revert "add exclude for url suite" This reverts commit b5ea6220770a80979abeb44007644a3b3d87da6b. * add guard in azure-pipelines.yml for xcode version on sierra platform * Revert "add guard in azure-pipelines.yml for xcode version on sierra platform" This reverts commit 5a9460d7bcc7b9e98e87daaf96dd22b7973ee68b. * don't exclude sierra from xcode testing * add '9.2' version to sierra url install * update build badge in README.md * fix typo * add fix for keychain to changelog * add removal of machine_name to changelog * fix caps * move spotlight resource test to resource folder * note spotlight test additions * note removal of default attribute for xcode version * remove dup lines * add changelog updates * add mock data back * add more mock data back * Update resource doc links - Fix broken link for renamed resource - Remove link to machine_name documentation - Update formatting to match Chef's resource links * update xcode doc with auth steps * officially unofficial * remove extra lines between properties to match other resources * update CHANGELOG with correct El Capitan prefix * install rb-readline gem for pry compatibility with unit test guard https://github.com/pry/pry/issues/1577
2019-03-04 21:07:16 +03:00
Chef::Resource.include(MacOS)