diff options
Diffstat (limited to 'lib')
34 files changed, 72 insertions, 72 deletions
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb index 4a39ba5ba1..34598574dd 100644 --- a/lib/chef/application/knife.rb +++ b/lib/chef/application/knife.rb @@ -38,7 +38,7 @@ class Chef::Application::Knife < Chef::Application :short => "-V", :long => "--verbose", :description => "More verbose output. Use twice for max verbosity", - :proc => Proc.new { verbosity_level += 1 }, + :proc => Proc.new { verbosity_level += 1 }, :default => 0 option :color, @@ -63,7 +63,7 @@ class Chef::Application::Knife < Chef::Application :long => "--disable-editing", :description => "Do not open EDITOR, just accept the data as is", :boolean => true, - :default => false + :default => false option :help, :short => "-h", diff --git a/lib/chef/cookbook/metadata.rb b/lib/chef/cookbook/metadata.rb index 62e17d4f3b..7d14cea44f 100644 --- a/lib/chef/cookbook/metadata.rb +++ b/lib/chef/cookbook/metadata.rb @@ -828,7 +828,7 @@ INVALID def validate_calculated_default_rule(options) calculated_conflict = ((options[:default].is_a?(Array) && !options[:default].empty?) || (options[:default].is_a?(String) && !options[:default] != "")) && - options[:calculated] == true + options[:calculated] == true raise ArgumentError, "Default cannot be specified if calculated is true!" if calculated_conflict end diff --git a/lib/chef/encrypted_data_bag_item/assertions.rb b/lib/chef/encrypted_data_bag_item/assertions.rb index 8162a9aa54..bbdcf7a721 100644 --- a/lib/chef/encrypted_data_bag_item/assertions.rb +++ b/lib/chef/encrypted_data_bag_item/assertions.rb @@ -30,7 +30,7 @@ class Chef::EncryptedDataBagItem unless format_version.kind_of?(Integer) and format_version >= Chef::Config[:data_bag_decrypt_minimum_version] raise UnacceptableEncryptedDataBagItemFormat, "The encrypted data bag item has format version `#{format_version}', " + - "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" + "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'" end end diff --git a/lib/chef/environment.rb b/lib/chef/environment.rb index b286dad4e2..9cdb8a8522 100644 --- a/lib/chef/environment.rb +++ b/lib/chef/environment.rb @@ -36,7 +36,7 @@ class Chef attr_accessor :chef_server_rest - COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/.freeze + COMBINED_COOKBOOK_CONSTRAINT = /(.+)(?:[\s]+)((?:#{Chef::VersionConstraint::OPS.join('|')})(?:[\s]+).+)$/ def initialize(chef_server_rest: nil) @name = "" @@ -123,7 +123,7 @@ class Chef result = { "name" => @name, "description" => @description, - "cookbook_versions" => @cookbook_versions, + "cookbook_versions" => @cookbook_versions, "json_class" => self.class.name, "chef_type" => "environment", "default_attributes" => @default_attributes, diff --git a/lib/chef/http.rb b/lib/chef/http.rb index 0060fb08c7..9cd55f18dd 100644 --- a/lib/chef/http.rb +++ b/lib/chef/http.rb @@ -383,7 +383,7 @@ class Chef end def build_headers(method, url, headers = {}, json_body = false) - headers = @default_headers.merge(headers) + headers = @default_headers.merge(headers) headers["Content-Length"] = json_body.bytesize.to_s if json_body headers.merge!(Chef::Config[:custom_http_headers]) if Chef::Config[:custom_http_headers] headers diff --git a/lib/chef/http/basic_client.rb b/lib/chef/http/basic_client.rb index 9428858cdf..e0a02a05cf 100644 --- a/lib/chef/http/basic_client.rb +++ b/lib/chef/http/basic_client.rb @@ -98,7 +98,7 @@ class Chef #adapted from buildr/lib/buildr/core/transports.rb def proxy_uri proxy = Chef::Config["#{url.scheme}_proxy"] || - env["#{url.scheme.upcase}_PROXY"] || env["#{url.scheme}_proxy"] + env["#{url.scheme.upcase}_PROXY"] || env["#{url.scheme}_proxy"] # Check if the proxy string contains a scheme. If not, add the url's scheme to the # proxy before parsing. The regex /^.*:\/\// matches, for example, http://. Reusing proxy diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index 6cd7dda251..20c46aaa8d 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -60,7 +60,7 @@ class Chef HOST_LOWER = "host".freeze - URI_SCHEME_DEFAULT_PORT = { "http" => 80, "https" => 443 }.freeze + URI_SCHEME_DEFAULT_PORT = { "http" => 80, "https" => 443 }.freeze def self.user_agent=(ua) @user_agent = ua diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index 164a2cdeda..fb43f8721b 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -244,7 +244,7 @@ class Chef # Mention rehash when the subcommands cache(plugin_manifest.json) is used if subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::HashedCommandLoader) || - subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::CustomManifestLoader) + subcommand_loader.is_a?(Chef::Knife::SubcommandLoader::CustomManifestLoader) ui.info("If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.") end diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 971257bf9e..280960f3c6 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -368,7 +368,7 @@ class Chef # chef-vault integration must use the new client-side hawtness, otherwise to use the # new client-side hawtness, just delete your validation key. if chef_vault_handler.doing_chef_vault? || - (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key]))) + (Chef::Config[:validation_key] && !File.exist?(File.expand_path(Chef::Config[:validation_key]))) unless config[:chef_node_name] ui.error("You must pass a node name with -N when bootstrapping with user credentials") diff --git a/lib/chef/knife/client_create.rb b/lib/chef/knife/client_create.rb index ecacb36833..22c7ce907d 100644 --- a/lib/chef/knife/client_create.rb +++ b/lib/chef/knife/client_create.rb @@ -39,7 +39,7 @@ class Chef :boolean => true option :validator, - :long => "--validator", + :long => "--validator", :description => "Create the client as a validator.", :boolean => true diff --git a/lib/chef/knife/configure.rb b/lib/chef/knife/configure.rb index e62a9dd05c..df41aa7265 100644 --- a/lib/chef/knife/configure.rb +++ b/lib/chef/knife/configure.rb @@ -97,7 +97,7 @@ EOH user_create = Chef::Knife::UserCreate.new user_create.name_args = [ new_client_name ] user_create.config[:user_password] = config[:user_password] || - ui.ask("Please enter a password for the new user: ") { |q| q.echo = false } + ui.ask("Please enter a password for the new user: ") { |q| q.echo = false } user_create.config[:admin] = true user_create.config[:file] = new_client_key user_create.config[:yes] = true diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb index 9a79cd076a..01374b9b36 100644 --- a/lib/chef/knife/cookbook_site_install.rb +++ b/lib/chef/knife/cookbook_site_install.rb @@ -53,7 +53,7 @@ class Chef :default => "master" option :use_current_branch, - :short => "-b", + :short => "-b", :long => "--use-current-branch", :description => "Use the current branch", :boolean => true, @@ -172,7 +172,7 @@ class Chef def preferred_metadata md = Chef::Cookbook::Metadata.new - rb = File.join(@install_path, @cookbook_name, "metadata.rb") + rb = File.join(@install_path, @cookbook_name, "metadata.rb") if File.exist?(rb) md.from_file(rb) return md diff --git a/lib/chef/knife/core/gem_glob_loader.rb b/lib/chef/knife/core/gem_glob_loader.rb index 6802be29ef..78726feee7 100644 --- a/lib/chef/knife/core/gem_glob_loader.rb +++ b/lib/chef/knife/core/gem_glob_loader.rb @@ -22,8 +22,8 @@ class Chef class Knife class SubcommandLoader class GemGlobLoader < Chef::Knife::SubcommandLoader - MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+}.freeze - MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/}.freeze + MATCHES_CHEF_GEM = %r{/chef-[\d]+\.[\d]+\.[\d]+} + MATCHES_THIS_CHEF_GEM = %r{/chef-#{Chef::VERSION}(-\w+)?(-\w+)?/} def subcommand_files @subcommand_files ||= (gem_and_builtin_subcommands.values + site_subcommands).flatten.uniq diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index a1e54f784d..4184171a4e 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -186,8 +186,8 @@ class Chef Chef::Log.debug("Using node attribute #{Chef::Config[:knife][:ssh_attribute]}") attribute = Chef::Config[:knife][:ssh_attribute] elsif node[:cloud] && - node[:cloud][:public_hostname] && - !node[:cloud][:public_hostname].empty? + node[:cloud][:public_hostname] && + !node[:cloud][:public_hostname].empty? Chef::Log.debug("Using node attribute 'cloud[:public_hostname]' automatically as the ssh target") attribute = "cloud.public_hostname" else diff --git a/lib/chef/knife/user_create.rb b/lib/chef/knife/user_create.rb index 5a9589aad8..b1782a893b 100644 --- a/lib/chef/knife/user_create.rb +++ b/lib/chef/knife/user_create.rb @@ -38,7 +38,7 @@ class Chef option :user_key, :long => "--user-key FILENAME", - :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)." + :description => "Set the initial default key for the user from a file on disk (cannot pass with --prevent-keygen)." option :prevent_keygen, :short => "-k", diff --git a/lib/chef/mixin/windows_architecture_helper.rb b/lib/chef/mixin/windows_architecture_helper.rb index c55f92b362..11e1b5559d 100644 --- a/lib/chef/mixin/windows_architecture_helper.rb +++ b/lib/chef/mixin/windows_architecture_helper.rb @@ -48,7 +48,7 @@ class Chef def with_os_architecture(node, architecture: nil) node ||= begin os_arch = ENV["PROCESSOR_ARCHITEW6432"] || - ENV["PROCESSOR_ARCHITECTURE"] + ENV["PROCESSOR_ARCHITECTURE"] Hash.new.tap do |n| n[:kernel] = Hash.new n[:kernel][:machine] = os_arch == "AMD64" ? :x86_64 : :i386 diff --git a/lib/chef/mixin/xml_escape.rb b/lib/chef/mixin/xml_escape.rb index afb0d09c2d..f9a41b9fd0 100644 --- a/lib/chef/mixin/xml_escape.rb +++ b/lib/chef/mixin/xml_escape.rb @@ -64,14 +64,14 @@ class Chef CP1252 = { 128 => 8364, # euro sign 130 => 8218, # single low-9 quotation mark - 131 => 402, # latin small letter f with hook + 131 => 402, # latin small letter f with hook 132 => 8222, # double low-9 quotation mark 133 => 8230, # horizontal ellipsis 134 => 8224, # dagger 135 => 8225, # double dagger - 136 => 710, # modifier letter circumflex accent + 136 => 710, # modifier letter circumflex accent 137 => 8240, # per mille sign - 138 => 352, # latin capital letter s with caron + 138 => 352, # latin capital letter s with caron 139 => 8249, # single left-pointing angle quotation mark 140 => 338, # latin capital ligature oe 142 => 381, # latin capital letter z with caron @@ -82,9 +82,9 @@ class Chef 149 => 8226, # bullet 150 => 8211, # en dash 151 => 8212, # em dash - 152 => 732, # small tilde + 152 => 732, # small tilde 153 => 8482, # trade mark sign - 154 => 353, # latin small letter s with caron + 154 => 353, # latin small letter s with caron 155 => 8250, # single right-pointing angle quotation mark 156 => 339, # latin small ligature oe 158 => 382, # latin small letter z with caron diff --git a/lib/chef/platform/provider_mapping.rb b/lib/chef/platform/provider_mapping.rb index 39d415e590..d24cd8c18c 100644 --- a/lib/chef/platform/provider_mapping.rb +++ b/lib/chef/platform/provider_mapping.rb @@ -173,8 +173,8 @@ class Chef def find_provider(platform, version, resource_type) provider_klass = explicit_provider(platform, version, resource_type) || - platform_provider(platform, version, resource_type) || - resource_matching_provider(platform, version, resource_type) + platform_provider(platform, version, resource_type) || + resource_matching_provider(platform, version, resource_type) raise Chef::Exceptions::ProviderNotFound, "Cannot find a provider for #{resource_type} on #{platform} version #{version}" if provider_klass.nil? diff --git a/lib/chef/policy_builder/dynamic.rb b/lib/chef/policy_builder/dynamic.rb index 22438a1e0f..c6c7deeee6 100644 --- a/lib/chef/policy_builder/dynamic.rb +++ b/lib/chef/policy_builder/dynamic.rb @@ -149,9 +149,9 @@ class Chef # testing purposes; production code should call #load_node instead. def select_implementation(node) if policyfile_set_in_config? || - policyfile_attribs_in_node_json? || - node_has_policyfile_attrs?(node) || - policyfile_compat_mode_config? + policyfile_attribs_in_node_json? || + node_has_policyfile_attrs?(node) || + policyfile_compat_mode_config? @implementation = Policyfile.new(node_name, ohai_data, json_attribs, override_runlist, events) else @implementation = ExpandNodeObject.new(node_name, ohai_data, json_attribs, override_runlist, events) diff --git a/lib/chef/property.rb b/lib/chef/property.rb index 8198dd6700..0230c8b23b 100644 --- a/lib/chef/property.rb +++ b/lib/chef/property.rb @@ -336,11 +336,11 @@ class Chef # It won't do what they expect. This checks whether you try to *read* # `content` while we are compiling the resource. if resource.respond_to?(:resource_initializing) && - resource.resource_initializing && - resource.respond_to?(:enclosing_provider) && - resource.enclosing_provider && - resource.enclosing_provider.new_resource && - resource.enclosing_provider.new_resource.respond_to?(name) + resource.resource_initializing && + resource.respond_to?(:enclosing_provider) && + resource.enclosing_provider && + resource.enclosing_provider.new_resource && + resource.enclosing_provider.new_resource.respond_to?(name) Chef::Log.warn("#{Chef::Log.caller_location}: property #{name} is declared in both #{resource} and #{resource.enclosing_provider}. Use new_resource.#{name} instead. At #{Chef::Log.caller_location}") end @@ -486,8 +486,8 @@ class Chef # the original options. options = self.options if modified_options.has_key?(:name_property) || - modified_options.has_key?(:name_attribute) || - modified_options.has_key?(:default) + modified_options.has_key?(:name_attribute) || + modified_options.has_key?(:default) options = options.reject { |k, v| k == :name_attribute || k == :name_property || k == :default } end self.class.new(options.merge(modified_options)) diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb index 600da540e5..4f17da0288 100644 --- a/lib/chef/provider/git.rb +++ b/lib/chef/provider/git.rb @@ -53,9 +53,9 @@ class Chef a.assertion { !(@new_resource.revision =~ /^origin\//) } a.failure_message Chef::Exceptions::InvalidRemoteGitReference, "Deploying remote branches is not supported. " + - "Specify the remote branch as a local branch for " + - "the git repository you're deploying from " + - "(ie: '#{@new_resource.revision.gsub('origin/', '')}' rather than '#{@new_resource.revision}')." + "Specify the remote branch as a local branch for " + + "the git repository you're deploying from " + + "(ie: '#{@new_resource.revision.gsub('origin/', '')}' rather than '#{@new_resource.revision}')." end requirements.assert(:all_actions) do |a| @@ -65,8 +65,8 @@ class Chef a.assertion { target_revision != nil } a.failure_message Chef::Exceptions::UnresolvableGitReference, "Unable to parse SHA reference for '#{@new_resource.revision}' in repository '#{@new_resource.repository}'. " + - "Verify your (case-sensitive) repository URL and revision.\n" + - "`git ls-remote '#{@new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" + "Verify your (case-sensitive) repository URL and revision.\n" + + "`git ls-remote '#{@new_resource.repository}' '#{rev_search_pattern}'` output: #{@resolved_reference}" end end diff --git a/lib/chef/provider/link.rb b/lib/chef/provider/link.rb index 116efccaef..d184094bbb 100644 --- a/lib/chef/provider/link.rb +++ b/lib/chef/provider/link.rb @@ -58,8 +58,8 @@ class Chef @current_resource.link_type(:hard) if ::File.exists?(@current_resource.target_file) if ::File.exists?(@new_resource.to) && - file_class.stat(@current_resource.target_file).ino == - file_class.stat(@new_resource.to).ino + file_class.stat(@current_resource.target_file).ino == + file_class.stat(@new_resource.to).ino @current_resource.to(canonicalize(@new_resource.to)) else @current_resource.to("") @@ -96,7 +96,7 @@ class Chef # target_file - the name of the link if @current_resource.to != canonicalize(@new_resource.to) || - @current_resource.link_type != @new_resource.link_type + @current_resource.link_type != @new_resource.link_type # Handle the case where the symlink already exists and is pointing at a valid to_file if @current_resource.to # On Windows, to fix a symlink already pointing at a directory we must first @@ -106,7 +106,7 @@ class Chef # directory we want to throw an exception and calling ::File.unlink on the directory symlink # will throw the correct ones. if Chef::Platform.windows? && ::File.directory?(@new_resource.to) && - ::File.directory?(@current_resource.target_file) + ::File.directory?(@current_resource.target_file) converge_by("unlink existing windows symlink to dir at #{@new_resource.target_file}") do ::Dir.unlink(@new_resource.target_file) end diff --git a/lib/chef/provider/osx_profile.rb b/lib/chef/provider/osx_profile.rb index 1bef30d53b..3747a917fa 100644 --- a/lib/chef/provider/osx_profile.rb +++ b/lib/chef/provider/osx_profile.rb @@ -51,7 +51,7 @@ class Chef @new_profile_identifier = @new_profile_hash["PayloadIdentifier"] else @new_profile_identifier = @new_resource.identifier || - @new_resource.profile_name + @new_resource.profile_name end if all_profiles.empty? diff --git a/lib/chef/resource/cron.rb b/lib/chef/resource/cron.rb index 26711fde16..74fa6685f1 100644 --- a/lib/chef/resource/cron.rb +++ b/lib/chef/resource/cron.rb @@ -126,8 +126,8 @@ class Chef error_message << Provider::Cron::WEEKDAY_SYMBOLS.map { |sym| ":#{sym}" }.join(", ") error_message << " and a string in crontab format" if (arg.is_a?(Symbol) && !Provider::Cron::WEEKDAY_SYMBOLS.include?(arg)) || - (!arg.is_a?(Symbol) && integerize(arg) > 7) || - (!arg.is_a?(Symbol) && integerize(arg) < 0) + (!arg.is_a?(Symbol) && integerize(arg) > 7) || + (!arg.is_a?(Symbol) && integerize(arg) < 0) raise RangeError, error_message end rescue ArgumentError diff --git a/lib/chef/resource/template.rb b/lib/chef/resource/template.rb index 1570af2812..0b9d86f242 100644 --- a/lib/chef/resource/template.rb +++ b/lib/chef/resource/template.rb @@ -171,8 +171,8 @@ class Chef elsif module_name.nil? raise Exceptions::ValidationFailed, "#helpers requires either a module name or inline module code as a block.\n" + - "e.g.: helpers do; helper_code; end;\n" + - "OR: helpers(MyHelpersModule)" + "e.g.: helpers do; helper_code; end;\n" + + "OR: helpers(MyHelpersModule)" else raise Exceptions::ValidationFailed, "Argument to #helpers must be a module. You gave #{module_name.inspect} (#{module_name.class})" diff --git a/lib/chef/resource_collection.rb b/lib/chef/resource_collection.rb index 293a99991e..6c5b4289d8 100644 --- a/lib/chef/resource_collection.rb +++ b/lib/chef/resource_collection.rb @@ -78,8 +78,8 @@ class Chef # Read-only methods are simple to delegate - doing that below resource_list_methods = Enumerable.instance_methods + - [:iterator, :all_resources, :[], :each, :execute_each_resource, :each_index, :empty?] - - [:find] # find needs to run on the set + [:iterator, :all_resources, :[], :each, :execute_each_resource, :each_index, :empty?] - + [:find] # find needs to run on the set resource_set_methods = [:lookup, :find, :resources, :keys, :validate_lookup_spec!] def_delegators :resource_list, *resource_list_methods diff --git a/lib/chef/resource_collection/resource_set.rb b/lib/chef/resource_collection/resource_set.rb index 2a653356dc..88354de31d 100644 --- a/lib/chef/resource_collection/resource_set.rb +++ b/lib/chef/resource_collection/resource_set.rb @@ -124,7 +124,7 @@ class Chef else raise Chef::Exceptions::InvalidResourceSpecification, "The object `#{query_object.inspect}' is not valid for resource collection lookup. " + - "Use a String like `resource_type[resource_name]' or a Chef::Resource object" + "Use a String like `resource_type[resource_name]' or a Chef::Resource object" end end diff --git a/lib/chef/search/query.rb b/lib/chef/search/query.rb index 8a205160fa..487a54f0df 100644 --- a/lib/chef/search/query.rb +++ b/lib/chef/search/query.rb @@ -116,8 +116,8 @@ WARNDEP def validate_type(t) unless t.kind_of?(String) || t.kind_of?(Symbol) msg = "Invalid search object type #{t.inspect} (#{t.class}), must be a String or Symbol." + - "Usage: search(:node, QUERY[, OPTIONAL_ARGS])" + - " `knife search environment QUERY (options)`" + "Usage: search(:node, QUERY[, OPTIONAL_ARGS])" + + " `knife search environment QUERY (options)`" raise Chef::Exceptions::InvalidSearchQuery, msg end end diff --git a/lib/chef/shell/ext.rb b/lib/chef/shell/ext.rb index 83863b16f7..40d7e10d2e 100644 --- a/lib/chef/shell/ext.rb +++ b/lib/chef/shell/ext.rb @@ -210,9 +210,9 @@ module Shell desc "prints information about chef" def version puts "This is the chef-shell.\n" + - " Chef Version: #{::Chef::VERSION}\n" + - " http://www.chef.io/\n" + - " http://docs.chef.io/" + " Chef Version: #{::Chef::VERSION}\n" + + " http://www.chef.io/\n" + + " http://docs.chef.io/" :ucanhaz_automation end alias :shell :version diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb index af9a71b246..739a463ad5 100644 --- a/lib/chef/util/dsc/configuration_generator.rb +++ b/lib/chef/util/dsc/configuration_generator.rb @@ -68,7 +68,7 @@ class Chef::Util::DSC end def get_merged_configuration_flags!(configuration_flags, configuration_name) - merged_configuration_flags = { :outputpath => configuration_document_directory(configuration_name) } + merged_configuration_flags = { :outputpath => configuration_document_directory(configuration_name) } if configuration_flags configuration_flags.map do |switch, value| if merged_configuration_flags.key?(switch.to_s.downcase.to_sym) diff --git a/lib/chef/win32/api.rb b/lib/chef/win32/api.rb index ad65b087cc..64db9d2b63 100644 --- a/lib/chef/win32/api.rb +++ b/lib/chef/win32/api.rb @@ -67,7 +67,7 @@ class Chef # BaseTsd.h: #ifdef (_WIN64) host.typedef int HALF_PTR; #else host.typedef short HALF_PTR; host.typedef :ulong, :HACCEL # (L) Handle to an accelerator table. WinDef.h: #host.typedef HANDLE HACCEL; # See http://msdn.microsoft.com/en-us/library/ms645526%28VS.85%29.aspx - host.typedef :size_t, :HANDLE # (L) Handle to an object. WinNT.h: #host.typedef PVOID HANDLE; + host.typedef :size_t, :HANDLE # (L) Handle to an object. WinNT.h: #host.typedef PVOID HANDLE; # todo: Platform-dependent! Need to change to :uint64 for Win64 host.typedef :ulong, :HBITMAP # (L) Handle to a bitmap: http://msdn.microsoft.com/en-us/library/dd183377%28VS.85%29.aspx host.typedef :ulong, :HBRUSH # (L) Handle to a brush. http://msdn.microsoft.com/en-us/library/dd183394%28VS.85%29.aspx diff --git a/lib/chef/win32/api/security.rb b/lib/chef/win32/api/security.rb index 44968372b5..64df077686 100644 --- a/lib/chef/win32/api/security.rb +++ b/lib/chef/win32/api/security.rb @@ -133,11 +133,11 @@ class Chef FILE_READ_ATTRIBUTES = 0x0080 FILE_WRITE_ATTRIBUTES = 0x0100 FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | - SYNCHRONIZE | - 0x1FF + SYNCHRONIZE | + 0x1FF FILE_GENERIC_READ = STANDARD_RIGHTS_READ | - FILE_READ_DATA | FILE_READ_ATTRIBUTES | - FILE_READ_EA | SYNCHRONIZE + FILE_READ_DATA | FILE_READ_ATTRIBUTES | + FILE_READ_EA | SYNCHRONIZE FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE # Access Token Rights (for OpenProcessToken) @@ -163,7 +163,7 @@ class Chef SE_PRIVILEGE_REMOVED = 0X00000004 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000 SE_PRIVILEGE_VALID_ATTRIBUTES = SE_PRIVILEGE_ENABLED_BY_DEFAULT | - SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS + SE_PRIVILEGE_ENABLED | SE_PRIVILEGE_REMOVED | SE_PRIVILEGE_USED_FOR_ACCESS # Minimum size of a SECURITY_DESCRIPTOR. TODO: this is probably platform dependent. # Make it work on 64 bit. diff --git a/lib/chef/win32/file.rb b/lib/chef/win32/file.rb index 94a771c3ba..2a8f453432 100644 --- a/lib/chef/win32/file.rb +++ b/lib/chef/win32/file.rb @@ -167,9 +167,9 @@ class Chef def self.file_access_check(path, desired_access) security_descriptor = Chef::ReservedNames::Win32::Security.get_file_security(path) token_rights = Chef::ReservedNames::Win32::Security::TOKEN_IMPERSONATE | - Chef::ReservedNames::Win32::Security::TOKEN_QUERY | - Chef::ReservedNames::Win32::Security::TOKEN_DUPLICATE | - Chef::ReservedNames::Win32::Security::STANDARD_RIGHTS_READ + Chef::ReservedNames::Win32::Security::TOKEN_QUERY | + Chef::ReservedNames::Win32::Security::TOKEN_DUPLICATE | + Chef::ReservedNames::Win32::Security::STANDARD_RIGHTS_READ token = Chef::ReservedNames::Win32::Security.open_process_token( Chef::ReservedNames::Win32::Process.get_current_process, token_rights) diff --git a/lib/chef/win32/registry.rb b/lib/chef/win32/registry.rb index 5f8d23b452..bccd2e3c72 100644 --- a/lib/chef/win32/registry.rb +++ b/lib/chef/win32/registry.rb @@ -211,8 +211,8 @@ class Chef hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg| reg.each do |val_name, val_type, val_data| if safely_downcase(val_name) == safely_downcase(value[:name]) && - val_type == get_type_from_name(value[:type]) && - val_data == value[:data] + val_type == get_type_from_name(value[:type]) && + val_data == value[:data] return true end end |