diff options
author | sersut <serdar@opscode.com> | 2013-05-15 13:47:47 -0700 |
---|---|---|
committer | sersut <serdar@opscode.com> | 2013-05-15 13:47:47 -0700 |
commit | bd800b2e2d34e4af1e9eba8b91ba5ad64d06c324 (patch) | |
tree | 9fa4b14aeff9239348897ee46ec300a0ecf78423 | |
parent | eef83d8ab5943af1dd3b25ccc94ef71d772d945a (diff) | |
download | chef-bd800b2e2d34e4af1e9eba8b91ba5ad64d06c324.tar.gz |
Fix nitpick comments and code typos.
-rw-r--r-- | lib/chef/file_access_control/unix.rb | 39 | ||||
-rw-r--r-- | lib/chef/provider.rb | 6 | ||||
-rw-r--r-- | lib/chef/provider/remote_file.rb | 4 | ||||
-rw-r--r-- | lib/chef/resource/file.rb | 8 |
4 files changed, 23 insertions, 34 deletions
diff --git a/lib/chef/file_access_control/unix.rb b/lib/chef/file_access_control/unix.rb index d54fe6ad63..db161e24e4 100644 --- a/lib/chef/file_access_control/unix.rb +++ b/lib/chef/file_access_control/unix.rb @@ -69,20 +69,19 @@ class Chef # the user has not specified a permission on the new resource, so we never manage it with FAC Chef::Log.debug("found target_uid == nil, so no owner was specified on resource, not managing owner") return false - end - if current_uid.nil? + elsif current_uid.nil? # the user has specified a permission, and we are creating a file, so always enforce permissions Chef::Log.debug("found current_uid == nil, so we are creating a new file, updating owner") return true - end - if target_uid != current_uid + elsif target_uid != current_uid # the user has specified a permission, and it does not match the file, so fix the permission Chef::Log.debug("found target_uid != current_uid, updating owner") return true + else + Chef::Log.debug("found target_uid == current_uid, not updating owner") + # the user has specified a permission, but it matches the file, so behave idempotently + return false end - Chef::Log.debug("found target_uid == current_uid, not updating owner") - # the user has specified a permission, but it matches the file, so behave idempotently - return false end def set_owner! @@ -129,20 +128,19 @@ class Chef # the user has not specified a permission on the new resource, so we never manage it with FAC Chef::Log.debug("found target_gid == nil, so no group was specified on resource, not managing group") return false - end - if current_gid.nil? + elsif current_gid.nil? # the user has specified a permission, and we are creating a file, so always enforce permissions Chef::Log.debug("found current_gid == nil, so we are creating a new file, updating group") return true - end - if target_gid != current_gid + elsif target_gid != current_gid # the user has specified a permission, and it does not match the file, so fix the permission Chef::Log.debug("found target_gid != current_gid, updating group") return true + else + Chef::Log.debug("found target_gid == current_gid, not updating group") + # the user has specified a permission, but it matches the file, so behave idempotently + return false end - Chef::Log.debug("found target_gid == current_gid, not updating group") - # the user has specified a permission, but it matches the file, so behave idempotently - return false end def set_group! @@ -179,20 +177,19 @@ class Chef # the user has not specified a permission on the new resource, so we never manage it with FAC Chef::Log.debug("found target_mode == nil, so no mode was specified on resource, not managing mode") return false - end - if current_mode.nil? + elsif current_mode.nil? # the user has specified a permission, and we are creating a file, so always enforce permissions Chef::Log.debug("found current_mode == nil, so we are creating a new file, updating mode") return true - end - if target_mode != current_mode + elsif target_mode != current_mode # the user has specified a permission, and it does not match the file, so fix the permission Chef::Log.debug("found target_mode != current_mode, updating mode") return true + else + Chef::Log.debug("found target_mode == current_mode, not updating mode") + # the user has specified a permission, but it matches the file, so behave idempotently + return false end - Chef::Log.debug("found target_mode == current_mode, not updating mode") - # the user has specified a permission, but it matches the file, so behave idempotently - return false end def set_mode! diff --git a/lib/chef/provider.rb b/lib/chef/provider.rb index 6bdb3ed342..3fb86d72c0 100644 --- a/lib/chef/provider.rb +++ b/lib/chef/provider.rb @@ -132,12 +132,8 @@ class Chef !converge_actions.empty? || @new_resource.updated_by_last_action? end - def resource_up_to_date? - !resource_updated? - end - def set_updated_status - if resource_up_to_date? + if !resource_updated? events.resource_up_to_date(@new_resource, @action) else events.resource_updated(@new_resource, @action) diff --git a/lib/chef/provider/remote_file.rb b/lib/chef/provider/remote_file.rb index e631574c89..e14d678743 100644 --- a/lib/chef/provider/remote_file.rb +++ b/lib/chef/provider/remote_file.rb @@ -47,10 +47,6 @@ class Chef end end - def action_create - super - end - private def do_contents_changes diff --git a/lib/chef/resource/file.rb b/lib/chef/resource/file.rb index b1851c9015..1bcf66259d 100644 --- a/lib/chef/resource/file.rb +++ b/lib/chef/resource/file.rb @@ -48,14 +48,14 @@ class Chef @provider = Chef::Provider::File @binmode = Platform.windows? ? true : false @deploy_with = Chef::Config[:file_deploy_with] - @force_unlik = Chef::Config[:file_force_unlink] + @force_unlink = Chef::Config[:file_force_unlink] @diff = nil end def content(arg=nil) set_or_return( - :content, + :content, arg, :kind_of => String ) @@ -95,7 +95,7 @@ class Chef def binmode(arg=nil) set_or_return( - :diff, + :binmode, arg, :kind_of => [ TrueClass, FalseClass ] ) @@ -111,7 +111,7 @@ class Chef def force_unlink(arg=nil) set_or_return( - :diff, + :force_unlink, arg, :kind_of => [ TrueClass, FalseClass ] ) |