diff options
author | Seth Vargo <sethvargo@gmail.com> | 2013-09-24 17:38:44 -0400 |
---|---|---|
committer | Bryan McLellan <btm@opscode.com> | 2013-09-26 11:13:59 -0700 |
commit | 6315871ae7deeead95d84d2487c54a03c47e318f (patch) | |
tree | a2bf980c434c657aa350c0d3fc4073652cdf43cf /lib/chef/provider | |
parent | 61e98b94fb387353841d5b4575816a1d716cfbc9 (diff) | |
download | chef-6315871ae7deeead95d84d2487c54a03c47e318f.tar.gz |
Normalize whitespace on all files
Diffstat (limited to 'lib/chef/provider')
55 files changed, 316 insertions, 316 deletions
diff --git a/lib/chef/provider/batch.rb b/lib/chef/provider/batch.rb index e4b35b64f3..354a640e59 100644 --- a/lib/chef/provider/batch.rb +++ b/lib/chef/provider/batch.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ class Chef def flags @new_resource.flags.nil? ? '/c' : new_resource.flags + ' /c' end - + end end end diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb index 4430e3e18f..f6f062a410 100644 --- a/lib/chef/provider/cron.rb +++ b/lib/chef/provider/cron.rb @@ -40,7 +40,7 @@ class Chef def whyrun_supported? true end - + def load_current_resource crontab_lines = [] @current_resource = Chef::Resource::Cron.new(@new_resource.name) @@ -82,7 +82,7 @@ class Chef @current_resource end - + def cron_different? CRON_ATTRIBUTES.any? do |cron_var| !@new_resource.send(cron_var).nil? && @new_resource.send(cron_var) != @current_resource.send(cron_var) @@ -165,7 +165,7 @@ class Chef end crontab << line end - description = cron_found ? "remove #{@new_resource.name} from crontab" : + description = cron_found ? "remove #{@new_resource.name} from crontab" : "save unmodified crontab" converge_by(description) do write_crontab crontab diff --git a/lib/chef/provider/cron/solaris.rb b/lib/chef/provider/cron/solaris.rb index 6861820676..20fa7abcce 100644 --- a/lib/chef/provider/cron/solaris.rb +++ b/lib/chef/provider/cron/solaris.rb @@ -19,4 +19,4 @@ require "chef/provider/cron/unix" # Just to create an alias so 'Chef::Provider::Cron::Solaris' is exposed and accessible to existing consumers of class. -Chef::Provider::Cron::Solaris = Chef::Provider::Cron::Unix
\ No newline at end of file +Chef::Provider::Cron::Solaris = Chef::Provider::Cron::Unix diff --git a/lib/chef/provider/cron/unix.rb b/lib/chef/provider/cron/unix.rb index 1149f43f76..5cb1bcda41 100644 --- a/lib/chef/provider/cron/unix.rb +++ b/lib/chef/provider/cron/unix.rb @@ -63,7 +63,7 @@ class Chef Chef::Log.debug(e.message) exit_status = 1 error_message = e.message - end + end tempcron.close! if exit_status > 0 raise Chef::Exceptions::Cron, "Error updating state of #{@new_resource.name}, exit: #{exit_status}, message: #{error_message}" diff --git a/lib/chef/provider/deploy/timestamped.rb b/lib/chef/provider/deploy/timestamped.rb index 9c2d55b490..ce921161e0 100644 --- a/lib/chef/provider/deploy/timestamped.rb +++ b/lib/chef/provider/deploy/timestamped.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,9 +20,9 @@ class Chef class Provider class Deploy class Timestamped < Chef::Provider::Deploy - + protected - + def release_slug Time.now.utc.strftime("%Y%m%d%H%M%S") end diff --git a/lib/chef/provider/erl_call.rb b/lib/chef/provider/erl_call.rb index 1ee1da500c..cdd494a243 100644 --- a/lib/chef/provider/erl_call.rb +++ b/lib/chef/provider/erl_call.rb @@ -32,7 +32,7 @@ class Chef def whyrun_supported? true end - + def load_current_resource true end diff --git a/lib/chef/provider/execute.rb b/lib/chef/provider/execute.rb index 8d2a7d997d..2907688e88 100644 --- a/lib/chef/provider/execute.rb +++ b/lib/chef/provider/execute.rb @@ -29,7 +29,7 @@ class Chef def load_current_resource true end - + def whyrun_supported? true end @@ -56,7 +56,7 @@ class Chef if STDOUT.tty? && !Chef::Config[:daemon] && Chef::Log.info? opts[:live_stream] = STDOUT end - converge_by("execute #{@new_resource.command}") do + converge_by("execute #{@new_resource.command}") do result = shell_out!(@new_resource.command, opts) Chef::Log.info("#{@new_resource} ran successfully") end diff --git a/lib/chef/provider/group.rb b/lib/chef/provider/group.rb index c941ed72bd..eacb033492 100644 --- a/lib/chef/provider/group.rb +++ b/lib/chef/provider/group.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -35,11 +35,11 @@ class Chef super @group_exists = true end - + def load_current_resource @current_resource = Chef::Resource::Group.new(@new_resource.name) @current_resource.group_name(@new_resource.group_name) - + group_info = nil begin group_info = Etc.getgrnam(@new_resource.group_name) @@ -47,26 +47,26 @@ class Chef @group_exists = false Chef::Log.debug("#{@new_resource} group does not exist") end - + if group_info @new_resource.gid(group_info.gid) unless @new_resource.gid @current_resource.gid(group_info.gid) @current_resource.members(group_info.mem) end - + @current_resource end def define_resource_requirements - requirements.assert(:modify) do |a| - a.assertion { @group_exists } + requirements.assert(:modify) do |a| + a.assertion { @group_exists } a.failure_message(Chef::Exceptions::Group, "Cannot modify #{@new_resource} - group does not exist!") a.whyrun("Group #{@new_resource} does not exist. Unless it would have been created earlier in this run, this attempt to modify it would fail.") end end - - # Check to see if a group needs any changes. Populate - # @change_desc with a description of why a change must occur + + # Check to see if a group needs any changes. Populate + # @change_desc with a description of why a change must occur # # ==== Returns # <true>:: If a change is required @@ -77,7 +77,7 @@ class Chef @change_desc = "change gid #{@current_resource.gid} to #{@new_resource.gid}" return true end - + if(@new_resource.append) missing_members = [] @new_resource.members.each do |member| @@ -96,24 +96,24 @@ class Chef end return false end - + def action_create case @group_exists when false - converge_by("create #{@new_resource}") do + converge_by("create #{@new_resource}") do create_group Chef::Log.info("#{@new_resource} created") end - else + else if compare_group - converge_by(["alter group #{@new_resource}", @change_desc ]) do + converge_by(["alter group #{@new_resource}", @change_desc ]) do manage_group Chef::Log.info("#{@new_resource} altered") end end end end - + def action_remove if @group_exists converge_by("remove group #{@new_resource}") do @@ -122,16 +122,16 @@ class Chef end end end - + def action_manage if @group_exists && compare_group converge_by(["manage group #{@new_resource}", @change_desc]) do - manage_group + manage_group Chef::Log.info("#{@new_resource} managed") end end end - + def action_modify if compare_group converge_by(["modify group #{@new_resource}", @change_desc]) do @@ -140,7 +140,7 @@ class Chef end end end - + def create_group raise NotImplementedError, "subclasses of Chef::Provider::Group should define #create_group" end diff --git a/lib/chef/provider/group/dscl.rb b/lib/chef/provider/group/dscl.rb index a8ba32641c..d0b2a4d499 100644 --- a/lib/chef/provider/group/dscl.rb +++ b/lib/chef/provider/group/dscl.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -38,7 +38,7 @@ class Chef raise(Chef::Exceptions::Group,"dscl error: #{result.inspect}") if result[2] =~ /No such key: / return result[2] end - + # This is handled in providers/group.rb by Etc.getgrnam() # def group_exists?(group) # groups = safe_dscl("list /Groups") @@ -86,8 +86,8 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/bin/dscl") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/bin/dscl") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/dscl for #{@new_resource.name}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end @@ -96,13 +96,13 @@ class Chef def load_current_resource super end - + def create_group dscl_create_group set_gid set_members end - + def manage_group if @new_resource.group_name && (@current_resource.group_name != @new_resource.group_name) dscl_create_group @@ -114,12 +114,12 @@ class Chef set_members end end - + def dscl_create_group safe_dscl("create /Groups/#{@new_resource.group_name}") safe_dscl("create /Groups/#{@new_resource.group_name} Password '*'") end - + def remove_group safe_dscl("delete /Groups/#{@new_resource.group_name}") end diff --git a/lib/chef/provider/group/gpasswd.rb b/lib/chef/provider/group/gpasswd.rb index 7fb27a7777..2638b82383 100644 --- a/lib/chef/provider/group/gpasswd.rb +++ b/lib/chef/provider/group/gpasswd.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,9 +32,9 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/bin/gpasswd") } - a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/gpasswd for #{@new_resource}" + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/bin/gpasswd") } + a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/bin/gpasswd for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end diff --git a/lib/chef/provider/group/groupadd.rb b/lib/chef/provider/group/groupadd.rb index 544fee4304..abf5375f8b 100644 --- a/lib/chef/provider/group/groupadd.rb +++ b/lib/chef/provider/group/groupadd.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,7 +20,7 @@ class Chef class Provider class Group class Groupadd < Chef::Provider::Group - + def required_binaries [ "/usr/sbin/groupadd", "/usr/sbin/groupmod", @@ -34,9 +34,9 @@ class Chef def define_resource_requirements super required_binaries.each do |required_binary| - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?(required_binary) } - a.failure_message Chef::Exceptions::Group, "Could not find binary #{required_binary} for #{@new_resource}" + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?(required_binary) } + a.failure_message Chef::Exceptions::Group, "Could not find binary #{required_binary} for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end @@ -48,9 +48,9 @@ class Chef command << set_options command << groupadd_options run_command(:command => command) - modify_group_members + modify_group_members end - + # Manage the group when it already exists def manage_group command = "groupmod" @@ -58,12 +58,12 @@ class Chef run_command(:command => command) modify_group_members end - + # Remove the group def remove_group run_command(:command => "groupdel #{@new_resource.group_name}") end - + def modify_group_members raise Chef::Exceptions::Group, "you must override modify_group_members in #{self.to_s}" end diff --git a/lib/chef/provider/group/pw.rb b/lib/chef/provider/group/pw.rb index 3bf67a515a..66da8281be 100644 --- a/lib/chef/provider/group/pw.rb +++ b/lib/chef/provider/group/pw.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,21 +20,21 @@ class Chef class Provider class Group class Pw < Chef::Provider::Group - + def load_current_resource super end - + def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/pw") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/pw") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/pw for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end end - + # Create the group def create_group command = "pw groupadd" @@ -42,7 +42,7 @@ class Chef command << set_members_option run_command(:command => command) end - + # Manage the group when it already exists def manage_group command = "pw groupmod" @@ -50,12 +50,12 @@ class Chef command << set_members_option run_command(:command => command) end - + # Remove the group def remove_group run_command(:command => "pw groupdel #{@new_resource.group_name}") end - + # Little bit of magic as per Adam's useradd provider to pull and assign the command line flags # # ==== Returns @@ -86,7 +86,7 @@ class Chef end opt end - + end end end diff --git a/lib/chef/provider/group/suse.rb b/lib/chef/provider/group/suse.rb index 0b66c1f912..4c343bddf9 100644 --- a/lib/chef/provider/group/suse.rb +++ b/lib/chef/provider/group/suse.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,8 +32,8 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/groupmod") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/groupmod") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/groupmod for #{@new_resource.name}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end diff --git a/lib/chef/provider/group/usermod.rb b/lib/chef/provider/group/usermod.rb index 8daf9c7fff..5788ac8fad 100644 --- a/lib/chef/provider/group/usermod.rb +++ b/lib/chef/provider/group/usermod.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -22,7 +22,7 @@ class Chef class Provider class Group class Usermod < Chef::Provider::Group::Groupadd - + def load_current_resource super end @@ -30,19 +30,19 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/usr/sbin/usermod") } + requirements.assert(:all_actions) do |a| + a.assertion { ::File.exists?("/usr/sbin/usermod") } a.failure_message Chef::Exceptions::Group, "Could not find binary /usr/sbin/usermod for #{@new_resource}" # No whyrun alternative: this component should be available in the base install of any given system that uses it end requirements.assert(:modify, :create) do |a| - a.assertion { @new_resource.members.empty? || @new_resource.append } + a.assertion { @new_resource.members.empty? || @new_resource.append } a.failure_message Chef::Exceptions::Group, "setting group members directly is not supported by #{self.to_s}, must set append true in group" # No whyrun alternative - this action is simply not supported. end end - + def modify_group_members case node[:platform] when "openbsd", "netbsd", "aix", "solaris2", "smartos" diff --git a/lib/chef/provider/ifconfig.rb b/lib/chef/provider/ifconfig.rb index 3a354bb5c6..31f88e5406 100644 --- a/lib/chef/provider/ifconfig.rb +++ b/lib/chef/provider/ifconfig.rb @@ -26,11 +26,11 @@ require 'erb' # # int = {Hash with your network settings...} # -# ifconfig int['ip'] do -# ignore_failure true -# device int['dev'] -# mask int['mask'] -# gateway int['gateway'] +# ifconfig int['ip'] do +# ignore_failure true +# device int['dev'] +# mask int['mask'] +# gateway int['gateway'] # mtu int['mtu'] # end @@ -89,12 +89,12 @@ class Chef @current_resource end - def define_resource_requirements - requirements.assert(:all_actions) do |a| + def define_resource_requirements + requirements.assert(:all_actions) do |a| a.assertion { @status.exitstatus == 0 } a.failure_message Chef::Exceptions::Ifconfig, "ifconfig failed - #{@status.inspect}!" # no whyrun - if the base ifconfig used in load_current_resource fails - # there's no reasonable action that could have been taken in the course of + # there's no reasonable action that could have been taken in the course of # a chef run to fix it. end end @@ -215,7 +215,7 @@ class Chef def delete_command "ifconfig #{@new_resource.device} down" end - + def loopback_device 'lo' end diff --git a/lib/chef/provider/log.rb b/lib/chef/provider/log.rb index 927ee72fcc..1c970cc888 100644 --- a/lib/chef/provider/log.rb +++ b/lib/chef/provider/log.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,7 +32,7 @@ class Chef def load_current_resource true end - + # Write the log to Chef's log # # === Return diff --git a/lib/chef/provider/mdadm.rb b/lib/chef/provider/mdadm.rb index d93ff69c13..c1a7dab2c4 100644 --- a/lib/chef/provider/mdadm.rb +++ b/lib/chef/provider/mdadm.rb @@ -47,7 +47,7 @@ class Chef def action_create unless @current_resource.exists - converge_by("create RAID device #{new_resource.raid_device}") do + converge_by("create RAID device #{new_resource.raid_device}") do command = "yes | mdadm --create #{@new_resource.raid_device} --chunk=#{@new_resource.chunk} --level #{@new_resource.level}" command << " --metadata=#{@new_resource.metadata}" command << " --bitmap=#{@new_resource.bitmap}" if @new_resource.bitmap @@ -63,7 +63,7 @@ class Chef def action_assemble unless @current_resource.exists - converge_by("assemble RAID device #{new_resource.raid_device}") do + converge_by("assemble RAID device #{new_resource.raid_device}") do command = "yes | mdadm --assemble #{@new_resource.raid_device} #{@new_resource.devices.join(" ")}" Chef::Log.debug("#{@new_resource} mdadm command: #{command}") shell_out!(command) @@ -76,7 +76,7 @@ class Chef def action_stop if @current_resource.exists - converge_by("stop RAID device #{new_resource.raid_device}") do + converge_by("stop RAID device #{new_resource.raid_device}") do command = "yes | mdadm --stop #{@new_resource.raid_device}" Chef::Log.debug("#{@new_resource} mdadm command: #{command}") shell_out!(command) diff --git a/lib/chef/provider/mount.rb b/lib/chef/provider/mount.rb index 6b9dd91ac8..5f58baa396 100644 --- a/lib/chef/provider/mount.rb +++ b/lib/chef/provider/mount.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -37,7 +37,7 @@ class Chef def action_mount unless @current_resource.mounted - converge_by("mount #{@current_resource.device} to #{@current_resource.mount_point}") do + converge_by("mount #{@current_resource.device} to #{@current_resource.mount_point}") do status = mount_fs() if status Chef::Log.info("#{@new_resource} mounted") @@ -50,7 +50,7 @@ class Chef def action_umount if @current_resource.mounted - converge_by("unmount #{@current_resource.device}") do + converge_by("unmount #{@current_resource.device}") do status = umount_fs() if status Chef::Log.info("#{@new_resource} unmounted") @@ -66,7 +66,7 @@ class Chef raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount" else if @current_resource.mounted - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = remount_fs() if status Chef::Log.info("#{@new_resource} remounted") @@ -80,7 +80,7 @@ class Chef def action_enable unless @current_resource.enabled && mount_options_unchanged? - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = enable_fs if status Chef::Log.info("#{@new_resource} enabled") @@ -93,7 +93,7 @@ class Chef def action_disable if @current_resource.enabled - converge_by("remount #{@current_resource.device}") do + converge_by("remount #{@current_resource.device}") do status = disable_fs if status Chef::Log.info("#{@new_resource} disabled") @@ -115,14 +115,14 @@ class Chef def remount_fs raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :remount" end - + def enable_fs - raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :enable" + raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :enable" end - + def disable_fs - raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable" - end + raise Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :disable" + end end end end diff --git a/lib/chef/provider/mount/aix.rb b/lib/chef/provider/mount/aix.rb index 128bb4c6c3..0d7e11a1b8 100644 --- a/lib/chef/provider/mount/aix.rb +++ b/lib/chef/provider/mount/aix.rb @@ -1,5 +1,5 @@ # -# Author:: +# Author:: # Copyright:: Copyright (c) 2009 Opscode, Inc # License:: Apache License, Version 2.0 # @@ -38,7 +38,7 @@ class Chef def enabled? # Check to see if there is an entry in /etc/filesystems. Last entry for a volume wins. Using command "lsfs" to fetch entries. enabled = false - + # lsfs o/p = #MountPoint:Device:Vfs:Nodename:Type:Size:Options:AutoMount:Acct # search only for current mount point shell_out("lsfs -c #{@new_resource.mount_point}").stdout.each_line do | line | @@ -74,8 +74,8 @@ class Chef device_details = device_fstab.split(":") search_device = device_details[1] else - search_device = device_fstab_regex - end + search_device = device_fstab_regex + end case line when /#{search_device}\s+#{Regexp.escape(@new_resource.mount_point)}/ mounted = true @@ -140,7 +140,7 @@ class Chef fstab.puts("\tnodename\t\t= #{device_details[0]}") else fstab.puts("\tdev\t\t= #{device_fstab}") - end + end fstab.puts("\tvfs\t\t= #{@new_resource.fstype}") fstab.puts("\tmount\t\t= false") fstab.puts "\toptions\t\t= #{@new_resource.options.join(',')}" unless @new_resource.options.nil? || @new_resource.options.empty? @@ -164,7 +164,7 @@ class Chef if !found_device contents << line end - end + end ::File.open("/etc/filesystems", "w") do |fstab| contents.each { |line| fstab.puts line} end diff --git a/lib/chef/provider/mount/mount.rb b/lib/chef/provider/mount/mount.rb index f7118d6c3c..7a8c87c718 100644 --- a/lib/chef/provider/mount/mount.rb +++ b/lib/chef/provider/mount/mount.rb @@ -39,7 +39,7 @@ class Chef mounted? enabled? end - + def mountable? # only check for existence of non-remote devices if (device_should_exist? && !::File.exists?(device_real) ) @@ -49,7 +49,7 @@ class Chef end return true end - + def enabled? # Check to see if there is a entry in /etc/fstab. Last entry for a volume wins. enabled = false @@ -72,7 +72,7 @@ class Chef end @current_resource.enabled(enabled) end - + def mounted? mounted = false shell_out!("mount").stdout.each_line do |line| @@ -141,7 +141,7 @@ class Chef Chef::Log.debug("#{@new_resource} is already enabled - nothing to do") return nil end - + if @current_resource.enabled # The current options don't match what we have, so # disable, then enable. @@ -156,7 +156,7 @@ class Chef def disable_fs if @current_resource.enabled contents = [] - + found = false ::File.readlines("/etc/fstab").reverse_each do |line| if !found && line =~ /^#{device_fstab_regex}\s+#{Regexp.escape(@new_resource.mount_point)}/ @@ -167,7 +167,7 @@ class Chef contents << line end end - + ::File.open("/etc/fstab", "w") do |fstab| contents.reverse_each { |line| fstab.puts line} end @@ -181,7 +181,7 @@ class Chef end def device_should_exist? - ( @new_resource.device != "none" ) && + ( @new_resource.device != "none" ) && ( not network_device? ) && ( not %w[ tmpfs fuse ].include? @new_resource.fstype ) end @@ -200,7 +200,7 @@ class Chef end def device_real - if @real_device == nil + if @real_device == nil if @new_resource.device_type == :device @real_device = @new_resource.device else @@ -247,14 +247,14 @@ class Chef device_fstab end end - + def mount_options_unchanged? @current_resource.fstype == @new_resource.fstype and @current_resource.options == @new_resource.options and @current_resource.dump == @new_resource.dump and @current_resource.pass == @new_resource.pass end - + end end end diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 572cc84877..c7692a9746 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -50,7 +50,7 @@ class Chef requirements.assert(:upgrade) do |a| # Can't upgrade what we don't have - a.assertion { !(@current_resource.version.nil? && candidate_version.nil?) } + a.assertion { !(@current_resource.version.nil? && candidate_version.nil?) } a.failure_message(Chef::Exceptions::Package, "No candidate version available for #{@new_resource.package_name}") a.whyrun("Assuming a repository that offers #{@new_resource.package_name} would have been configured") end @@ -71,9 +71,9 @@ class Chef # We need to make sure we handle the preseed file if @new_resource.response_file if preseed_file = get_preseed_file(@new_resource.package_name, install_version) - converge_by("preseed package #{@new_resource.package_name}") do + converge_by("preseed package #{@new_resource.package_name}") do preseed_package(preseed_file) - end + end end end description = install_version ? "version #{install_version} of" : "" diff --git a/lib/chef/provider/package/aix.rb b/lib/chef/provider/package/aix.rb index b25e314569..4df0ea7a33 100644 --- a/lib/chef/provider/package/aix.rb +++ b/lib/chef/provider/package/aix.rb @@ -143,4 +143,4 @@ class Chef end end end -end
\ No newline at end of file +end diff --git a/lib/chef/provider/package/dpkg.rb b/lib/chef/provider/package/dpkg.rb index 795a7b308b..8ec1ad5878 100644 --- a/lib/chef/provider/package/dpkg.rb +++ b/lib/chef/provider/package/dpkg.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -32,14 +32,14 @@ class Chef include Chef::Mixin::GetSourceFromPackage def define_resource_requirements super - requirements.assert(:install) do |a| + requirements.assert(:install) do |a| a.assertion{ not @new_resource.source.nil? } a.failure_message Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install" end # TODO this was originally written for any action in which .source is provided # but would it make more sense to only look at source if the action is :install? - requirements.assert(:all_actions) do |a| + requirements.assert(:all_actions) do |a| a.assertion { @source_exists } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "Assuming it would have been previously downloaded." @@ -53,7 +53,7 @@ class Chef @new_resource.version(nil) if @new_resource.source - @source_exists = ::File.exists?(@new_resource.source) + @source_exists = ::File.exists?(@new_resource.source) if @source_exists # Get information from the package if supplied Chef::Log.debug("#{@new_resource} checking dpkg status") @@ -71,7 +71,7 @@ class Chef end end - + # Check to see if it is installed package_installed = nil Chef::Log.debug("#{@new_resource} checking install state") @@ -92,10 +92,10 @@ class Chef unless status.exitstatus == 0 || status.exitstatus == 1 raise Chef::Exceptions::Package, "dpkg failed - #{status.inspect}!" end - + @current_resource end - + def install_package(name, version) run_command_with_systems_locale( :command => "dpkg -i#{expand_options(@new_resource.options)} #{@new_resource.source}", @@ -113,7 +113,7 @@ class Chef } ) end - + def purge_package(name, version) run_command_with_systems_locale( :command => "dpkg -P#{expand_options(@new_resource.options)} #{@new_resource.package_name}", diff --git a/lib/chef/provider/package/ips.rb b/lib/chef/provider/package/ips.rb index 5beb46a20a..2c6d98d81a 100644 --- a/lib/chef/provider/package/ips.rb +++ b/lib/chef/provider/package/ips.rb @@ -33,12 +33,12 @@ class Chef def define_resource_requirements super - + requirements.assert(:all_actions) do |a| a.assertion { ! @candidate_version.nil? } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.package_name} not found" a.whyrun "Assuming package #{@new_resource.package_name} would have been made available." - end + end end def load_current_resource @@ -52,7 +52,7 @@ class Chef Chef::Log.debug("Checking package status for #{package}") installed = false depends = false - + shell_out!("pkg info -r #{package}").stdout.each_line do |line| case line when /^\s+State: Installed/ diff --git a/lib/chef/provider/package/macports.rb b/lib/chef/provider/package/macports.rb index fd33788944..6ef303ee4f 100644 --- a/lib/chef/provider/package/macports.rb +++ b/lib/chef/provider/package/macports.rb @@ -44,7 +44,7 @@ class Chef def install_package(name, version) unless @current_resource.version == version command = "port#{expand_options(@new_resource.options)} install #{name}" - command << " @#{version}" if version and !version.empty? + command << " @#{version}" if version and !version.empty? run_command_with_systems_locale( :command => command ) diff --git a/lib/chef/provider/package/pacman.rb b/lib/chef/provider/package/pacman.rb index f81486ae84..2e8bb7850b 100644 --- a/lib/chef/provider/package/pacman.rb +++ b/lib/chef/provider/package/pacman.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ class Chef class Provider class Package class Pacman < Chef::Provider::Package - + def load_current_resource @current_resource = Chef::Resource::Package.new(@new_resource.name) @current_resource.package_name(@new_resource.package_name) @@ -84,27 +84,27 @@ class Chef @candidate_version end - + def install_package(name, version) run_command_with_systems_locale( :command => "pacman --sync --noconfirm --noprogressbar#{expand_options(@new_resource.options)} #{name}" ) end - + def upgrade_package(name, version) install_package(name, version) end - + def remove_package(name, version) run_command_with_systems_locale( :command => "pacman --remove --noconfirm --noprogressbar#{expand_options(@new_resource.options)} #{name}" ) end - + def purge_package(name, version) remove_package(name, version) end - + end end end diff --git a/lib/chef/provider/package/rpm.rb b/lib/chef/provider/package/rpm.rb index 033ce8efb9..616a78a2f5 100644 --- a/lib/chef/provider/package/rpm.rb +++ b/lib/chef/provider/package/rpm.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -30,18 +30,18 @@ class Chef def define_resource_requirements super - requirements.assert(:all_actions) do |a| + requirements.assert(:all_actions) do |a| a.assertion { @package_source_exists } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "Assuming package #{@new_resource.name} would have been made available." end - requirements.assert(:all_actions) do |a| - a.assertion { !@rpm_status.nil? && (@rpm_status.exitstatus == 0 || @rpm_status.exitstatus == 1) } + requirements.assert(:all_actions) do |a| + a.assertion { !@rpm_status.nil? && (@rpm_status.exitstatus == 0 || @rpm_status.exitstatus == 1) } a.failure_message Chef::Exceptions::Package, "Unable to determine current version due to RPM failure. Detail: #{@rpm_status.inspect}" a.whyrun "Assuming current version would have been determined for package#{@new_resource.name}." end end - + def load_current_resource @package_source_provided = true @package_source_exists = true @@ -49,13 +49,13 @@ class Chef @current_resource = Chef::Resource::Package.new(@new_resource.name) @current_resource.package_name(@new_resource.package_name) @new_resource.version(nil) - + if @new_resource.source unless ::File.exists?(@new_resource.source) @package_source_exists = false return end - + Chef::Log.debug("#{@new_resource} checking rpm status") status = popen4("rpm -qp --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@new_resource.source}") do |pid, stdin, stdout, stderr| stdout.each do |line| @@ -72,7 +72,7 @@ class Chef return end end - + Chef::Log.debug("#{@new_resource} checking install state") @rpm_status = popen4("rpm -q --queryformat '%{NAME} %{VERSION}-%{RELEASE}\n' #{@current_resource.package_name}") do |pid, stdin, stdout, stderr| stdout.each do |line| @@ -83,11 +83,11 @@ class Chef end end end - - + + @current_resource end - + def install_package(name, version) unless @current_resource.version run_command_with_systems_locale( @@ -99,9 +99,9 @@ class Chef ) end end - + alias_method :upgrade_package, :install_package - + def remove_package(name, version) if version run_command_with_systems_locale( diff --git a/lib/chef/provider/package/rubygems.rb b/lib/chef/provider/package/rubygems.rb index 28d332420b..b423c199a0 100644 --- a/lib/chef/provider/package/rubygems.rb +++ b/lib/chef/provider/package/rubygems.rb @@ -72,7 +72,7 @@ class Chef raise NotImplementedError end - ## + ## # A rubygems specification object containing the list of gemspecs for all # available gems in the gem installation. # Implemented by subclasses diff --git a/lib/chef/provider/package/smartos.rb b/lib/chef/provider/package/smartos.rb index a099337a7b..28d56ddc2c 100644 --- a/lib/chef/provider/package/smartos.rb +++ b/lib/chef/provider/package/smartos.rb @@ -84,7 +84,7 @@ class Chef end def remove_package(name, version) - Chef::Log.debug("#{@new_resource} removing package #{name} version #{version}") + Chef::Log.debug("#{@new_resource} removing package #{name} version #{version}") package = "#{name}" out = shell_out!("/opt/local/bin/pkgin -y remove #{package}", :env => nil) end diff --git a/lib/chef/provider/package/solaris.rb b/lib/chef/provider/package/solaris.rb index f502a0dc96..7b3d4196bc 100644 --- a/lib/chef/provider/package/solaris.rb +++ b/lib/chef/provider/package/solaris.rb @@ -33,12 +33,12 @@ class Chef # end def define_resource_requirements super - requirements.assert(:install) do |a| + requirements.assert(:install) do |a| a.assertion { @new_resource.source } a.failure_message Chef::Exceptions::Package, "Source for package #{@new_resource.name} required for action install" end - requirements.assert(:all_actions) do |a| - a.assertion { !@new_resource.source || @package_source_found } + requirements.assert(:all_actions) do |a| + a.assertion { !@new_resource.source || @package_source_found } a.failure_message Chef::Exceptions::Package, "Package #{@new_resource.name} not found: #{@new_resource.source}" a.whyrun "would assume #{@new_resource.source} would be have previously been made available" end @@ -51,7 +51,7 @@ class Chef if @new_resource.source @package_source_found = ::File.exists?(@new_resource.source) - if @package_source_found + if @package_source_found Chef::Log.debug("#{@new_resource} checking pkg status") status = popen4("pkginfo -l -d #{@new_resource.source} #{@new_resource.package_name}") do |pid, stdin, stdout, stderr| stdout.each do |line| diff --git a/lib/chef/provider/package/yum-dump.py b/lib/chef/provider/package/yum-dump.py index 407eb8f408..a8f3995e8c 100644 --- a/lib/chef/provider/package/yum-dump.py +++ b/lib/chef/provider/package/yum-dump.py @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -249,8 +249,8 @@ def yum_dump(options): # Preserve order of enable/disable repo args like yum does def gather_repo_opts(option, opt, value, parser): - if getattr(parser.values, option.dest, None) is None: - setattr(parser.values, option.dest, []) + if getattr(parser.values, option.dest, None) is None: + setattr(parser.values, option.dest, []) getattr(parser.values, option.dest).append((opt, value.split(','))) def main(): diff --git a/lib/chef/provider/package/yum.rb b/lib/chef/provider/package/yum.rb index 233e949e12..f56d3140b6 100644 --- a/lib/chef/provider/package/yum.rb +++ b/lib/chef/provider/package/yum.rb @@ -667,7 +667,7 @@ class Chef @allow_multi_install = [] - @extra_repo_control = nil + @extra_repo_control = nil # these are for subsequent runs if we are on an interval Chef::Client.when_run_starts do @@ -1046,7 +1046,7 @@ class Chef end # At this point package_name could be: - # + # # 1) a package name, eg: "foo" # 2) a package name.arch, eg: "foo.i386" # 3) or a dependency, eg: "foo >= 1.1" @@ -1154,7 +1154,7 @@ class Chef # Hacky - better overall solution? Custom compare in Package provider? def action_upgrade # Could be uninstalled or have no candidate - if @current_resource.version.nil? || candidate_version.nil? + if @current_resource.version.nil? || candidate_version.nil? super # Ensure the candidate is newer elsif RPMVersion.parse(candidate_version) > RPMVersion.parse(@current_resource.version) diff --git a/lib/chef/provider/powershell_script.rb b/lib/chef/provider/powershell_script.rb index 700eb88c11..c459cdf678 100644 --- a/lib/chef/provider/powershell_script.rb +++ b/lib/chef/provider/powershell_script.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,7 +23,7 @@ class Chef class PowershellScript < Chef::Provider::WindowsScript protected - + EXIT_STATUS_NORMALIZATION_SCRIPT = "\nif ($? -eq $true) {exit 0} elseif ( $LASTEXITCODE -ne 0) {exit $LASTEXITCODE} else { exit 1 }" EXIT_STATUS_RESET_SCRIPT = "$LASTEXITCODE=0\n" @@ -41,12 +41,12 @@ class Chef end public - + def initialize (new_resource, run_context) super(new_resource, run_context, '.ps1') NormalizeScriptExitStatus(new_resource.code) end - + def flags default_flags = [ "-NoLogo", @@ -60,8 +60,8 @@ class Chef # file created by the base class that contains the script # code -- otherwise, powershell.exe does not propagate the # error status of a failed Windows process that ran at the - # end of the script, it gets changed to '1'. - "-File" + # end of the script, it gets changed to '1'. + "-File" ] interpreter_flags = default_flags.join(' ') diff --git a/lib/chef/provider/remote_file/http.rb b/lib/chef/provider/remote_file/http.rb index 6ffd83f438..9b65d87895 100644 --- a/lib/chef/provider/remote_file/http.rb +++ b/lib/chef/provider/remote_file/http.rb @@ -68,7 +68,7 @@ class Chef raise e end end - + tempfile end diff --git a/lib/chef/provider/resource_update.rb b/lib/chef/provider/resource_update.rb index e2c6bffca4..54f25738ed 100644 --- a/lib/chef/provider/resource_update.rb +++ b/lib/chef/provider/resource_update.rb @@ -4,27 +4,27 @@ class Chef # { # "run_id" : "1000", - # "resource" : { + # "resource" : { # "type" : "file", - # "name" : "/etc/passwd", + # "name" : "/etc/passwd", # "start_time" : "2012-01-09T08:15:30-05:00", # "end_time" : "2012-01-09T08:15:30-05:00", # "status" : "modified", - # "initial_state" : "exists", - # "final_state" : "modified", - # "before" : { - # "group" : "root", + # "initial_state" : "exists", + # "final_state" : "modified", + # "before" : { + # "group" : "root", # "owner" : "root", # "checksum" : "xyz" # }, - # "after" : { - # "group" : "root", + # "after" : { + # "group" : "root", # "owner" : "root", # "checksum" : "abc" # }, # "delta" : "escaped delta goes here" # }, - # "event_data" : "" + # "event_data" : "" # } class ResourceUpdate diff --git a/lib/chef/provider/ruby_block.rb b/lib/chef/provider/ruby_block.rb index 16908b0eff..b0d94a3f8d 100644 --- a/lib/chef/provider/ruby_block.rb +++ b/lib/chef/provider/ruby_block.rb @@ -7,9 +7,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -29,7 +29,7 @@ class Chef end def action_run - converge_by("execute the ruby block #{@new_resource.name}") do + converge_by("execute the ruby block #{@new_resource.name}") do @new_resource.block.call Chef::Log.info("#{@new_resource} called") end diff --git a/lib/chef/provider/script.rb b/lib/chef/provider/script.rb index 1b459f36cf..4aacf4f524 100644 --- a/lib/chef/provider/script.rb +++ b/lib/chef/provider/script.rb @@ -27,7 +27,7 @@ class Chef super @code = @new_resource.code end - + def action_run script_file.puts(@code) script_file.close diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb index 8d76927676..968f9bff9c 100644 --- a/lib/chef/provider/service.rb +++ b/lib/chef/provider/service.rb @@ -35,7 +35,7 @@ class Chef end def load_new_resource_state - # If the user didn't specify a change in enabled state, + # If the user didn't specify a change in enabled state, # it will be the same as the old resource if ( @new_resource.enabled.nil? ) @new_resource.enabled(@current_resource.enabled) @@ -54,7 +54,7 @@ class Chef a.failure_message Chef::Exceptions::UnsupportedAction, "#{self.to_s} does not support :reload" # if a service is not declared to support reload, that won't # typically change during the course of a run - so no whyrun - # alternative here. + # alternative here. end end diff --git a/lib/chef/provider/service/debian.rb b/lib/chef/provider/service/debian.rb index e2a0f60d91..f52099921f 100644 --- a/lib/chef/provider/service/debian.rb +++ b/lib/chef/provider/service/debian.rb @@ -41,17 +41,17 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| update_rcd = "/usr/sbin/update-rc.d" - a.assertion { ::File.exists? update_rcd } + a.assertion { ::File.exists? update_rcd } a.failure_message Chef::Exceptions::Service, "#{update_rcd} does not exist!" # no whyrun recovery - this is a base system component of debian - # distros and must be present - end + # distros and must be present + end requirements.assert(:all_actions) do |a| - a.assertion { @priority_success } + a.assertion { @priority_success } a.failure_message Chef::Exceptions::Service, "/usr/sbin/update-rc.d -n -f #{@current_resource.service_name} failed - #{@rcd_status.inspect}" - # This can happen if the service is not yet installed,so we'll fake it. - a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", + # This can happen if the service is not yet installed,so we'll fake it. + a.whyrun ["Unable to determine priority of service, assuming service would have been correctly installed earlier in the run.", "Assigning temporary priorities to continue.", "If this service is not properly installed prior to this point, this will fail."] do temp_priorities = {"6"=>[:stop, "20"], @@ -74,7 +74,7 @@ class Chef [stdout, stderr].each do |iop| iop.each_line do |line| if UPDATE_RC_D_PRIORITIES =~ line - # priority[runlevel] = [ S|K, priority ] + # priority[runlevel] = [ S|K, priority ] # S = Start, K = Kill # debian runlevels: 0 Halt, 1 Singleuser, 2 Multiuser, 3-5 == 2, 6 Reboot priority[$1] = [($2 == "S" ? :start : :stop), $3] @@ -110,7 +110,7 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d #{@new_resource.service_name} defaults #{@new_resource.priority} #{100 - @new_resource.priority}") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own start priorities set_priority() else # No priority, go with update-rc.d defaults @@ -126,10 +126,10 @@ class Chef run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop #{100 - @new_resource.priority} 2 3 4 5 .") elsif @new_resource.priority.is_a? Hash - # we call the same command regardless of we're enabling or disabling + # we call the same command regardless of we're enabling or disabling # users passing a Hash are responsible for setting their own stop priorities set_priority() - else + else # no priority, using '100 - 20 (update-rc.d default)' to stop in reverse order of start run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} remove") run_command(:command => "/usr/sbin/update-rc.d -f #{@new_resource.service_name} stop 80 2 3 4 5 .") diff --git a/lib/chef/provider/service/freebsd.rb b/lib/chef/provider/service/freebsd.rb index b875838ec2..cb0f6b0fc4 100644 --- a/lib/chef/provider/service/freebsd.rb +++ b/lib/chef/provider/service/freebsd.rb @@ -38,13 +38,13 @@ class Chef elsif ::File.exists?("/usr/local/etc/rc.d/#{current_resource.service_name}") @init_command = "/usr/local/etc/rc.d/#{current_resource.service_name}" else - @rcd_script_found = false + @rcd_script_found = false return end Chef::Log.debug("#{@current_resource} found at #{@init_command}") determine_current_status! # Default to disabled if the service doesn't currently exist - # at all + # at all var_name = service_enable_variable_name if ::File.exists?("/etc/rc.conf") && var_name read_rc_conf.each do |line| @@ -70,19 +70,19 @@ class Chef def define_resource_requirements shared_resource_requirements requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found } + a.assertion { @rcd_script_found } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the rc.d script" end - requirements.assert(:all_actions) do |a| - a.assertion { @enabled_state_found } - # for consistentcy with original behavior, this will not fail in non-whyrun mode; + requirements.assert(:all_actions) do |a| + a.assertion { @enabled_state_found } + # for consistentcy with original behavior, this will not fail in non-whyrun mode; # rather it will silently set enabled state=>false - a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." + a.whyrun "Unable to determine enabled/disabled state, assuming this will be correct for an actual run. Assuming disabled." end requirements.assert(:start, :enable, :reload, :restart) do |a| - a.assertion { @rcd_script_found && service_enable_variable_name != nil } + a.assertion { @rcd_script_found && service_enable_variable_name != nil } a.failure_message Chef::Exceptions::Service, "Could not find the service name in #{@init_command} and rcvar" # No recovery in whyrun mode - the init file is present but not correct. end @@ -133,7 +133,7 @@ class Chef # corresponding to this service # For example: to enable the service mysql-server with the init command /usr/local/etc/rc.d/mysql-server, you need # to set mysql_enable="YES" in /etc/rc.conf$ - if @rcd_script_found + if @rcd_script_found ::File.open(@init_command) do |rcscript| rcscript.each_line do |line| if line =~ /^name="?(\w+)"?/ diff --git a/lib/chef/provider/service/gentoo.rb b/lib/chef/provider/service/gentoo.rb index 45b5a21f9b..ba4edc5807 100644 --- a/lib/chef/provider/service/gentoo.rb +++ b/lib/chef/provider/service/gentoo.rb @@ -44,7 +44,7 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { ::File.exists?("/sbin/rc-update") } + a.assertion { ::File.exists?("/sbin/rc-update") } a.failure_message Chef::Exceptions::Service, "/sbin/rc-update does not exist" # no whyrun recovery -t his is a core component whose presence is # unlikely to be affected by what we do in the course of a chef run @@ -52,15 +52,15 @@ class Chef::Provider::Service::Gentoo < Chef::Provider::Service::Init requirements.assert(:all_actions) do |a| a.assertion { @found_script } - # No failure, just informational output from whyrun + # No failure, just informational output from whyrun a.whyrun "Could not find service #{@new_resource.service_name} under any runlevel" end end - + def enable_service() run_command(:command => "/sbin/rc-update add #{@new_resource.service_name} default") end - + def disable_service() run_command(:command => "/sbin/rc-update del #{@new_resource.service_name} default") end diff --git a/lib/chef/provider/service/init.rb b/lib/chef/provider/service/init.rb index 09f47e866f..63ba8fa6ab 100644 --- a/lib/chef/provider/service/init.rb +++ b/lib/chef/provider/service/init.rb @@ -47,7 +47,7 @@ class Chef end end end - + def start_service if @new_resource.start_command super diff --git a/lib/chef/provider/service/insserv.rb b/lib/chef/provider/service/insserv.rb index 32152376ee..cb9c28e17e 100644 --- a/lib/chef/provider/service/insserv.rb +++ b/lib/chef/provider/service/insserv.rb @@ -32,9 +32,9 @@ class Chef if Dir.glob("/etc/rc**/S*#{@current_resource.service_name}").empty? @current_resource.enabled false else - @current_resource.enabled true + @current_resource.enabled true end - + @current_resource end diff --git a/lib/chef/provider/service/invokercd.rb b/lib/chef/provider/service/invokercd.rb index 69a17bb4fb..ee2719d75a 100644 --- a/lib/chef/provider/service/invokercd.rb +++ b/lib/chef/provider/service/invokercd.rb @@ -24,7 +24,7 @@ class Chef class Provider class Service class Invokercd < Chef::Provider::Service::Init - + def initialize(new_resource, run_context) super @init_command = "/usr/sbin/invoke-rc.d #{@new_resource.service_name}" diff --git a/lib/chef/provider/service/redhat.rb b/lib/chef/provider/service/redhat.rb index 629e4ee0c3..06be9f3207 100644 --- a/lib/chef/provider/service/redhat.rb +++ b/lib/chef/provider/service/redhat.rb @@ -48,7 +48,7 @@ class Chef requirements.assert(:start, :enable, :reload, :restart) do |a| a.assertion { !@service_missing } a.failure_message Chef::Exceptions::Service, "#{@new_resource}: unable to locate the init.d script!" - a.whyrun "Assuming service would be disabled. The init script is not presently installed." + a.whyrun "Assuming service would be disabled. The init script is not presently installed." end end @@ -59,7 +59,7 @@ class Chef chkconfig = shell_out!("/sbin/chkconfig --list #{@current_resource.service_name}", :returns => [0,1]) @current_resource.enabled(!!(chkconfig.stdout =~ CHKCONFIG_ON)) @service_missing = !!(chkconfig.stderr =~ CHKCONFIG_MISSING) - end + end @current_resource end diff --git a/lib/chef/provider/service/simple.rb b/lib/chef/provider/service/simple.rb index bcb85230d0..288b5f5456 100644 --- a/lib/chef/provider/service/simple.rb +++ b/lib/chef/provider/service/simple.rb @@ -45,8 +45,8 @@ class Chef def shared_resource_requirements super - requirements.assert(:all_actions) do |a| - a.assertion { @status_load_success } + requirements.assert(:all_actions) do |a| + a.assertion { @status_load_success } a.whyrun ["Service status not available. Assuming a prior action would have installed the service.", "Assuming status of not running."] end end @@ -74,12 +74,12 @@ class Chef end requirements.assert(:all_actions) do |a| - a.assertion { @new_resource.status_command or @new_resource.supports[:status] or - (!ps_cmd.nil? and !ps_cmd.empty?) } + a.assertion { @new_resource.status_command or @new_resource.supports[:status] or + (!ps_cmd.nil? and !ps_cmd.empty?) } a.failure_message Chef::Exceptions::Service, "#{@new_resource} could not determine how to inspect the process table, please set this node's 'command.ps' attribute" end - requirements.assert(:all_actions) do |a| - a.assertion { !@ps_command_failed } + requirements.assert(:all_actions) do |a| + a.assertion { !@ps_command_failed } a.failure_message Chef::Exceptions::Service, "Command #{ps_cmd} failed to execute, cannot determine service current status" end end diff --git a/lib/chef/provider/service/solaris.rb b/lib/chef/provider/service/solaris.rb index 33a29da109..4bdb6fbfd1 100644 --- a/lib/chef/provider/service/solaris.rb +++ b/lib/chef/provider/service/solaris.rb @@ -31,7 +31,7 @@ class Chef @init_command = "/usr/sbin/svcadm" @status_command = "/bin/svcs -l" end - + def load_current_resource @current_resource = Chef::Resource::Service.new(@new_resource.name) diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 59b4fe1564..89077c5feb 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -50,7 +50,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def define_resource_requirements shared_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { @status_check_success } + a.assertion { @status_check_success } # We won't stop in any case, but in whyrun warn and tell what we're doing. a.whyrun ["Failed to determine status of #{@new_resource}, using command #{@new_resource.status_command}.", "Assuming service would have been installed and is disabled"] @@ -99,11 +99,11 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple def enable_service run_command_with_systems_locale(:command => "/bin/systemctl enable #{@new_resource.service_name}") - end + end def disable_service run_command_with_systems_locale(:command => "/bin/systemctl disable #{@new_resource.service_name}") - end + end def is_active? run_command_with_systems_locale({:command => "/bin/systemctl is-active #{@new_resource.service_name}", :ignore_failure => true}) == 0 diff --git a/lib/chef/provider/service/upstart.rb b/lib/chef/provider/service/upstart.rb index 763a2aa92b..9ec0f54b43 100644 --- a/lib/chef/provider/service/upstart.rb +++ b/lib/chef/provider/service/upstart.rb @@ -26,7 +26,7 @@ class Chef class Service class Upstart < Chef::Provider::Service::Simple UPSTART_STATE_FORMAT = /\w+ \(?(\w+)\)?[\/ ](\w+)/ - + # Upstart does more than start or stop a service, creating multiple 'states' [1] that a service can be in. # In chef, when we ask a service to start, we expect it to have started before performing the next step # since we have top down dependencies. Which is to say we may follow witha resource next that requires @@ -40,17 +40,17 @@ class Chef # TODO: re-evaluate if this is needed after integrating cookbook fix raise ArgumentError, "run_context cannot be nil" unless run_context super - + run_context.node - + @job = @new_resource.service_name - + if @new_resource.parameters @new_resource.parameters.each do |key, value| @job << " #{key}=#{value}" end end - + platform, version = Chef::Platform.find_platform_and_version(run_context.node) if platform == "ubuntu" && (8.04..9.04).include?(version.to_f) @upstart_job_dir = "/etc/event.d" @@ -60,8 +60,8 @@ class Chef @upstart_conf_suffix = ".conf" end - @command_success = true # new_resource.status_command= false, means upstart used - @config_file_found = true + @command_success = true # new_resource.status_command= false, means upstart used + @config_file_found = true @upstart_command_success = true end @@ -70,18 +70,18 @@ class Chef shared_resource_requirements requirements.assert(:all_actions) do |a| if !@command_success - whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : + whyrun_msg = @new_resource.status_command ? "Provided status command #{@new_resource.status_command} failed." : "Could not determine upstart state for service" end a.assertion { @command_success } - # no failure here, just document the assumptions made. - a.whyrun "#{whyrun_msg} Assuming service installed and not running." + # no failure here, just document the assumptions made. + a.whyrun "#{whyrun_msg} Assuming service installed and not running." end - requirements.assert(:all_actions) do |a| - a.assertion { @config_file_found } - # no failure here, just document the assumptions made. - a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." + requirements.assert(:all_actions) do |a| + a.assertion { @config_file_found } + # no failure here, just document the assumptions made. + a.whyrun "Could not find #{@upstart_job_dir}/#{@new_resource.service_name}#{@upstart_conf_suffix}. Assuming service is disabled." end end diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb index 3b0c202b10..6ceb3e592a 100644 --- a/lib/chef/provider/subversion.rb +++ b/lib/chef/provider/subversion.rb @@ -17,7 +17,7 @@ # -#TODO subversion and git should both extend from a base SCM provider. +#TODO subversion and git should both extend from a base SCM provider. require 'chef/log' require 'chef/provider' @@ -52,7 +52,7 @@ class Chef # for why run, print a message explaining the potential error. parent_directory = ::File.dirname(@new_resource.destination) a.assertion { ::File.directory?(parent_directory) } - a.failure_message(Chef::Exceptions::MissingParentDirectory, + a.failure_message(Chef::Exceptions::MissingParentDirectory, "Cannot clone #{@new_resource} to #{@new_resource.destination}, the enclosing directory #{parent_directory} does not exist") a.whyrun("Directory #{parent_directory} does not exist, assuming it would have been created") end @@ -91,13 +91,13 @@ class Chef converge_by("sync #{@new_resource.destination} from #{@new_resource.repository}") do run_command(run_options(:command => sync_command)) Chef::Log.info "#{@new_resource} updated to revision: #{revision_int}" - end + end end else action_checkout end end - + def sync_command c = scm :update, @new_resource.svn_arguments, verbose, authentication, "-r#{revision_int}", @new_resource.destination Chef::Log.debug "#{@new_resource} updated working copy #{@new_resource.destination} to revision #{@new_resource.revision}" @@ -198,7 +198,7 @@ class Chef def scm(*args) ['svn', *args].compact.join(" ") end - + def target_dir_non_existent_or_empty? !::File.exist?(@new_resource.destination) || Dir.entries(@new_resource.destination).sort == ['.','..'] diff --git a/lib/chef/provider/user.rb b/lib/chef/provider/user.rb index 851d8110fb..738f7660f8 100644 --- a/lib/chef/provider/user.rb +++ b/lib/chef/provider/user.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -87,14 +87,14 @@ class Chef def define_resource_requirements requirements.assert(:all_actions) do |a| - a.assertion { @group_name_resolved } + a.assertion { @group_name_resolved } a.failure_message Chef::Exceptions::User, "Couldn't lookup integer GID for group name #{@new_resource.gid}" a.whyrun "group name #{@new_resource.gid} does not exist. This will cause group assignment to fail. Assuming this group will have been created previously." end requirements.assert(:all_actions) do |a| - a.assertion { @shadow_lib_ok } + a.assertion { @shadow_lib_ok } a.failure_message Chef::Exceptions::MissingLibrary, "You must have ruby-shadow installed for password support!" - a.whyrun "ruby-shadow is not installed. Attempts to set user password will cause failure. Assuming that this gem will have been previously installed." + + a.whyrun "ruby-shadow is not installed. Attempts to set user password will cause failure. Assuming that this gem will have been previously installed." + "Note that user update converge may report false-positive on the basis of mismatched password. " end requirements.assert(:modify, :lock, :unlock) do |a| diff --git a/lib/chef/provider/user/dscl.rb b/lib/chef/provider/user/dscl.rb index 94e8420c43..b01931609e 100644 --- a/lib/chef/provider/user/dscl.rb +++ b/lib/chef/provider/user/dscl.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -25,10 +25,10 @@ class Chef class User class Dscl < Chef::Provider::User include Chef::Mixin::ShellOut - + NFS_HOME_DIRECTORY = %r{^NFSHomeDirectory: (.*)$} AUTHENTICATION_AUTHORITY = %r{^AuthenticationAuthority: (.*)$} - + def dscl(*args) shell_out("dscl . -#{args.join(' ')}") end @@ -80,7 +80,7 @@ class Chef return safe_dscl("delete /Users/#{@new_resource.username} NFSHomeDirectory") if (@new_resource.home.nil? || @new_resource.home.empty?) if @new_resource.supports[:manage_home] validate_home_dir_specification! - + if (@current_resource.home == @new_resource.home) && !new_home_exists? ditto_home elsif !current_home_exists? && !new_home_exists? @@ -105,7 +105,7 @@ class Chef end def shadow_hash_set? - user_data = safe_dscl("read /Users/#{@new_resource.username}") + user_data = safe_dscl("read /Users/#{@new_resource.username}") if user_data =~ /AuthenticationAuthority: / && user_data =~ /ShadowHash/ true else @@ -116,7 +116,7 @@ class Chef def modify_password if @new_resource.password shadow_hash = nil - + Chef::Log.debug("#{new_resource} updating password") if osx_shadow_hash?(@new_resource.password) shadow_hash = @new_resource.password.upcase @@ -134,11 +134,11 @@ class Chef shadow_hash = String.new("00000000"*155) shadow_hash[168] = salted_sha1 end - + ::File.open("/var/db/shadow/hash/#{guid}",'w',0600) do |output| output.puts shadow_hash end - + unless shadow_hash_set? safe_dscl("append /Users/#{@new_resource.username} AuthenticationAuthority ';ShadowHash;'") end @@ -159,7 +159,7 @@ class Chef dscl_set_shell modify_password end - + def manage_user dscl_create_user if diverged?(:username) dscl_create_comment if diverged?(:comment) @@ -169,15 +169,15 @@ class Chef dscl_set_shell if diverged?(:shell) modify_password if diverged?(:password) end - + def dscl_create_user - safe_dscl("create /Users/#{@new_resource.username}") + safe_dscl("create /Users/#{@new_resource.username}") end - + def dscl_create_comment safe_dscl("create /Users/#{@new_resource.username} RealName '#{@new_resource.comment}'") end - + def dscl_set_gid unless @new_resource.gid && @new_resource.gid.to_s.match(/^\d+$/) begin @@ -189,7 +189,7 @@ class Chef end safe_dscl("create /Users/#{@new_resource.username} PrimaryGroupID '#{@new_resource.gid}'") end - + def dscl_set_shell if @new_resource.password || ::File.exists?("#{@new_resource.shell}") safe_dscl("create /Users/#{@new_resource.username} UserShell '#{@new_resource.shell}'") @@ -197,10 +197,10 @@ class Chef safe_dscl("create /Users/#{@new_resource.username} UserShell '/usr/bin/false'") end end - + def remove_user if @new_resource.supports[:manage_home] - user_info = safe_dscl("read /Users/#{@new_resource.username}") + user_info = safe_dscl("read /Users/#{@new_resource.username}") if nfs_home_match = user_info.match(NFS_HOME_DIRECTORY) #nfs_home = safe_dscl("read /Users/#{@new_resource.username} NFSHomeDirectory") #nfs_home.gsub!(/NFSHomeDirectory: /,"").gsub!(/\n$/,"") @@ -228,7 +228,7 @@ class Chef false end end - + def check_lock return @locked = locked? end @@ -236,27 +236,27 @@ class Chef def lock_user safe_dscl("append /Users/#{@new_resource.username} AuthenticationAuthority ';DisabledUser;'") end - + def unlock_user auth_info = safe_dscl("read /Users/#{@new_resource.username} AuthenticationAuthority") auth_string = auth_info.gsub(/AuthenticationAuthority: /,"").gsub(/;DisabledUser;/,"").strip#.gsub!(/[; ]*$/,"") safe_dscl("create /Users/#{@new_resource.username} AuthenticationAuthority '#{auth_string}'") end - + def validate_home_dir_specification! unless @new_resource.home =~ /^\// - raise(Chef::Exceptions::InvalidHomeDirectory,"invalid path spec for User: '#{@new_resource.username}', home directory: '#{@new_resource.home}'") + raise(Chef::Exceptions::InvalidHomeDirectory,"invalid path spec for User: '#{@new_resource.username}', home directory: '#{@new_resource.home}'") end end - + def current_home_exists? ::File.exist?("#{@current_resource.home}") end - + def new_home_exists? - ::File.exist?("#{@new_resource.home}") + ::File.exist?("#{@new_resource.home}") end - + def ditto_home skel = "/System/Library/User Template/English.lproj" raise(Chef::Exceptions::User,"can't find skel at: #{skel}") unless ::File.exists?(skel) @@ -266,7 +266,7 @@ class Chef def move_home Chef::Log.debug("#{@new_resource} moving #{self} home from #{@current_resource.home} to #{@new_resource.home}") - + src = @current_resource.home FileUtils.mkdir_p(@new_resource.home) files = ::Dir.glob("#{src}/*", ::File::FNM_DOTMATCH) - ["#{src}/.","#{src}/.."] @@ -274,11 +274,11 @@ class Chef ::FileUtils.rmdir(src) ::FileUtils.chown_R(@new_resource.username,@new_resource.gid.to_s,@new_resource.home) end - + def diverged?(parameter) parameter_updated?(parameter) && (not @new_resource.send(parameter).nil?) end - + def parameter_updated?(parameter) not (@new_resource.send(parameter) == @current_resource.send(parameter)) end diff --git a/lib/chef/provider/user/pw.rb b/lib/chef/provider/user/pw.rb index 4f6393da89..9f7a169892 100644 --- a/lib/chef/provider/user/pw.rb +++ b/lib/chef/provider/user/pw.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -34,20 +34,20 @@ class Chef run_command(:command => command) modify_password end - + def manage_user command = "pw usermod" command << set_options run_command(:command => command) modify_password end - + def remove_user command = "pw userdel #{@new_resource.username}" command << " -r" if @new_resource.supports[:manage_home] run_command(:command => command) end - + def check_lock case @current_resource.password when /^\*LOCKED\*/ @@ -57,18 +57,18 @@ class Chef end @locked end - + def lock_user run_command(:command => "pw lock #{@new_resource.username}") end - + def unlock_user run_command(:command => "pw unlock #{@new_resource.username}") end - + def set_options opts = " #{@new_resource.username}" - + field_list = { 'comment' => "-c", 'home' => "-d", @@ -91,7 +91,7 @@ class Chef end opts end - + def modify_password if @current_resource.password != @new_resource.password Chef::Log.debug("#{new_resource} updating password") @@ -99,7 +99,7 @@ class Chef status = popen4(command, :waitlast => true) do |pid, stdin, stdout, stderr| stdin.puts "#{@new_resource.password}" end - + unless status.exitstatus == 0 raise Chef::Exceptions::User, "pw failed - #{status.inspect}!" end diff --git a/lib/chef/provider/user/windows.rb b/lib/chef/provider/user/windows.rb index 6bbb2a088c..350f3ff4c0 100644 --- a/lib/chef/provider/user/windows.rb +++ b/lib/chef/provider/user/windows.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -71,23 +71,23 @@ class Chef def create_user @net_user.add(set_options) end - + def manage_user @net_user.update(set_options) end - + def remove_user @net_user.delete end - + def check_lock @net_user.check_enabled end - + def lock_user @net_user.disable_account end - + def unlock_user @net_user.enable_account end diff --git a/lib/chef/provider/windows_script.rb b/lib/chef/provider/windows_script.rb index 398e1aee6e..08a2ea74df 100644 --- a/lib/chef/provider/windows_script.rb +++ b/lib/chef/provider/windows_script.rb @@ -6,9 +6,9 @@ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at -# +# # http://www.apache.org/licenses/LICENSE-2.0 -# +# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -24,7 +24,7 @@ class Chef class WindowsScript < Chef::Provider::Script protected - + include Chef::Mixin::WindowsArchitectureHelper def initialize( new_resource, run_context, script_extension='') @@ -43,14 +43,14 @@ class Chef end public - + def action_run wow64_redirection_state = nil if @is_wow64 wow64_redirection_state = disable_wow64_file_redirection(@run_context.node) end - + begin super rescue @@ -61,11 +61,11 @@ class Chef end end end - + def script_file base_script_name = "chef-script" temp_file_arguments = [ base_script_name, @script_extension ] - + @script_file ||= Tempfile.open(temp_file_arguments) end end |