chef 0.10.8 → 0.10.10.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (197) hide show
  1. data/distro/arch/etc/rc.d/chef-client +15 -1
  2. data/distro/common/html/chef-client.8.html +4 -4
  3. data/distro/common/html/chef-expander.8.html +4 -4
  4. data/distro/common/html/chef-expanderctl.8.html +4 -4
  5. data/distro/common/html/chef-server-webui.8.html +4 -4
  6. data/distro/common/html/chef-server.8.html +4 -4
  7. data/distro/common/html/chef-solo.8.html +4 -4
  8. data/distro/common/html/chef-solr.8.html +4 -4
  9. data/distro/common/html/knife-bootstrap.1.html +6 -10
  10. data/distro/common/html/knife-client.1.html +4 -4
  11. data/distro/common/html/knife-configure.1.html +4 -4
  12. data/distro/common/html/knife-cookbook-site.1.html +6 -6
  13. data/distro/common/html/knife-cookbook.1.html +4 -4
  14. data/distro/common/html/knife-data-bag.1.html +4 -4
  15. data/distro/common/html/knife-environment.1.html +4 -4
  16. data/distro/common/html/knife-exec.1.html +4 -4
  17. data/distro/common/html/knife-index.1.html +4 -4
  18. data/distro/common/html/knife-node.1.html +5 -5
  19. data/distro/common/html/knife-role.1.html +4 -4
  20. data/distro/common/html/knife-search.1.html +4 -4
  21. data/distro/common/html/knife-ssh.1.html +5 -6
  22. data/distro/common/html/knife-status.1.html +4 -4
  23. data/distro/common/html/knife-tag.1.html +4 -4
  24. data/distro/common/html/knife.1.html +7 -8
  25. data/distro/common/html/shef.1.html +4 -4
  26. data/distro/common/man/man1/knife-bootstrap.1 +4 -4
  27. data/distro/common/man/man1/knife-client.1 +1 -1
  28. data/distro/common/man/man1/knife-configure.1 +1 -1
  29. data/distro/common/man/man1/knife-cookbook-site.1 +4 -4
  30. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  31. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  32. data/distro/common/man/man1/knife-environment.1 +1 -1
  33. data/distro/common/man/man1/knife-exec.1 +1 -1
  34. data/distro/common/man/man1/knife-index.1 +1 -1
  35. data/distro/common/man/man1/knife-node.1 +2 -2
  36. data/distro/common/man/man1/knife-role.1 +1 -1
  37. data/distro/common/man/man1/knife-search.1 +1 -1
  38. data/distro/common/man/man1/knife-ssh.1 +3 -7
  39. data/distro/common/man/man1/knife-status.1 +1 -1
  40. data/distro/common/man/man1/knife-tag.1 +1 -1
  41. data/distro/common/man/man1/knife.1 +5 -9
  42. data/distro/common/man/man1/shef.1 +1 -1
  43. data/distro/common/man/man8/chef-client.8 +1 -1
  44. data/distro/common/man/man8/chef-expander.8 +1 -1
  45. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  46. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  47. data/distro/common/man/man8/chef-server.8 +1 -1
  48. data/distro/common/man/man8/chef-solo.8 +1 -1
  49. data/distro/common/man/man8/chef-solr.8 +1 -1
  50. data/distro/common/markdown/man1/knife-bootstrap.mkd +3 -7
  51. data/distro/common/markdown/man1/knife-cookbook-site.mkd +3 -3
  52. data/distro/common/markdown/man1/knife-node.mkd +2 -2
  53. data/distro/common/markdown/man1/knife-ssh.mkd +2 -5
  54. data/distro/common/markdown/man1/knife.mkd +7 -9
  55. data/distro/debian/etc/init.d/chef-client +22 -1
  56. data/distro/redhat/etc/init.d/chef-client +12 -1
  57. data/distro/windows/service_manager.rb +164 -0
  58. data/lib/chef/application.rb +12 -6
  59. data/lib/chef/application/client.rb +4 -3
  60. data/lib/chef/application/knife.rb +7 -12
  61. data/lib/chef/application/solo.rb +2 -1
  62. data/lib/chef/application/windows_service.rb +224 -0
  63. data/lib/chef/checksum_cache.rb +1 -0
  64. data/lib/chef/client.rb +3 -16
  65. data/lib/chef/config.rb +42 -13
  66. data/lib/chef/cookbook/metadata.rb +1 -1
  67. data/lib/chef/cookbook/syntax_check.rb +2 -2
  68. data/lib/chef/cookbook_version.rb +5 -0
  69. data/lib/chef/daemon.rb +1 -1
  70. data/lib/chef/exceptions.rb +7 -1
  71. data/lib/chef/file_access_control.rb +13 -87
  72. data/lib/chef/file_access_control/unix.rb +119 -0
  73. data/lib/chef/file_access_control/windows.rb +257 -0
  74. data/lib/chef/handler/json_file.rb +7 -1
  75. data/lib/chef/knife.rb +10 -16
  76. data/lib/chef/knife/bootstrap.rb +15 -8
  77. data/lib/chef/knife/bootstrap/centos5-gems.erb +1 -1
  78. data/lib/chef/knife/bootstrap/chef-full.erb +59 -0
  79. data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +1 -0
  80. data/lib/chef/knife/configure.rb +2 -2
  81. data/lib/chef/knife/cookbook_site_download.rb +60 -21
  82. data/lib/chef/knife/cookbook_site_install.rb +16 -21
  83. data/lib/chef/knife/cookbook_upload.rb +77 -48
  84. data/lib/chef/knife/core/bootstrap_context.rb +3 -1
  85. data/lib/chef/knife/core/cookbook_scm_repo.rb +1 -1
  86. data/lib/chef/knife/core/node_editor.rb +1 -1
  87. data/lib/chef/knife/core/subcommand_loader.rb +1 -1
  88. data/lib/chef/knife/core/ui.rb +3 -2
  89. data/lib/chef/knife/help_topics.rb +1 -1
  90. data/lib/chef/knife/node_run_list_add.rb +14 -6
  91. data/lib/chef/knife/node_run_list_remove.rb +3 -3
  92. data/lib/chef/knife/ssh.rb +32 -13
  93. data/lib/chef/mash.rb +14 -0
  94. data/lib/chef/mixin/command.rb +1 -0
  95. data/lib/chef/mixin/command/unix.rb +5 -0
  96. data/lib/chef/mixin/convert_to_class_name.rb +2 -0
  97. data/lib/chef/mixin/deep_merge.rb +40 -18
  98. data/lib/chef/mixin/enforce_ownership_and_permissions.rb +39 -0
  99. data/lib/chef/mixin/language.rb +89 -3
  100. data/lib/chef/mixin/language_include_recipe.rb +8 -4
  101. data/lib/chef/mixin/path_sanity.rb +67 -0
  102. data/lib/chef/mixin/recipe_definition_dsl_core.rb +19 -11
  103. data/lib/chef/mixin/securable.rb +152 -0
  104. data/lib/chef/mixin/shell_out.rb +1 -1
  105. data/lib/chef/mixin/template.rb +8 -3
  106. data/lib/chef/mixins.rb +3 -0
  107. data/lib/chef/monkey_patches/moneta.rb +50 -0
  108. data/lib/chef/monkey_patches/string.rb +1 -1
  109. data/lib/chef/node.rb +2 -1
  110. data/lib/chef/platform.rb +34 -0
  111. data/lib/chef/provider.rb +23 -21
  112. data/lib/chef/provider/cron.rb +17 -12
  113. data/lib/chef/provider/cron/solaris.rb +6 -18
  114. data/lib/chef/provider/deploy.rb +14 -15
  115. data/lib/chef/provider/deploy/timestamped.rb +0 -1
  116. data/lib/chef/provider/directory.rb +1 -3
  117. data/lib/chef/provider/execute.rb +2 -2
  118. data/lib/chef/provider/file.rb +1 -75
  119. data/lib/chef/provider/git.rb +11 -9
  120. data/lib/chef/provider/group/gpasswd.rb +14 -9
  121. data/lib/chef/provider/link.rb +28 -59
  122. data/lib/chef/provider/mdadm.rb +2 -2
  123. data/lib/chef/provider/mount/mount.rb +1 -1
  124. data/lib/chef/provider/package.rb +10 -6
  125. data/lib/chef/provider/package/apt.rb +3 -1
  126. data/lib/chef/provider/package/dpkg.rb +1 -1
  127. data/lib/chef/provider/package/portage.rb +6 -3
  128. data/lib/chef/provider/package/rubygems.rb +75 -6
  129. data/lib/chef/provider/package/smartos.rb +84 -0
  130. data/lib/chef/provider/package/yum-dump.py +3 -2
  131. data/lib/chef/provider/package/yum.rb +51 -10
  132. data/lib/chef/provider/remote_directory.rb +24 -3
  133. data/lib/chef/provider/remote_file.rb +0 -6
  134. data/lib/chef/provider/route.rb +3 -3
  135. data/lib/chef/provider/service/debian.rb +2 -2
  136. data/lib/chef/provider/service/freebsd.rb +1 -1
  137. data/lib/chef/provider/service/macosx.rb +125 -0
  138. data/lib/chef/provider/service/windows.rb +5 -1
  139. data/lib/chef/provider/subversion.rb +10 -7
  140. data/lib/chef/providers.rb +3 -0
  141. data/lib/chef/resource.rb +181 -87
  142. data/lib/chef/resource/apt_package.rb +10 -1
  143. data/lib/chef/resource/chef_gem.rb +53 -0
  144. data/lib/chef/resource/conditional.rb +3 -0
  145. data/lib/chef/resource/cookbook_file.rb +12 -6
  146. data/lib/chef/resource/cron.rb +9 -0
  147. data/lib/chef/resource/directory.rb +14 -31
  148. data/lib/chef/resource/execute.rb +11 -9
  149. data/lib/chef/resource/file.rb +9 -33
  150. data/lib/chef/resource/link.rb +13 -8
  151. data/lib/chef/resource/mdadm.rb +10 -1
  152. data/lib/chef/resource/remote_directory.rb +13 -2
  153. data/lib/chef/resource/remote_file.rb +14 -7
  154. data/lib/chef/resource/smartos_package.rb +36 -0
  155. data/lib/chef/resource/template.rb +12 -5
  156. data/lib/chef/resource_platform_map.rb +153 -0
  157. data/lib/chef/resources.rb +2 -0
  158. data/lib/chef/rest.rb +55 -10
  159. data/lib/chef/rest/auth_credentials.rb +1 -0
  160. data/lib/chef/rest/rest_request.rb +24 -8
  161. data/lib/chef/role.rb +8 -2
  162. data/lib/chef/run_list.rb +1 -1
  163. data/lib/chef/run_list/run_list_expansion.rb +2 -2
  164. data/lib/chef/run_list/run_list_item.rb +7 -0
  165. data/lib/chef/runner.rb +4 -0
  166. data/lib/chef/shef.rb +2 -2
  167. data/lib/chef/shef/shef_session.rb +4 -5
  168. data/lib/chef/shell_out.rb +2 -245
  169. data/lib/chef/util/file_edit.rb +99 -89
  170. data/lib/chef/version.rb +1 -1
  171. data/lib/chef/win32/api.rb +349 -0
  172. data/lib/chef/win32/api/error.rb +921 -0
  173. data/lib/chef/win32/api/file.rb +289 -0
  174. data/lib/chef/win32/api/memory.rb +105 -0
  175. data/lib/chef/win32/api/process.rb +40 -0
  176. data/lib/chef/win32/api/psapi.rb +51 -0
  177. data/lib/chef/win32/api/security.rb +341 -0
  178. data/lib/chef/win32/api/system.rb +192 -0
  179. data/lib/chef/win32/api/unicode.rb +178 -0
  180. data/lib/chef/win32/error.rb +73 -0
  181. data/lib/chef/win32/file.rb +117 -0
  182. data/lib/chef/win32/file/info.rb +100 -0
  183. data/lib/chef/win32/handle.rb +48 -0
  184. data/lib/chef/win32/memory.rb +101 -0
  185. data/lib/chef/win32/process.rb +84 -0
  186. data/lib/chef/win32/security.rb +489 -0
  187. data/lib/chef/win32/security/ace.rb +125 -0
  188. data/lib/chef/win32/security/acl.rb +101 -0
  189. data/lib/chef/win32/security/securable_object.rb +109 -0
  190. data/lib/chef/win32/security/security_descriptor.rb +93 -0
  191. data/lib/chef/win32/security/sid.rb +199 -0
  192. data/lib/chef/win32/security/token.rb +64 -0
  193. data/lib/chef/win32/unicode.rb +43 -0
  194. data/lib/chef/win32/version.rb +119 -0
  195. metadata +104 -158
  196. data/lib/chef/shell_out/unix.rb +0 -223
  197. data/lib/chef/shell_out/windows.rb +0 -588
@@ -27,8 +27,17 @@ class Chef
27
27
  super
28
28
  @resource_name = :apt_package
29
29
  @provider = Chef::Provider::Package::Apt
30
+ @default_release = nil
30
31
  end
31
-
32
+
33
+ def default_release(arg=nil)
34
+ set_or_return(
35
+ :default_release,
36
+ arg,
37
+ :kind_of => [ String ]
38
+ )
39
+ end
40
+
32
41
  end
33
42
  end
34
43
  end
@@ -0,0 +1,53 @@
1
+ #
2
+ # Author:: Bryan McLellan <btm@loftninjas.org>
3
+ # Copyright:: Copyright (c) 2012 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/resource/package'
20
+ require 'chef/resource/gem_package'
21
+
22
+ class Chef
23
+ class Resource
24
+ class ChefGem < Chef::Resource::Package::GemPackage
25
+
26
+ provides :chef_gem, :on_platforms => :all
27
+
28
+ def initialize(name, run_context=nil)
29
+ super
30
+ @resource_name = :chef_gem
31
+ @provider = Chef::Provider::Package::Rubygems
32
+ end
33
+
34
+ # The chef_gem resources is for installing gems to the current gem environment only for use by Chef cookbooks.
35
+ def gem_binary(arg=nil)
36
+ if arg
37
+ raise ArgumentError, "The chef_gem resource is restricted to the current gem environment, use gem_package to install to other environments."
38
+ end
39
+
40
+ nil
41
+ end
42
+
43
+ def after_created
44
+ # Chef::Resource.run_action: Caveat: this skips Chef::Runner.run_action, where notifications are handled
45
+ # Action could be an array of symbols, but probably won't (think install + enable for a package)
46
+ Array(@action).each do |action|
47
+ self.run_action(action)
48
+ end
49
+ Gem.clear_paths
50
+ end
51
+ end
52
+ end
53
+ end
@@ -74,6 +74,9 @@ class Chef
74
74
 
75
75
  def evaluate_command
76
76
  shell_out(@command, @command_opts).status.success?
77
+ rescue Chef::Exceptions::CommandTimeout
78
+ Chef::Log.warn "Command '#{@command}' timed out"
79
+ false
77
80
  end
78
81
 
79
82
  def evaluate_block
@@ -1,14 +1,15 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Copyright:: Copyright (c) 2008, 2011 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
7
8
  # you may not use this file except in compliance with the License.
8
9
  # You may obtain a copy of the License at
9
- #
10
+ #
10
11
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
+ #
12
13
  # Unless required by applicable law or agreed to in writing, software
13
14
  # distributed under the License is distributed on an "AS IS" BASIS,
14
15
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,11 +19,15 @@
18
19
 
19
20
  require 'chef/resource/file'
20
21
  require 'chef/provider/cookbook_file'
22
+ require 'chef/mixin/securable'
21
23
 
22
24
  class Chef
23
25
  class Resource
24
26
  class CookbookFile < Chef::Resource::File
25
-
27
+ include Chef::Mixin::Securable
28
+
29
+ provides :cookbook_file, :on_platforms => :all
30
+
26
31
  def initialize(name, run_context=nil)
27
32
  super
28
33
  @provider = Chef::Provider::CookbookFile
@@ -30,12 +35,13 @@ class Chef
30
35
  @action = "create"
31
36
  @source = ::File.basename(name)
32
37
  @cookbook = nil
38
+ @provider = Chef::Provider::CookbookFile
33
39
  end
34
-
40
+
35
41
  def source(source_filename=nil)
36
42
  set_or_return(:source, source_filename, :kind_of => String)
37
43
  end
38
-
44
+
39
45
  def cookbook(cookbook_name=nil)
40
46
  set_or_return(:cookbook, cookbook_name, :kind_of => String)
41
47
  end
@@ -38,6 +38,7 @@ class Chef
38
38
  @path = nil
39
39
  @shell = nil
40
40
  @home = nil
41
+ @environment = {}
41
42
  end
42
43
 
43
44
  def minute(arg=nil)
@@ -172,6 +173,14 @@ class Chef
172
173
  :kind_of => String
173
174
  )
174
175
  end
176
+
177
+ def environment(arg=nil)
178
+ set_or_return(
179
+ :environment,
180
+ arg,
181
+ :kind_of => Hash
182
+ )
183
+ end
175
184
 
176
185
  private
177
186
 
@@ -1,14 +1,15 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Copyright:: Copyright (c) 2008, 2011 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
7
8
  # you may not use this file except in compliance with the License.
8
9
  # You may obtain a copy of the License at
9
- #
10
+ #
10
11
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
+ #
12
13
  # Unless required by applicable law or agreed to in writing, software
13
14
  # distributed under the License is distributed on an "AS IS" BASIS,
14
15
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +18,16 @@
17
18
  #
18
19
 
19
20
  require 'chef/resource'
21
+ require 'chef/provider/directory'
22
+ require 'chef/mixin/securable'
20
23
 
21
24
  class Chef
22
25
  class Resource
23
26
  class Directory < Chef::Resource
24
-
27
+ include Chef::Mixin::Securable
28
+
29
+ provides :directory, :on_platforms => :all
30
+
25
31
  def initialize(name, run_context=nil)
26
32
  super
27
33
  @resource_name = :directory
@@ -29,8 +35,9 @@ class Chef
29
35
  @action = :create
30
36
  @recursive = false
31
37
  @allowed_actions.push(:create, :delete)
38
+ @provider = Chef::Provider::Directory
32
39
  end
33
-
40
+
34
41
  def recursive(arg=nil)
35
42
  set_or_return(
36
43
  :recursive,
@@ -38,31 +45,7 @@ class Chef
38
45
  :kind_of => [ TrueClass, FalseClass ]
39
46
  )
40
47
  end
41
-
42
- def group(arg=nil)
43
- set_or_return(
44
- :group,
45
- arg,
46
- :regex => Chef::Config[:group_valid_regex]
47
- )
48
- end
49
-
50
- def mode(arg=nil)
51
- set_or_return(
52
- :mode,
53
- arg,
54
- :regex => /^\d{3,4}$/
55
- )
56
- end
57
-
58
- def owner(arg=nil)
59
- set_or_return(
60
- :owner,
61
- arg,
62
- :regex => Chef::Config[:user_valid_regex]
63
- )
64
- end
65
-
48
+
66
49
  def path(arg=nil)
67
50
  set_or_return(
68
51
  :path,
@@ -70,7 +53,7 @@ class Chef
70
53
  :kind_of => String
71
54
  )
72
55
  end
73
-
56
+
74
57
  end
75
58
  end
76
59
  end
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -47,7 +47,7 @@ class Chef
47
47
  :kind_of => [ String, Integer ]
48
48
  )
49
49
  end
50
-
50
+
51
51
  def command(arg=nil)
52
52
  set_or_return(
53
53
  :command,
@@ -55,7 +55,7 @@ class Chef
55
55
  :kind_of => [ String ]
56
56
  )
57
57
  end
58
-
58
+
59
59
  def creates(arg=nil)
60
60
  set_or_return(
61
61
  :creates,
@@ -63,7 +63,7 @@ class Chef
63
63
  :kind_of => [ String ]
64
64
  )
65
65
  end
66
-
66
+
67
67
  def cwd(arg=nil)
68
68
  set_or_return(
69
69
  :cwd,
@@ -79,7 +79,9 @@ class Chef
79
79
  :kind_of => [ Hash ]
80
80
  )
81
81
  end
82
-
82
+
83
+ alias :env :environment
84
+
83
85
  def group(arg=nil)
84
86
  set_or_return(
85
87
  :group,
@@ -95,7 +97,7 @@ class Chef
95
97
  :kind_of => [ Array ]
96
98
  )
97
99
  end
98
-
100
+
99
101
  def returns(arg=nil)
100
102
  set_or_return(
101
103
  :returns,
@@ -103,7 +105,7 @@ class Chef
103
105
  :kind_of => [ Integer, Array ]
104
106
  )
105
107
  end
106
-
108
+
107
109
  def timeout(arg=nil)
108
110
  set_or_return(
109
111
  :timeout,
@@ -111,7 +113,7 @@ class Chef
111
113
  :kind_of => [ Integer ]
112
114
  )
113
115
  end
114
-
116
+
115
117
  def user(arg=nil)
116
118
  set_or_return(
117
119
  :user,
@@ -1,6 +1,7 @@
1
1
  #
2
2
  # Author:: Adam Jacob (<adam@opscode.com>)
3
- # Copyright:: Copyright (c) 2008 Opscode, Inc.
3
+ # Author:: Seth Chisamore (<schisamo@opscode.com>)
4
+ # Copyright:: Copyright (c) 2008, 2011 Opscode, Inc.
4
5
  # License:: Apache License, Version 2.0
5
6
  #
6
7
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,11 +18,16 @@
17
18
  #
18
19
 
19
20
  require 'chef/resource'
21
+ require 'chef/provider/file'
22
+ require 'chef/mixin/securable'
20
23
 
21
24
  class Chef
22
25
  class Resource
23
26
  class File < Chef::Resource
24
-
27
+ include Chef::Mixin::Securable
28
+
29
+ provides :file, :on_platforms => :all
30
+
25
31
  def initialize(name, run_context=nil)
26
32
  super
27
33
  @resource_name = :file
@@ -29,6 +35,7 @@ class Chef
29
35
  @backup = 5
30
36
  @action = "create"
31
37
  @allowed_actions.push(:create, :delete, :touch, :create_if_missing)
38
+ @provider = Chef::Provider::File
32
39
  end
33
40
 
34
41
  def content(arg=nil)
@@ -55,37 +62,6 @@ class Chef
55
62
  )
56
63
  end
57
64
 
58
- def group(arg=nil)
59
- set_or_return(
60
- :group,
61
- arg,
62
- :regex => Chef::Config[:group_valid_regex]
63
- )
64
- end
65
-
66
- def mode(arg=nil)
67
- set_or_return(
68
- :mode,
69
- arg,
70
- :callbacks => {
71
- "not in valid numeric range" => lambda { |m|
72
- if m.kind_of?(String)
73
- m =~ /^0/ || m="0#{m}"
74
- end
75
- Integer(m)<=07777 && Integer(m)>=0
76
- }
77
- }
78
- )
79
- end
80
-
81
- def owner(arg=nil)
82
- set_or_return(
83
- :owner,
84
- arg,
85
- :regex => Chef::Config[:user_valid_regex]
86
- )
87
- end
88
-
89
65
  def path(arg=nil)
90
66
  set_or_return(
91
67
  :path,
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,15 @@
17
17
  #
18
18
 
19
19
  require 'chef/resource'
20
+ require 'chef/mixin/securable'
20
21
 
21
22
  class Chef
22
23
  class Resource
23
24
  class Link < Chef::Resource
24
-
25
+ include Chef::Mixin::Securable
26
+
27
+ provides :link, :on_platform => :all
28
+
25
29
  def initialize(name, run_context=nil)
26
30
  super
27
31
  @resource_name = :link
@@ -30,8 +34,9 @@ class Chef
30
34
  @link_type = :symbolic
31
35
  @target_file = name
32
36
  @allowed_actions.push(:create, :delete)
37
+ @provider = Chef::Provider::Link
33
38
  end
34
-
39
+
35
40
  def to(arg=nil)
36
41
  set_or_return(
37
42
  :source_file,
@@ -39,7 +44,7 @@ class Chef
39
44
  :kind_of => String
40
45
  )
41
46
  end
42
-
47
+
43
48
  def target_file(arg=nil)
44
49
  set_or_return(
45
50
  :target_file,
@@ -47,7 +52,7 @@ class Chef
47
52
  :kind_of => String
48
53
  )
49
54
  end
50
-
55
+
51
56
  def link_type(arg=nil)
52
57
  real_arg = arg.kind_of?(String) ? arg.to_sym : arg
53
58
  set_or_return(
@@ -56,7 +61,7 @@ class Chef
56
61
  :equal_to => [ :symbolic, :hard ]
57
62
  )
58
63
  end
59
-
64
+
60
65
  def group(arg=nil)
61
66
  set_or_return(
62
67
  :group,
@@ -64,7 +69,7 @@ class Chef
64
69
  :regex => Chef::Config[:group_valid_regex]
65
70
  )
66
71
  end
67
-
72
+
68
73
  def owner(arg=nil)
69
74
  set_or_return(
70
75
  :owner,