chef 0.7.10

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of chef might be problematic. Click here for more details.

Files changed (120) hide show
  1. data/LICENSE +201 -0
  2. data/README.rdoc +135 -0
  3. data/bin/chef-client +26 -0
  4. data/bin/chef-solo +26 -0
  5. data/lib/chef.rb +49 -0
  6. data/lib/chef/application.rb +98 -0
  7. data/lib/chef/application/agent.rb +18 -0
  8. data/lib/chef/application/client.rb +209 -0
  9. data/lib/chef/application/indexer.rb +141 -0
  10. data/lib/chef/application/server.rb +18 -0
  11. data/lib/chef/application/solo.rb +214 -0
  12. data/lib/chef/client.rb +396 -0
  13. data/lib/chef/compile.rb +138 -0
  14. data/lib/chef/config.rb +141 -0
  15. data/lib/chef/cookbook.rb +144 -0
  16. data/lib/chef/cookbook/metadata.rb +407 -0
  17. data/lib/chef/cookbook/metadata/version.rb +87 -0
  18. data/lib/chef/cookbook_loader.rb +168 -0
  19. data/lib/chef/couchdb.rb +172 -0
  20. data/lib/chef/daemon.rb +170 -0
  21. data/lib/chef/exceptions.rb +36 -0
  22. data/lib/chef/file_cache.rb +205 -0
  23. data/lib/chef/log.rb +39 -0
  24. data/lib/chef/mixin/check_helper.rb +31 -0
  25. data/lib/chef/mixin/checksum.rb +37 -0
  26. data/lib/chef/mixin/command.rb +351 -0
  27. data/lib/chef/mixin/create_path.rb +56 -0
  28. data/lib/chef/mixin/deep_merge.rb +36 -0
  29. data/lib/chef/mixin/find_preferred_file.rb +99 -0
  30. data/lib/chef/mixin/from_file.rb +36 -0
  31. data/lib/chef/mixin/generate_url.rb +48 -0
  32. data/lib/chef/mixin/language.rb +79 -0
  33. data/lib/chef/mixin/params_validate.rb +197 -0
  34. data/lib/chef/mixin/template.rb +84 -0
  35. data/lib/chef/node.rb +406 -0
  36. data/lib/chef/node/attribute.rb +412 -0
  37. data/lib/chef/openid_registration.rb +181 -0
  38. data/lib/chef/platform.rb +253 -0
  39. data/lib/chef/provider.rb +40 -0
  40. data/lib/chef/provider/cron.rb +137 -0
  41. data/lib/chef/provider/directory.rb +72 -0
  42. data/lib/chef/provider/execute.rb +58 -0
  43. data/lib/chef/provider/file.rb +191 -0
  44. data/lib/chef/provider/group.rb +120 -0
  45. data/lib/chef/provider/group/groupadd.rb +92 -0
  46. data/lib/chef/provider/group/pw.rb +88 -0
  47. data/lib/chef/provider/http_request.rb +102 -0
  48. data/lib/chef/provider/ifconfig.rb +131 -0
  49. data/lib/chef/provider/link.rb +157 -0
  50. data/lib/chef/provider/mount.rb +121 -0
  51. data/lib/chef/provider/mount/mount.rb +208 -0
  52. data/lib/chef/provider/package.rb +160 -0
  53. data/lib/chef/provider/package/apt.rb +110 -0
  54. data/lib/chef/provider/package/dpkg.rb +113 -0
  55. data/lib/chef/provider/package/freebsd.rb +153 -0
  56. data/lib/chef/provider/package/macports.rb +105 -0
  57. data/lib/chef/provider/package/portage.rb +124 -0
  58. data/lib/chef/provider/package/rpm.rb +99 -0
  59. data/lib/chef/provider/package/rubygems.rb +130 -0
  60. data/lib/chef/provider/package/yum-dump.py +104 -0
  61. data/lib/chef/provider/package/yum.rb +175 -0
  62. data/lib/chef/provider/remote_directory.rb +126 -0
  63. data/lib/chef/provider/remote_file.rb +134 -0
  64. data/lib/chef/provider/route.rb +118 -0
  65. data/lib/chef/provider/ruby_block.rb +15 -0
  66. data/lib/chef/provider/script.rb +42 -0
  67. data/lib/chef/provider/service.rb +129 -0
  68. data/lib/chef/provider/service/debian.rb +64 -0
  69. data/lib/chef/provider/service/freebsd.rb +157 -0
  70. data/lib/chef/provider/service/gentoo.rb +54 -0
  71. data/lib/chef/provider/service/init.rb +126 -0
  72. data/lib/chef/provider/service/redhat.rb +62 -0
  73. data/lib/chef/provider/template.rb +141 -0
  74. data/lib/chef/provider/user.rb +170 -0
  75. data/lib/chef/provider/user/pw.rb +113 -0
  76. data/lib/chef/provider/user/useradd.rb +107 -0
  77. data/lib/chef/queue.rb +145 -0
  78. data/lib/chef/recipe.rb +210 -0
  79. data/lib/chef/resource.rb +256 -0
  80. data/lib/chef/resource/apt_package.rb +34 -0
  81. data/lib/chef/resource/bash.rb +33 -0
  82. data/lib/chef/resource/cron.rb +143 -0
  83. data/lib/chef/resource/csh.rb +33 -0
  84. data/lib/chef/resource/directory.rb +76 -0
  85. data/lib/chef/resource/dpkg_package.rb +34 -0
  86. data/lib/chef/resource/execute.rb +127 -0
  87. data/lib/chef/resource/file.rb +84 -0
  88. data/lib/chef/resource/gem_package.rb +41 -0
  89. data/lib/chef/resource/group.rb +68 -0
  90. data/lib/chef/resource/http_request.rb +52 -0
  91. data/lib/chef/resource/ifconfig.rb +134 -0
  92. data/lib/chef/resource/link.rb +78 -0
  93. data/lib/chef/resource/macports_package.rb +29 -0
  94. data/lib/chef/resource/mount.rb +135 -0
  95. data/lib/chef/resource/package.rb +80 -0
  96. data/lib/chef/resource/perl.rb +33 -0
  97. data/lib/chef/resource/portage_package.rb +33 -0
  98. data/lib/chef/resource/python.rb +33 -0
  99. data/lib/chef/resource/remote_directory.rb +91 -0
  100. data/lib/chef/resource/remote_file.rb +60 -0
  101. data/lib/chef/resource/route.rb +135 -0
  102. data/lib/chef/resource/ruby.rb +33 -0
  103. data/lib/chef/resource/ruby_block.rb +20 -0
  104. data/lib/chef/resource/script.rb +51 -0
  105. data/lib/chef/resource/service.rb +134 -0
  106. data/lib/chef/resource/template.rb +60 -0
  107. data/lib/chef/resource/user.rb +98 -0
  108. data/lib/chef/resource_collection.rb +176 -0
  109. data/lib/chef/resource_definition.rb +67 -0
  110. data/lib/chef/rest.rb +238 -0
  111. data/lib/chef/role.rb +231 -0
  112. data/lib/chef/run_list.rb +156 -0
  113. data/lib/chef/runner.rb +123 -0
  114. data/lib/chef/search.rb +88 -0
  115. data/lib/chef/search/result.rb +64 -0
  116. data/lib/chef/search_index.rb +77 -0
  117. data/lib/chef/tasks/chef_repo.rake +345 -0
  118. data/lib/chef/util/file_edit.rb +125 -0
  119. data/lib/chef/util/fileedit.rb +121 -0
  120. metadata +262 -0
@@ -0,0 +1,126 @@
1
+ #
2
+ # Author:: AJ Christensen (<aj@hjksolutions.com>)
3
+ # Copyright:: Copyright (c) 2008 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/provider/service'
20
+ require 'chef/mixin/command'
21
+
22
+ class Chef
23
+ class Provider
24
+ class Service
25
+ class Init < Chef::Provider::Service
26
+
27
+ def initialize(node, new_resource)
28
+ super(node, new_resource)
29
+ @init_command = "/etc/init.d/#{@new_resource.service_name}"
30
+ end
31
+
32
+ def load_current_resource
33
+ @current_resource = Chef::Resource::Service.new(@new_resource.name)
34
+ @current_resource.service_name(@new_resource.service_name)
35
+ if @new_resource.status_command
36
+ Chef::Log.debug("#{@new_resource} you have specified a status command, running..")
37
+
38
+ begin
39
+ if run_command(:command => @new_resource.status_command) == 0
40
+ @current_resource.running true
41
+ end
42
+ rescue Chef::Exceptions::Exec
43
+ @current_resource.running false
44
+ nil
45
+ end
46
+
47
+ elsif @new_resource.supports[:status]
48
+ Chef::Log.debug("#{@new_resource} supports status, running")
49
+
50
+ begin
51
+ if run_command(:command => "#{@init_command} status") == 0
52
+ @current_resource.running true
53
+ end
54
+ rescue Chef::Exceptions::Exec
55
+ @current_resource.running false
56
+ nil
57
+ end
58
+
59
+ else
60
+ Chef::Log.debug("#{@new_resource} does not support status and you have not specified a status command, falling back to process table inspection")
61
+
62
+ if @node[:command][:ps].nil? or @node[:command][:ps].empty?
63
+ raise Chef::Exceptions::Service, "#{@new_resource}: could not determine how to inspect the process table, please set this nodes 'ps' attribute"
64
+ end
65
+
66
+ status = popen4(@node[:command][:ps]) do |pid, stdin, stdout, stderr|
67
+ r = Regexp.new(@new_resource.pattern)
68
+ Chef::Log.debug("#{@new_resource}: attempting to match #{@new_resource.pattern} (#{r}) against process table")
69
+ stdout.each_line do |line|
70
+ if r.match(line)
71
+ @current_resource.running true
72
+ break
73
+ end
74
+ end
75
+ @current_resource.running false unless @current_resource.running
76
+ end
77
+ unless status.exitstatus == 0
78
+ raise Chef::Exceptions::Service, "Command #{@node[:command][:ps]} failed"
79
+ else
80
+ Chef::Log.debug("#{@new_resource}: #{@node[:command][:ps]} exited and parsed successfully, process running: #{@current_resource.running}")
81
+ end
82
+ end
83
+
84
+ @current_resource
85
+ end
86
+
87
+ def start_service
88
+ if @new_resource.start_command
89
+ run_command(:command => @new_resource.start_command)
90
+ else
91
+ run_command(:command => "#{@init_command} start")
92
+ end
93
+ end
94
+
95
+ def stop_service
96
+ if @new_resource.stop_command
97
+ run_command(:command => @new_resource.stop_command)
98
+ else
99
+ run_command(:command => "#{@init_command} stop")
100
+ end
101
+ end
102
+
103
+ def restart_service
104
+ if @new_resource.restart_command
105
+ run_command(:command => @new_resource.restart_command)
106
+ elsif @new_resource.supports[:restart]
107
+ run_command(:command => "#{@init_command} restart")
108
+ else
109
+ stop_service
110
+ sleep 1
111
+ start_service
112
+ end
113
+ end
114
+
115
+ def reload_service
116
+ if @new_resource.reload_command
117
+ run_command(:command => @new_resource.reload_command)
118
+ elsif @new_resource.supports[:reload]
119
+ run_command(:command => "#{@init_command} reload")
120
+ end
121
+ end
122
+
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,62 @@
1
+ #
2
+ # Author:: AJ Christensen (<aj@hjksolutions.com>)
3
+ # Copyright:: Copyright (c) 2008 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/provider/service'
20
+ require 'chef/provider/service/init'
21
+ require 'chef/mixin/command'
22
+
23
+ class Chef
24
+ class Provider
25
+ class Service
26
+ class Redhat < Chef::Provider::Service::Init
27
+
28
+ def initialize(node, new_resource)
29
+ super(node, new_resource)
30
+ @init_command = "/sbin/service #{@new_resource.service_name}"
31
+ end
32
+
33
+ def load_current_resource
34
+ super
35
+
36
+ unless ::File.exists? "/sbin/chkconfig"
37
+ raise Chef::Exceptions::Service, "/sbin/chkconfig does not exist!"
38
+ end
39
+
40
+ status = popen4("/sbin/chkconfig --list #{@current_resource.service_name}") do |pid, stdin, stdout, stderr|
41
+ if stdout.gets =~ /\d:on/
42
+ @current_resource.enabled true
43
+ else
44
+ @current_resource.enabled false
45
+ end
46
+ end
47
+
48
+ @current_resource
49
+ end
50
+
51
+ def enable_service()
52
+ run_command(:command => "/sbin/chkconfig #{@new_resource.service_name} on")
53
+ end
54
+
55
+ def disable_service()
56
+ run_command(:command => "/sbin/chkconfig #{@new_resource.service_name} off")
57
+ end
58
+
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,141 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 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/provider/file'
20
+ require 'chef/mixin/template'
21
+ require 'chef/mixin/checksum'
22
+ require 'chef/mixin/find_preferred_file'
23
+ require 'chef/rest'
24
+ require 'chef/file_cache'
25
+ require 'uri'
26
+ require 'tempfile'
27
+
28
+ class Chef
29
+ class Provider
30
+ class Template < Chef::Provider::File
31
+
32
+ include Chef::Mixin::Checksum
33
+ include Chef::Mixin::Template
34
+ include Chef::Mixin::FindPreferredFile
35
+
36
+ def action_create
37
+ Chef::Log.debug(@node.run_state.inspect)
38
+ raw_template_file = nil
39
+
40
+ cookbook_name = @new_resource.cookbook || @new_resource.cookbook_name
41
+
42
+ cache_file_name = "cookbooks/#{cookbook_name}/templates/default/#{@new_resource.source}"
43
+ template_cache_name = "#{cookbook_name}_#{@new_resource.source}"
44
+
45
+ if Chef::Config[:solo]
46
+ filename = find_preferred_file(
47
+ cookbook_name,
48
+ :template,
49
+ @new_resource.source,
50
+ @node[:fqdn],
51
+ @node[:platform],
52
+ @node[:platform_version]
53
+ )
54
+ Chef::Log.debug("Using local file for template:#{filename}")
55
+ cache_file_name = Pathname.new(filename).relative_path_from(Pathname.new(Chef::Config[:file_cache_path])).to_s
56
+ elsif @node.run_state[:template_cache].has_key?(template_cache_name)
57
+ Chef::Log.debug("I have already fetched the template for #{@new_resource} once this run, not checking again.")
58
+ template_updated = false
59
+ else
60
+ r = Chef::REST.new(Chef::Config[:template_url])
61
+
62
+ current_checksum = nil
63
+
64
+ if Chef::FileCache.has_key?(cache_file_name)
65
+ current_checksum = self.checksum(Chef::FileCache.load(cache_file_name, false))
66
+ else
67
+ Chef::Log.debug("Template #{@new_resource} is not in the template cache")
68
+ end
69
+
70
+ template_url = generate_url(
71
+ @new_resource.source,
72
+ "templates",
73
+ {
74
+ :checksum => current_checksum
75
+ }
76
+ )
77
+
78
+ template_updated = true
79
+ begin
80
+ raw_template_file = r.get_rest(template_url, true)
81
+ rescue Net::HTTPRetriableError => e
82
+ if e.response.kind_of?(Net::HTTPNotModified)
83
+ template_updated = false
84
+ Chef::Log.debug("Cached template for #{@new_resource} is unchanged")
85
+ else
86
+ raise e
87
+ end
88
+ end
89
+
90
+ # We have checked the cache for this template this run
91
+ @node.run_state[:template_cache][template_cache_name] = true
92
+ end
93
+
94
+ if template_updated
95
+ Chef::Log.debug("Updating template for #{@new_resource} in the cache")
96
+ Chef::FileCache.move_to(raw_template_file.path, cache_file_name)
97
+ end
98
+
99
+ context = {}
100
+ context.merge!(@new_resource.variables)
101
+ context[:node] = @node
102
+ template_file = render_template(Chef::FileCache.load(cache_file_name), context)
103
+
104
+ update = false
105
+
106
+ if ::File.exists?(@new_resource.path)
107
+ @new_resource.checksum(self.checksum(template_file.path))
108
+ if @new_resource.checksum != @current_resource.checksum
109
+ Chef::Log.debug("#{@new_resource} changed from #{@current_resource.checksum} to #{@new_resource.checksum}")
110
+ Chef::Log.info("Updating #{@new_resource} at #{@new_resource.path}")
111
+ update = true
112
+ end
113
+ else
114
+ Chef::Log.info("Creating #{@new_resource} at #{@new_resource.path}")
115
+ update = true
116
+ end
117
+
118
+ if update
119
+ backup
120
+ FileUtils.cp(template_file.path, @new_resource.path)
121
+ @new_resource.updated = true
122
+ else
123
+ Chef::Log.debug("#{@new_resource} is unchanged")
124
+ end
125
+
126
+ set_owner if @new_resource.owner != nil
127
+ set_group if @new_resource.group != nil
128
+ set_mode if @new_resource.mode != nil
129
+ end
130
+
131
+ def action_create_if_missing
132
+ if ::File.exists?(@new_resource.path)
133
+ Chef::Log.debug("Template #{@new_resource} exists, taking no action.")
134
+ else
135
+ action_create
136
+ end
137
+ end
138
+
139
+ end
140
+ end
141
+ end
@@ -0,0 +1,170 @@
1
+ #
2
+ # Author:: Adam Jacob (<adam@opscode.com>)
3
+ # Copyright:: Copyright (c) 2008 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/provider'
20
+ require 'chef/mixin/command'
21
+ require 'chef/resource/user'
22
+ require 'etc'
23
+
24
+ class Chef
25
+ class Provider
26
+ class User < Chef::Provider
27
+
28
+ include Chef::Mixin::Command
29
+
30
+ attr_accessor :user_exists, :locked
31
+
32
+ def initialize(node, new_resource)
33
+ super(node, new_resource)
34
+ @user_exists = true
35
+ @locked = nil
36
+ end
37
+
38
+ def convert_group_name
39
+ if @new_resource.gid.is_a? String
40
+ @new_resource.gid Etc.getgrnam(@new_resource.gid).gid
41
+ end
42
+ rescue ArgumentError => e
43
+ raise Chef::Exceptions::User, "Couldn't lookup integer GID for group name #{@new_resource.gid}"
44
+ end
45
+
46
+ def load_current_resource
47
+ @current_resource = Chef::Resource::User.new(@new_resource.name)
48
+ @current_resource.username(@new_resource.username)
49
+
50
+ user_info = nil
51
+ begin
52
+ user_info = Etc.getpwnam(@new_resource.username)
53
+ rescue ArgumentError => e
54
+ @user_exists = false
55
+ Chef::Log.debug("User #{@new_resource.username} does not exist")
56
+ end
57
+
58
+ if user_info
59
+ @current_resource.uid(user_info.uid)
60
+ @current_resource.gid(user_info.gid)
61
+ @current_resource.comment(user_info.gecos)
62
+ @current_resource.home(user_info.dir)
63
+ @current_resource.shell(user_info.shell)
64
+ @current_resource.password(user_info.passwd)
65
+
66
+ if @new_resource.password && @current_resource.password == 'x'
67
+ begin
68
+ require 'shadow'
69
+ rescue LoadError
70
+ Chef::Log.error("You must have ruby-shadow installed for password support!")
71
+ raise Chef::Exceptions::MissingLibrary, "You must have ruby-shadow installed for password support!"
72
+ else
73
+ shadow_info = Shadow::Passwd.getspnam(@new_resource.username)
74
+ @current_resource.password(shadow_info.sp_pwdp)
75
+ end
76
+ end
77
+
78
+ if @new_resource.gid
79
+ convert_group_name
80
+ end
81
+ end
82
+
83
+ @current_resource
84
+ end
85
+
86
+ # Check to see if the user needs any changes
87
+ #
88
+ # === Returns
89
+ # <true>:: If a change is required
90
+ # <false>:: If the users are identical
91
+ def compare_user
92
+ [ :uid, :gid, :comment, :home, :shell, :password ].any? do |user_attrib|
93
+ !@new_resource.send(user_attrib).nil? && @new_resource.send(user_attrib) != @current_resource.send(user_attrib)
94
+ end
95
+ end
96
+
97
+ def action_create
98
+ case @user_exists
99
+ when false
100
+ create_user
101
+ Chef::Log.info("Created #{@new_resource}")
102
+ @new_resource.updated = true
103
+ else
104
+ if compare_user
105
+ manage_user
106
+ Chef::Log.info("Altered #{@new_resource}")
107
+ @new_resource.updated = true
108
+ end
109
+ end
110
+ end
111
+
112
+ def action_remove
113
+ if @user_exists
114
+ remove_user
115
+ @new_resource.updated = true
116
+ Chef::Log.info("Removed #{@new_resource}")
117
+ end
118
+ end
119
+
120
+ def action_manage
121
+ if @user_exists && compare_user
122
+ manage_user
123
+ @new_resource.updated = true
124
+ Chef::Log.info("Managed #{@new_resource}")
125
+ end
126
+ end
127
+
128
+ def action_modify
129
+ if @user_exists
130
+ if compare_user
131
+ manage_user
132
+ @new_resource.updated = true
133
+ Chef::Log.info("Modified #{@new_resource}")
134
+ end
135
+ else
136
+ raise Chef::Exceptions::User, "Cannot modify #{@new_resource} - user does not exist!"
137
+ end
138
+ end
139
+
140
+ def action_lock
141
+ if @user_exists
142
+ if check_lock() == false
143
+ lock_user
144
+ @new_resource.updated = true
145
+ Chef::Log.info("Locked #{@new_resource}")
146
+ else
147
+ Chef::Log.debug("No need to lock #{@new_resource}")
148
+ end
149
+ else
150
+ raise Chef::Exceptions::User, "Cannot lock #{@new_resource} - user does not exist!"
151
+ end
152
+ end
153
+
154
+ def action_unlock
155
+ if @user_exists
156
+ if check_lock() == true
157
+ unlock_user
158
+ @new_resource.updated = true
159
+ Chef::Log.info("Unlocked #{@new_resource}")
160
+ else
161
+ Chef::Log.debug("No need to unlock #{@new_resource}")
162
+ end
163
+ else
164
+ raise Chef::Exceptions::User, "Cannot unlock #{@new_resource} - user does not exist!"
165
+ end
166
+ end
167
+
168
+ end
169
+ end
170
+ end