chef 11.18.12-x86-mingw32 → 12.0.0.alpha.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +10 -0
- data/README.md +1 -1
- data/distro/common/html/_sources/index.txt +5 -2
- data/distro/common/html/_sources/knife_serve.txt +19 -0
- data/distro/common/html/_sources/knife_ssl_check.txt +2 -2
- data/distro/common/html/_sources/knife_ssl_fetch.txt +2 -2
- data/distro/common/html/_static/basic.css +1 -1
- data/distro/common/html/_static/doctools.js +1 -1
- data/distro/common/html/_static/searchtools.js +1 -1
- data/distro/common/html/_static/websupport.js +1 -1
- data/distro/common/html/ctl_chef_client.html +19 -9
- data/distro/common/html/ctl_chef_server.html +7 -1
- data/distro/common/html/ctl_chef_shell.html +3 -4
- data/distro/common/html/ctl_chef_solo.html +12 -7
- data/distro/common/html/index.html +19 -12
- data/distro/common/html/knife.html +1 -2
- data/distro/common/html/knife_bootstrap.html +16 -5
- data/distro/common/html/knife_client.html +8 -5
- data/distro/common/html/knife_common_options.html +11 -12
- data/distro/common/html/knife_configure.html +2 -3
- data/distro/common/html/knife_cookbook.html +16 -17
- data/distro/common/html/knife_cookbook_site.html +19 -18
- data/distro/common/html/knife_data_bag.html +6 -7
- data/distro/common/html/knife_delete.html +2 -3
- data/distro/common/html/knife_deps.html +2 -3
- data/distro/common/html/knife_diff.html +3 -4
- data/distro/common/html/knife_download.html +6 -7
- data/distro/common/html/knife_edit.html +0 -1
- data/distro/common/html/knife_environment.html +3 -4
- data/distro/common/html/knife_exec.html +0 -1
- data/distro/common/html/knife_index_rebuild.html +0 -1
- data/distro/common/html/knife_list.html +5 -6
- data/distro/common/html/knife_node.html +13 -6
- data/distro/common/html/knife_raw.html +0 -1
- data/distro/common/html/knife_recipe_list.html +0 -1
- data/distro/common/html/knife_role.html +1 -2
- data/distro/common/html/knife_search.html +2 -3
- data/distro/common/html/knife_serve.html +79 -0
- data/distro/common/html/knife_show.html +1 -2
- data/distro/common/html/knife_ssh.html +2 -3
- data/distro/common/html/knife_ssl_check.html +12 -9
- data/distro/common/html/knife_ssl_fetch.html +9 -10
- data/distro/common/html/knife_status.html +2 -3
- data/distro/common/html/knife_tag.html +0 -1
- data/distro/common/html/knife_upload.html +3 -4
- data/distro/common/html/knife_user.html +2 -3
- data/distro/common/html/knife_using.html +0 -1
- data/distro/common/html/knife_xargs.html +3 -4
- data/distro/common/html/search.html +0 -1
- data/distro/common/html/searchindex.js +1 -1
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application.rb +24 -67
- data/lib/chef/application/client.rb +1 -1
- data/lib/chef/application/knife.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +2 -3
- data/lib/chef/chef_fs/command_line.rb +2 -3
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +1 -5
- data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +1 -2
- data/lib/chef/chef_fs/file_system/cookbooks_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +2 -3
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +4 -5
- data/lib/chef/config.rb +26 -2
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +4 -4
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook/synchronizer.rb +50 -8
- data/lib/chef/cookbook_uploader.rb +9 -23
- data/lib/chef/cookbook_version.rb +3 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/dsl/recipe.rb +1 -14
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/exceptions.rb +2 -24
- data/lib/chef/file_content_management/tempfile.rb +8 -1
- data/lib/chef/formatters/base.rb +0 -7
- data/lib/chef/http.rb +12 -19
- data/lib/chef/http/json_input.rb +12 -1
- data/lib/chef/json_compat.rb +45 -64
- data/lib/chef/knife.rb +2 -5
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +10 -34
- data/lib/chef/knife/cookbook_site_list.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +3 -3
- data/lib/chef/knife/cookbook_site_show.rb +3 -3
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/cookbook_upload.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +0 -24
- data/lib/chef/knife/core/ui.rb +8 -7
- data/lib/chef/knife/deps.rb +2 -3
- data/lib/chef/knife/serve.rb +2 -1
- data/lib/chef/local_mode.rb +105 -0
- data/lib/chef/mixin/file_class.rb +1 -4
- data/lib/chef/mixin/shell_out.rb +15 -0
- data/lib/chef/mixin/windows_architecture_helper.rb +0 -16
- data/lib/chef/node.rb +1 -1
- data/lib/chef/platform/query_helpers.rb +1 -5
- data/lib/chef/policy_builder/expand_node_object.rb +3 -0
- data/lib/chef/provider.rb +2 -0
- data/lib/chef/provider/cookbook_file.rb +0 -1
- data/lib/chef/provider/deploy.rb +0 -1
- data/lib/chef/provider/deploy/revision.rb +1 -1
- data/lib/chef/provider/env.rb +10 -25
- data/lib/chef/provider/env/windows.rb +23 -10
- data/lib/chef/provider/execute.rb +0 -3
- data/lib/chef/provider/file.rb +0 -3
- data/lib/chef/provider/git.rb +0 -6
- data/lib/chef/provider/group/dscl.rb +9 -27
- data/lib/chef/provider/group/gpasswd.rb +0 -3
- data/lib/chef/provider/group/groupmod.rb +0 -4
- data/lib/chef/provider/group/suse.rb +0 -3
- data/lib/chef/provider/group/usermod.rb +0 -3
- data/lib/chef/provider/link.rb +22 -5
- data/lib/chef/provider/log.rb +15 -4
- data/lib/chef/provider/mdadm.rb +0 -3
- data/lib/chef/provider/mount/mount.rb +0 -2
- data/lib/chef/provider/mount/solaris.rb +0 -2
- data/lib/chef/provider/package.rb +0 -1
- data/lib/chef/provider/package/apt.rb +0 -3
- data/lib/chef/provider/package/dpkg.rb +0 -1
- data/lib/chef/provider/package/easy_install.rb +0 -4
- data/lib/chef/provider/package/freebsd/base.rb +0 -3
- data/lib/chef/provider/package/freebsd/pkgng.rb +0 -2
- data/lib/chef/provider/package/freebsd/port.rb +0 -2
- data/lib/chef/provider/package/ips.rb +0 -3
- data/lib/chef/provider/package/paludis.rb +0 -5
- data/lib/chef/provider/package/portage.rb +0 -2
- data/lib/chef/provider/package/rpm.rb +2 -4
- data/lib/chef/provider/package/rubygems.rb +0 -4
- data/lib/chef/provider/package/smartos.rb +0 -3
- data/lib/chef/provider/package/windows/msi.rb +0 -2
- data/lib/chef/provider/package/yum.rb +0 -4
- data/lib/chef/provider/package/zypper.rb +0 -3
- data/lib/chef/provider/registry_key.rb +0 -2
- data/lib/chef/provider/remote_directory.rb +0 -1
- data/lib/chef/provider/remote_file.rb +0 -1
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -3
- data/lib/chef/provider/remote_file/content.rb +0 -1
- data/lib/chef/provider/remote_file/fetcher.rb +0 -2
- data/lib/chef/provider/remote_file/ftp.rb +0 -1
- data/lib/chef/provider/resource_update.rb +0 -3
- data/lib/chef/provider/service/freebsd.rb +0 -3
- data/lib/chef/provider/service/init.rb +0 -3
- data/lib/chef/provider/service/macosx.rb +0 -1
- data/lib/chef/provider/service/redhat.rb +0 -2
- data/lib/chef/provider/service/simple.rb +0 -3
- data/lib/chef/provider/service/solaris.rb +0 -3
- data/lib/chef/provider/service/systemd.rb +15 -14
- data/lib/chef/provider/service/windows.rb +0 -3
- data/lib/chef/provider/subversion.rb +0 -2
- data/lib/chef/provider/template.rb +0 -2
- data/lib/chef/provider/template/content.rb +0 -1
- data/lib/chef/provider/user/dscl.rb +156 -549
- data/lib/chef/provider/user/solaris.rb +0 -1
- data/lib/chef/provider/user/useradd.rb +0 -3
- data/lib/chef/provider/whyrun_safe_ruby_block.rb +1 -1
- data/lib/chef/providers.rb +0 -1
- data/lib/chef/resource.rb +1 -4
- data/lib/chef/resource/freebsd_package.rb +2 -10
- data/lib/chef/resource/lwrp_base.rb +1 -12
- data/lib/chef/resource/user.rb +0 -18
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_reporter.rb +10 -10
- data/lib/chef/resources.rb +0 -1
- data/lib/chef/role.rb +3 -3
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/tasks/chef_repo.rake +131 -264
- data/lib/chef/user.rb +1 -1
- data/lib/chef/util/path_helper.rb +2 -2
- data/lib/chef/version.rb +9 -1
- data/lib/chef/win32/api/system.rb +0 -9
- data/spec/data/bootstrap/test-hints.erb +1 -1
- data/spec/data/bootstrap/test.erb +1 -1
- data/spec/functional/dsl/reboot_pending_spec.rb +53 -58
- data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/mixin/shell_out_spec.rb +48 -0
- data/spec/functional/resource/base.rb +0 -10
- data/spec/functional/resource/group_spec.rb +1 -5
- data/spec/functional/resource/link_spec.rb +8 -0
- data/spec/functional/resource/{user/useradd_spec.rb → user_spec.rb} +1 -1
- data/spec/integration/knife/chef_fs_data_store_spec.rb +3 -3
- data/spec/integration/knife/chef_repo_path_spec.rb +1 -6
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
- data/spec/integration/knife/chefignore_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +50 -3
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/deps_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +3 -3
- data/spec/integration/knife/download_spec.rb +3 -3
- data/spec/integration/knife/list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +1 -11
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/serve_spec.rb +2 -2
- data/spec/integration/knife/show_spec.rb +1 -1
- data/spec/integration/knife/upload_spec.rb +9 -9
- data/spec/spec_helper.rb +0 -9
- data/spec/support/pedant/pedant_config.rb +2 -1
- data/spec/support/pedant/run_pedant.rb +2 -1
- data/spec/support/platform_helpers.rb +5 -24
- data/spec/support/shared/integration/integration_helper.rb +2 -1
- data/spec/support/shared/matchers.rb +17 -0
- data/spec/tiny_server.rb +1 -2
- data/spec/unit/api_client_spec.rb +3 -3
- data/spec/unit/application_spec.rb +9 -32
- data/spec/unit/config_fetcher_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +3 -7
- data/spec/unit/cookbook/synchronizer_spec.rb +441 -226
- data/spec/unit/cookbook_loader_spec.rb +1 -1
- data/spec/unit/cookbook_uploader_spec.rb +160 -0
- data/spec/unit/cookbook_version_spec.rb +0 -4
- data/spec/unit/data_bag_item_spec.rb +1 -5
- data/spec/unit/data_bag_spec.rb +1 -5
- data/spec/unit/deprecation_spec.rb +1 -1
- data/spec/unit/dsl/recipe_spec.rb +12 -0
- data/spec/unit/encrypted_data_bag_item_spec.rb +7 -14
- data/spec/unit/environment_spec.rb +3 -7
- data/spec/unit/exceptions_spec.rb +0 -6
- data/spec/unit/http/json_input_spec.rb +128 -0
- data/spec/unit/json_compat_spec.rb +17 -58
- data/spec/unit/knife/client_create_spec.rb +3 -3
- data/spec/unit/knife/configure_client_spec.rb +6 -5
- data/spec/unit/knife/cookbook_delete_spec.rb +1 -1
- data/spec/unit/knife/cookbook_download_spec.rb +5 -5
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +1 -0
- data/spec/unit/knife/cookbook_metadata_spec.rb +1 -1
- data/spec/unit/knife/cookbook_site_download_spec.rb +10 -11
- data/spec/unit/knife/cookbook_site_install_spec.rb +116 -161
- data/spec/unit/knife/cookbook_site_share_spec.rb +8 -8
- data/spec/unit/knife/cookbook_upload_spec.rb +3 -2
- data/spec/unit/knife/core/bootstrap_context_spec.rb +3 -3
- data/spec/unit/knife/core/subcommand_loader_spec.rb +1 -66
- data/spec/unit/knife/data_bag_from_file_spec.rb +2 -1
- data/spec/unit/knife/tag_create_spec.rb +3 -3
- data/spec/unit/knife/tag_delete_spec.rb +3 -3
- data/spec/unit/knife/user_create_spec.rb +1 -1
- data/spec/unit/knife_spec.rb +14 -14
- data/spec/unit/lwrp_spec.rb +1 -21
- data/spec/unit/mixin/shell_out_spec.rb +92 -0
- data/spec/unit/node_spec.rb +0 -4
- data/spec/unit/platform/query_helpers_spec.rb +0 -23
- data/spec/unit/provider/env/windows_spec.rb +34 -70
- data/spec/unit/provider/env_spec.rb +11 -76
- data/spec/unit/provider/group/dscl_spec.rb +1 -38
- data/spec/unit/provider/log_spec.rb +18 -0
- data/spec/unit/provider/package/rpm_spec.rb +0 -12
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +1 -1
- data/spec/unit/provider/service/systemd_service_spec.rb +44 -27
- data/spec/unit/provider/user/dscl_spec.rb +264 -660
- data/spec/unit/provider/user/useradd_spec.rb +0 -1
- data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +2 -2
- data/spec/unit/provider_spec.rb +12 -0
- data/spec/unit/recipe_spec.rb +0 -41
- data/spec/unit/resource_collection_spec.rb +1 -5
- data/spec/unit/resource_reporter_spec.rb +3 -51
- data/spec/unit/resource_spec.rb +3 -14
- data/spec/unit/rest_spec.rb +1 -4
- data/spec/unit/role_spec.rb +0 -10
- data/spec/unit/run_list_spec.rb +1 -5
- data/spec/unit/user_spec.rb +1 -5
- metadata +20 -100
- data/lib/chef/mixin/windows_env_helper.rb +0 -56
- data/lib/chef/provider/dsc_script.rb +0 -175
- data/lib/chef/resource/dsc_script.rb +0 -126
- data/lib/chef/streaming_cookbook_uploader.rb +0 -205
- data/lib/chef/util/dsc/configuration_generator.rb +0 -115
- data/lib/chef/util/dsc/lcm_output_parser.rb +0 -133
- data/lib/chef/util/dsc/local_configuration_manager.rb +0 -141
- data/lib/chef/util/dsc/resource_info.rb +0 -26
- data/lib/chef/util/powershell/cmdlet.rb +0 -136
- data/lib/chef/util/powershell/cmdlet_result.rb +0 -46
- data/spec/data/mac_users/10.7-8.plist.xml +0 -559
- data/spec/data/mac_users/10.7-8.shadow.xml +0 -11
- data/spec/data/mac_users/10.7.plist.xml +0 -559
- data/spec/data/mac_users/10.7.shadow.xml +0 -11
- data/spec/data/mac_users/10.8.plist.xml +0 -559
- data/spec/data/mac_users/10.8.shadow.xml +0 -21
- data/spec/data/mac_users/10.9.plist.xml +0 -560
- data/spec/data/mac_users/10.9.shadow.xml +0 -21
- data/spec/functional/provider/whyrun_safe_ruby_block_spec.rb +0 -51
- data/spec/functional/resource/dsc_script_spec.rb +0 -382
- data/spec/functional/resource/env_spec.rb +0 -182
- data/spec/functional/resource/user/dscl_spec.rb +0 -199
- data/spec/functional/util/powershell/cmdlet_spec.rb +0 -113
- data/spec/support/lib/chef/resource/zen_follower.rb +0 -46
- data/spec/support/shared/shared_examples.rb +0 -10
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +0 -63
- data/spec/unit/formatters/base_spec.rb +0 -48
- data/spec/unit/provider/dsc_script_spec.rb +0 -174
- data/spec/unit/resource/dsc_script_spec.rb +0 -98
- data/spec/unit/util/dsc/configuration_generator_spec.rb +0 -171
- data/spec/unit/util/dsc/lcm_output_parser_spec.rb +0 -169
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +0 -139
- data/spec/unit/util/powershell/cmdlet_spec.rb +0 -106
@@ -18,16 +18,13 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
#
|
20
20
|
|
21
|
-
if Chef::Platform.windows?
|
22
|
-
require 'chef/win32/file'
|
23
|
-
end
|
24
|
-
|
25
21
|
class Chef
|
26
22
|
module Mixin
|
27
23
|
module FileClass
|
28
24
|
|
29
25
|
def file_class
|
30
26
|
@host_os_file ||= if Chef::Platform.windows?
|
27
|
+
require 'chef/win32/file'
|
31
28
|
Chef::ReservedNames::Win32::File
|
32
29
|
else
|
33
30
|
::File
|
data/lib/chef/mixin/shell_out.rb
CHANGED
@@ -44,6 +44,21 @@ class Chef
|
|
44
44
|
cmd
|
45
45
|
end
|
46
46
|
|
47
|
+
# environment['LC_ALL'] should be nil or what the user specified
|
48
|
+
def shell_out_with_systems_locale(*command_args)
|
49
|
+
args = command_args.dup
|
50
|
+
if args.last.is_a?(Hash)
|
51
|
+
options = args.last
|
52
|
+
env_key = options.has_key?(:env) ? :env : :environment
|
53
|
+
options[env_key] ||= {}
|
54
|
+
options[env_key]['LC_ALL'] ||= nil
|
55
|
+
else
|
56
|
+
args << { :environment => { 'LC_ALL' => nil } }
|
57
|
+
end
|
58
|
+
|
59
|
+
shell_out(*args)
|
60
|
+
end
|
61
|
+
|
47
62
|
DEPRECATED_OPTIONS =
|
48
63
|
[ [:command_log_level, :log_level],
|
49
64
|
[:command_log_prepend, :log_tag] ]
|
@@ -41,22 +41,6 @@ class Chef
|
|
41
41
|
is_i386_process_on_x86_64_windows?
|
42
42
|
end
|
43
43
|
|
44
|
-
def with_os_architecture(node)
|
45
|
-
wow64_redirection_state = nil
|
46
|
-
|
47
|
-
if wow64_architecture_override_required?(node, node_windows_architecture(node))
|
48
|
-
wow64_redirection_state = disable_wow64_file_redirection(node)
|
49
|
-
end
|
50
|
-
|
51
|
-
begin
|
52
|
-
yield
|
53
|
-
ensure
|
54
|
-
if wow64_redirection_state
|
55
|
-
restore_wow64_file_redirection(node, wow64_redirection_state)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
44
|
def node_supports_windows_architecture?(node, desired_architecture)
|
61
45
|
assert_valid_windows_architecture!(desired_architecture)
|
62
46
|
return (node_windows_architecture(node) == :x86_64 ||
|
data/lib/chef/node.rb
CHANGED
@@ -176,6 +176,9 @@ class Chef
|
|
176
176
|
end
|
177
177
|
|
178
178
|
synchronizer = Chef::CookbookSynchronizer.new(cookbook_hash, events)
|
179
|
+
if temporary_policy?
|
180
|
+
synchronizer.remove_obsoleted_files = false
|
181
|
+
end
|
179
182
|
synchronizer.sync_cookbooks
|
180
183
|
|
181
184
|
# register the file cache path in the cookbook path so that CookbookLoader actually picks up the synced cookbooks
|
data/lib/chef/provider.rb
CHANGED
@@ -22,11 +22,13 @@ require 'chef/mixin/convert_to_class_name'
|
|
22
22
|
require 'chef/dsl/recipe'
|
23
23
|
require 'chef/mixin/enforce_ownership_and_permissions'
|
24
24
|
require 'chef/mixin/why_run'
|
25
|
+
require 'chef/mixin/shell_out'
|
25
26
|
|
26
27
|
class Chef
|
27
28
|
class Provider
|
28
29
|
include Chef::DSL::Recipe
|
29
30
|
include Chef::Mixin::WhyRun
|
31
|
+
include Chef::Mixin::ShellOut
|
30
32
|
|
31
33
|
attr_accessor :new_resource
|
32
34
|
attr_accessor :current_resource
|
data/lib/chef/provider/deploy.rb
CHANGED
data/lib/chef/provider/env.rb
CHANGED
@@ -58,22 +58,20 @@ class Chef
|
|
58
58
|
# ==== Returns
|
59
59
|
# <true>:: If a change is required
|
60
60
|
# <false>:: If a change is not required
|
61
|
-
def
|
61
|
+
def compare_value
|
62
62
|
if @new_resource.delim
|
63
63
|
#e.g. check for existing value within PATH
|
64
|
-
not
|
65
|
-
|
64
|
+
not @current_resource.value.split(@new_resource.delim).any? do |val|
|
65
|
+
val == @new_resource.value
|
66
66
|
end
|
67
67
|
else
|
68
68
|
@new_resource.value != @current_resource.value
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
-
alias_method :compare_value, :requires_modify_or_create?
|
73
|
-
|
74
72
|
def action_create
|
75
73
|
if @key_exists
|
76
|
-
if
|
74
|
+
if compare_value
|
77
75
|
modify_env
|
78
76
|
Chef::Log.info("#{@new_resource} altered")
|
79
77
|
@new_resource.updated_by_last_action(true)
|
@@ -93,14 +91,13 @@ class Chef
|
|
93
91
|
# after we removed the element.
|
94
92
|
def delete_element
|
95
93
|
return false unless @new_resource.delim #no delim: delete the key
|
96
|
-
|
97
|
-
if !needs_delete
|
94
|
+
if compare_value
|
98
95
|
Chef::Log.debug("#{@new_resource} element '#{@new_resource.value}' does not exist")
|
99
96
|
return true #do not delete the key
|
100
97
|
else
|
101
98
|
new_value =
|
102
|
-
|
103
|
-
|
99
|
+
@current_resource.value.split(@new_resource.delim).select { |item|
|
100
|
+
item != @new_resource.value
|
104
101
|
}.join(@new_resource.delim)
|
105
102
|
|
106
103
|
if new_value.empty?
|
@@ -125,7 +122,7 @@ class Chef
|
|
125
122
|
|
126
123
|
def action_modify
|
127
124
|
if @key_exists
|
128
|
-
if
|
125
|
+
if compare_value
|
129
126
|
modify_env
|
130
127
|
Chef::Log.info("#{@new_resource} modified")
|
131
128
|
@new_resource.updated_by_last_action(true)
|
@@ -145,23 +142,11 @@ class Chef
|
|
145
142
|
|
146
143
|
def modify_env
|
147
144
|
if @new_resource.delim
|
148
|
-
|
149
|
-
|
150
|
-
end
|
151
|
-
@new_resource.value((values + [@current_resource.value]).join(@new_resource.delim))
|
145
|
+
#e.g. add to PATH
|
146
|
+
@new_resource.value << @new_resource.delim << @current_resource.value
|
152
147
|
end
|
153
148
|
create_env
|
154
149
|
end
|
155
|
-
|
156
|
-
# Returns the current values to split by delimiter
|
157
|
-
def current_values
|
158
|
-
@current_values ||= @current_resource.value.split(@new_resource.delim)
|
159
|
-
end
|
160
|
-
|
161
|
-
# Returns the new values to split by delimiter
|
162
|
-
def new_values
|
163
|
-
@new_values ||= @new_resource.value.split(@new_resource.delim)
|
164
|
-
end
|
165
150
|
end
|
166
151
|
end
|
167
152
|
end
|
@@ -16,13 +16,13 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/
|
19
|
+
require 'chef/win32/api/system' if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
20
20
|
|
21
21
|
class Chef
|
22
22
|
class Provider
|
23
23
|
class Env
|
24
24
|
class Windows < Chef::Provider::Env
|
25
|
-
include Chef::
|
25
|
+
include Chef::ReservedNames::Win32::API::System if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
26
26
|
|
27
27
|
def create_env
|
28
28
|
obj = env_obj(@new_resource.key_name)
|
@@ -33,9 +33,7 @@ class Chef
|
|
33
33
|
end
|
34
34
|
obj.variablevalue = @new_resource.value
|
35
35
|
obj.put_
|
36
|
-
|
37
|
-
value = expand_path(value) if @new_resource.key_name.upcase == 'PATH'
|
38
|
-
ENV[@new_resource.key_name] = value
|
36
|
+
ENV[@new_resource.key_name] = @new_resource.value
|
39
37
|
broadcast_env_change
|
40
38
|
end
|
41
39
|
|
@@ -53,15 +51,30 @@ class Chef
|
|
53
51
|
return obj ? obj.variablevalue : nil
|
54
52
|
end
|
55
53
|
|
54
|
+
def find_env(environment_variables, key_name)
|
55
|
+
environment_variables.find do | environment_variable |
|
56
|
+
environment_variable['name'].downcase == key_name
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
56
60
|
def env_obj(key_name)
|
57
61
|
wmi = WmiLite::Wmi.new
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
environment_variables[0].wmi_ole_object
|
62
|
-
end
|
62
|
+
environment_variables = wmi.instances_of('Win32_Environment')
|
63
|
+
existing_variable = find_env(environment_variables, key_name)
|
64
|
+
existing_variable.nil? ? nil : existing_variable.wmi_ole_object
|
63
65
|
end
|
64
66
|
|
67
|
+
#see: http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx
|
68
|
+
HWND_BROADCAST = 0xffff
|
69
|
+
WM_SETTINGCHANGE = 0x001A
|
70
|
+
SMTO_BLOCK = 0x0001
|
71
|
+
SMTO_ABORTIFHUNG = 0x0002
|
72
|
+
SMTO_NOTIMEOUTIFNOTHUNG = 0x0008
|
73
|
+
|
74
|
+
def broadcast_env_change
|
75
|
+
flags = SMTO_BLOCK | SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG
|
76
|
+
SendMessageTimeoutA(HWND_BROADCAST, WM_SETTINGCHANGE, 0, FFI::MemoryPointer.from_string('Environment').address, flags, 5000, nil)
|
77
|
+
end
|
65
78
|
end
|
66
79
|
end
|
67
80
|
end
|
@@ -16,7 +16,6 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/mixin/shell_out'
|
20
19
|
require 'chef/log'
|
21
20
|
require 'chef/provider'
|
22
21
|
|
@@ -24,8 +23,6 @@ class Chef
|
|
24
23
|
class Provider
|
25
24
|
class Execute < Chef::Provider
|
26
25
|
|
27
|
-
include Chef::Mixin::ShellOut
|
28
|
-
|
29
26
|
def load_current_resource
|
30
27
|
true
|
31
28
|
end
|
data/lib/chef/provider/file.rb
CHANGED
@@ -25,7 +25,6 @@ require 'etc'
|
|
25
25
|
require 'fileutils'
|
26
26
|
require 'chef/scan_access_control'
|
27
27
|
require 'chef/mixin/checksum'
|
28
|
-
require 'chef/mixin/shell_out'
|
29
28
|
require 'chef/mixin/file_class'
|
30
29
|
require 'chef/util/backup'
|
31
30
|
require 'chef/util/diff'
|
@@ -48,7 +47,6 @@ class Chef
|
|
48
47
|
class File < Chef::Provider
|
49
48
|
include Chef::Mixin::EnforceOwnershipAndPermissions
|
50
49
|
include Chef::Mixin::Checksum
|
51
|
-
include Chef::Mixin::ShellOut
|
52
50
|
include Chef::Util::Selinux
|
53
51
|
include Chef::Mixin::FileClass
|
54
52
|
|
@@ -247,7 +245,6 @@ class Chef
|
|
247
245
|
"Assuming symlink source would be created by a previous resource" ]
|
248
246
|
end
|
249
247
|
|
250
|
-
|
251
248
|
def content
|
252
249
|
@content ||= begin
|
253
250
|
load_current_resource if @current_resource.nil?
|
data/lib/chef/provider/git.rb
CHANGED
@@ -16,19 +16,15 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
|
20
19
|
require 'chef/exceptions'
|
21
20
|
require 'chef/log'
|
22
21
|
require 'chef/provider'
|
23
|
-
require 'chef/mixin/shell_out'
|
24
22
|
require 'fileutils'
|
25
23
|
|
26
24
|
class Chef
|
27
25
|
class Provider
|
28
26
|
class Git < Chef::Provider
|
29
27
|
|
30
|
-
include Chef::Mixin::ShellOut
|
31
|
-
|
32
28
|
def whyrun_supported?
|
33
29
|
true
|
34
30
|
end
|
@@ -51,7 +47,6 @@ class Chef
|
|
51
47
|
"Cannot clone #{@new_resource} to #{@new_resource.destination}, the enclosing directory #{dirname} does not exist")
|
52
48
|
end
|
53
49
|
|
54
|
-
|
55
50
|
requirements.assert(:all_actions) do |a|
|
56
51
|
a.assertion { !(@new_resource.revision =~ /^origin\//) }
|
57
52
|
a.failure_message Chef::Exceptions::InvalidRemoteGitReference,
|
@@ -107,7 +102,6 @@ class Chef
|
|
107
102
|
end
|
108
103
|
end
|
109
104
|
|
110
|
-
|
111
105
|
def existing_git_clone?
|
112
106
|
::File.exist?(::File.join(@new_resource.destination, ".git"))
|
113
107
|
end
|
@@ -39,33 +39,11 @@ class Chef
|
|
39
39
|
return result[2]
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
group_info = safe_dscl("read /Groups/#{@new_resource.name}")
|
48
|
-
rescue Chef::Exceptions::Group
|
49
|
-
@group_exists = false
|
50
|
-
Chef::Log.debug("#{@new_resource} group does not exist")
|
51
|
-
end
|
52
|
-
|
53
|
-
if group_info
|
54
|
-
group_info.each_line do |line|
|
55
|
-
key, val = line.split(': ')
|
56
|
-
val.strip! if val
|
57
|
-
case key.downcase
|
58
|
-
when 'primarygroupid'
|
59
|
-
@new_resource.gid(val) unless @new_resource.gid
|
60
|
-
@current_resource.gid(val)
|
61
|
-
when 'groupmembership'
|
62
|
-
@current_resource.members(val.split(' '))
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
@current_resource
|
68
|
-
end
|
42
|
+
# This is handled in providers/group.rb by Etc.getgrnam()
|
43
|
+
# def group_exists?(group)
|
44
|
+
# groups = safe_dscl("list /Groups")
|
45
|
+
# !! ( groups =~ Regexp.new("\n#{group}\n") )
|
46
|
+
# end
|
69
47
|
|
70
48
|
# get a free GID greater than 200
|
71
49
|
def get_free_gid(search_limit=1000)
|
@@ -137,6 +115,10 @@ class Chef
|
|
137
115
|
end
|
138
116
|
end
|
139
117
|
|
118
|
+
def load_current_resource
|
119
|
+
super
|
120
|
+
end
|
121
|
+
|
140
122
|
def create_group
|
141
123
|
dscl_create_group
|
142
124
|
set_gid
|
@@ -17,15 +17,12 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'chef/provider/group/groupadd'
|
20
|
-
require 'chef/mixin/shell_out'
|
21
20
|
|
22
21
|
class Chef
|
23
22
|
class Provider
|
24
23
|
class Group
|
25
24
|
class Gpasswd < Chef::Provider::Group::Groupadd
|
26
25
|
|
27
|
-
include Chef::Mixin::ShellOut
|
28
|
-
|
29
26
|
def load_current_resource
|
30
27
|
super
|
31
28
|
end
|
@@ -16,15 +16,11 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require 'chef/mixin/shell_out'
|
20
|
-
|
21
19
|
class Chef
|
22
20
|
class Provider
|
23
21
|
class Group
|
24
22
|
class Groupmod < Chef::Provider::Group
|
25
23
|
|
26
|
-
include Chef::Mixin::ShellOut
|
27
|
-
|
28
24
|
def load_current_resource
|
29
25
|
super
|
30
26
|
[ "group", "user" ].each do |binary|
|
@@ -17,15 +17,12 @@
|
|
17
17
|
#
|
18
18
|
|
19
19
|
require 'chef/provider/group/groupadd'
|
20
|
-
require 'chef/mixin/shell_out'
|
21
20
|
|
22
21
|
class Chef
|
23
22
|
class Provider
|
24
23
|
class Group
|
25
24
|
class Suse < Chef::Provider::Group::Groupadd
|
26
25
|
|
27
|
-
include Chef::Mixin::ShellOut
|
28
|
-
|
29
26
|
def load_current_resource
|
30
27
|
super
|
31
28
|
end
|