chef 11.14.0.alpha.2-x86-mingw32 → 11.14.0.alpha.3-x86-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/bin/chef-service-manager +1 -1
  3. data/lib/chef/application.rb +8 -2
  4. data/lib/chef/chef_fs/command_line.rb +4 -4
  5. data/lib/chef/chef_fs/file_system.rb +3 -3
  6. data/lib/chef/chef_fs/parallelizer.rb +66 -90
  7. data/lib/chef/chef_fs/parallelizer/flatten_enumerable.rb +35 -0
  8. data/lib/chef/chef_fs/parallelizer/parallel_enumerable.rb +279 -0
  9. data/lib/chef/config.rb +36 -2
  10. data/lib/chef/cookbook/cookbook_version_loader.rb +0 -1
  11. data/lib/chef/cookbook/synchronizer.rb +64 -42
  12. data/lib/chef/cookbook_uploader.rb +4 -25
  13. data/lib/chef/cookbook_version.rb +12 -11
  14. data/lib/chef/formatters/error_inspectors/api_error_formatting.rb +18 -1
  15. data/lib/chef/formatters/error_inspectors/cookbook_sync_error_inspector.rb +1 -3
  16. data/lib/chef/knife/bootstrap.rb +23 -1
  17. data/lib/chef/knife/bootstrap/chef-aix.erb +58 -0
  18. data/lib/chef/knife/bootstrap/chef-full.erb +16 -13
  19. data/lib/chef/knife/core/bootstrap_context.rb +25 -1
  20. data/lib/chef/knife/list.rb +9 -8
  21. data/lib/chef/knife/serve.rb +44 -0
  22. data/lib/chef/knife/show.rb +2 -3
  23. data/lib/chef/knife/ssh.rb +1 -0
  24. data/lib/chef/mixin/create_path.rb +20 -4
  25. data/lib/chef/node.rb +19 -3
  26. data/lib/chef/platform/provider_mapping.rb +0 -1
  27. data/lib/chef/platform/query_helpers.rb +4 -3
  28. data/lib/chef/provider/env/windows.rb +10 -3
  29. data/lib/chef/provider/file.rb +1 -1
  30. data/lib/chef/provider/mount.rb +84 -42
  31. data/lib/chef/provider/package/freebsd/base.rb +92 -0
  32. data/lib/chef/provider/package/freebsd/pkg.rb +113 -0
  33. data/lib/chef/provider/package/freebsd/pkgng.rb +80 -0
  34. data/lib/chef/provider/package/freebsd/port.rb +70 -0
  35. data/lib/chef/providers.rb +3 -1
  36. data/lib/chef/resource/chef_gem.rb +2 -1
  37. data/lib/chef/resource/freebsd_package.rb +39 -3
  38. data/lib/chef/resource/lwrp_base.rb +2 -2
  39. data/lib/chef/resource/mount.rb +9 -9
  40. data/lib/chef/util/threaded_job_queue.rb +61 -0
  41. data/lib/chef/version.rb +1 -1
  42. data/lib/chef/version/platform.rb +2 -0
  43. data/lib/chef/whitelist.rb +82 -0
  44. data/lib/chef/win32/registry.rb +0 -1
  45. data/lib/chef/win32/version.rb +4 -3
  46. data/spec/functional/win32/versions_spec.rb +4 -4
  47. data/spec/integration/client/ipv6_spec.rb +1 -1
  48. data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -1
  49. data/spec/integration/knife/chef_repo_path_spec.rb +4 -1
  50. data/spec/integration/knife/common_options_spec.rb +9 -9
  51. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +2 -2
  52. data/spec/integration/knife/deps_spec.rb +3 -0
  53. data/spec/integration/knife/list_spec.rb +3 -0
  54. data/spec/integration/knife/raw_spec.rb +5 -2
  55. data/spec/integration/knife/redirection_spec.rb +4 -1
  56. data/spec/integration/knife/serve_spec.rb +57 -0
  57. data/spec/integration/knife/show_spec.rb +3 -0
  58. data/spec/support/pedant/run_pedant.rb +1 -0
  59. data/spec/support/platform_helpers.rb +7 -5
  60. data/spec/support/shared/context/config.rb +21 -0
  61. data/spec/support/shared/functional/file_resource.rb +52 -0
  62. data/spec/unit/chef_fs/parallelizer.rb +482 -0
  63. data/spec/unit/client_spec.rb +4 -2
  64. data/spec/unit/config_spec.rb +66 -12
  65. data/spec/unit/knife/bootstrap_spec.rb +6 -0
  66. data/spec/unit/knife/core/bootstrap_context_spec.rb +31 -1
  67. data/spec/unit/node_spec.rb +73 -3
  68. data/spec/unit/provider/mount_spec.rb +102 -79
  69. data/spec/unit/provider/package/{freebsd_spec.rb → freebsd/pkg_spec.rb} +19 -32
  70. data/spec/unit/provider/package/freebsd/pkgng_spec.rb +155 -0
  71. data/spec/unit/provider/package/freebsd/port_spec.rb +160 -0
  72. data/spec/unit/resource/chef_gem_spec.rb +5 -0
  73. data/spec/unit/resource/freebsd_package_spec.rb +63 -11
  74. data/spec/unit/resource/mount_spec.rb +11 -0
  75. data/spec/unit/role_spec.rb +5 -1
  76. data/spec/unit/run_lock_spec.rb +2 -0
  77. data/spec/unit/util/threaded_job_queue_spec.rb +51 -0
  78. data/spec/unit/version/platform_spec.rb +1 -1
  79. metadata +176 -161
  80. data/lib/chef/provider/package/freebsd.rb +0 -149
@@ -1,149 +0,0 @@
1
- #
2
- # Authors:: Bryan McLellan (btm@loftninjas.org)
3
- # Matthew Landauer (matthew@openaustralia.org)
4
- # Copyright:: Copyright (c) 2009 Bryan McLellan, Matthew Landauer
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require 'chef/provider/package'
21
- require 'chef/mixin/shell_out'
22
- require 'chef/resource/package'
23
- require 'chef/mixin/get_source_from_package'
24
-
25
- class Chef
26
- class Provider
27
- class Package
28
- class Freebsd < Chef::Provider::Package
29
- include Chef::Mixin::ShellOut
30
-
31
- include Chef::Mixin::GetSourceFromPackage
32
-
33
- def initialize(*args)
34
- super
35
- @current_resource = Chef::Resource::Package.new(@new_resource.name)
36
- end
37
-
38
- def current_installed_version
39
- pkg_info = shell_out!("pkg_info -E \"#{package_name}*\"", :env => nil, :returns => [0,1])
40
- pkg_info.stdout[/^#{Regexp.escape(package_name)}-(.+)/, 1]
41
- end
42
-
43
- def port_path
44
- case @new_resource.package_name
45
- # When the package name starts with a '/' treat it as the full path to the ports directory
46
- when /^\//
47
- @new_resource.package_name
48
- # Otherwise if the package name contains a '/' not at the start (like 'www/wordpress') treat as a relative
49
- # path from /usr/ports
50
- when /\//
51
- "/usr/ports/#{@new_resource.package_name}"
52
- # Otherwise look up the path to the ports directory using 'whereis'
53
- else
54
- whereis = shell_out!("whereis -s #{@new_resource.package_name}", :env => nil)
55
- unless path = whereis.stdout[/^#{Regexp.escape(@new_resource.package_name)}:\s+(.+)$/, 1]
56
- raise Chef::Exceptions::Package, "Could not find port with the name #{@new_resource.package_name}"
57
- end
58
- path
59
- end
60
- end
61
-
62
- def ports_makefile_variable_value(variable)
63
- make_v = shell_out!("make -V #{variable}", :cwd => port_path, :env => nil, :returns => [0,1])
64
- make_v.stdout.strip.split($\).first # $\ is the line separator, i.e., newline
65
- end
66
-
67
- def ports_candidate_version
68
- ports_makefile_variable_value("PORTVERSION")
69
- end
70
-
71
- def file_candidate_version_path
72
- Dir["#{@new_resource.source}/#{@current_resource.package_name}*"][-1].to_s
73
- end
74
-
75
- def file_candidate_version
76
- file_candidate_version_path.split(/-/).last.split(/.tbz/).first
77
- end
78
-
79
- def load_current_resource
80
- @current_resource.package_name(@new_resource.package_name)
81
-
82
- @current_resource.version(current_installed_version)
83
- Chef::Log.debug("#{@new_resource} current version is #{@current_resource.version}") if @current_resource.version
84
-
85
- case @new_resource.source
86
- when /^http/, /^ftp/
87
- @candidate_version = "0.0.0"
88
- when /^\//
89
- @candidate_version = file_candidate_version
90
- else
91
- @candidate_version = ports_candidate_version
92
- end
93
-
94
- Chef::Log.debug("#{@new_resource} ports candidate version is #{@candidate_version}") if @candidate_version
95
-
96
- @current_resource
97
- end
98
-
99
- def latest_link_name
100
- ports_makefile_variable_value("LATEST_LINK")
101
- end
102
-
103
- # The name of the package (without the version number) as understood by pkg_add and pkg_info
104
- def package_name
105
- if ::File.exist?("/usr/ports/Makefile")
106
- if ports_makefile_variable_value("PKGNAME") =~ /^(.+)-[^-]+$/
107
- $1
108
- else
109
- raise Chef::Exceptions::Package, "Unexpected form for PKGNAME variable in #{port_path}/Makefile"
110
- end
111
- else
112
- @new_resource.package_name
113
- end
114
- end
115
-
116
- def install_package(name, version)
117
- unless @current_resource.version
118
- case @new_resource.source
119
- when /^ports$/
120
- shell_out!("make -DBATCH install", :timeout => 1200, :env => nil, :cwd => port_path).status
121
- when /^http/, /^ftp/
122
- if @new_resource.source =~ /\/$/
123
- shell_out!("pkg_add -r #{package_name}", :env => { "PACKAGESITE" => @new_resource.source, 'LC_ALL' => nil }).status
124
- else
125
- shell_out!("pkg_add -r #{package_name}", :env => { "PACKAGEROOT" => @new_resource.source, 'LC_ALL' => nil }).status
126
- end
127
- Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
128
- when /^\//
129
- shell_out!("pkg_add #{file_candidate_version_path}", :env => { "PKG_PATH" => @new_resource.source , 'LC_ALL'=>nil}).status
130
- Chef::Log.debug("#{@new_resource} installed from: #{@new_resource.source}")
131
- else
132
- shell_out!("pkg_add -r #{latest_link_name}", :env => nil).status
133
- end
134
- end
135
- end
136
-
137
- def remove_package(name, version)
138
- # a version is mandatory
139
- if version
140
- shell_out!("pkg_delete #{package_name}-#{version}", :env => nil).status
141
- else
142
- shell_out!("pkg_delete #{package_name}-#{@current_resource.version}", :env => nil).status
143
- end
144
- end
145
-
146
- end
147
- end
148
- end
149
- end