From cdad2f684debda15e8cf773185e78f93892eda35 Mon Sep 17 00:00:00 2001 From: Lamont Granquist Date: Mon, 2 Jul 2018 10:31:50 -0700 Subject: fix Layout/LeadingCommentSpace Signed-off-by: Lamont Granquist --- lib/chef/cookbook/synchronizer.rb | 2 +- lib/chef/data_bag.rb | 2 +- lib/chef/event_loggers/windows_eventlog.rb | 8 +- lib/chef/formatters/base.rb | 4 +- .../registration_error_inspector.rb | 4 +- lib/chef/handler/json_file.rb | 2 +- lib/chef/http/http_request.rb | 2 +- lib/chef/key.rb | 2 +- lib/chef/knife/cookbook_site_install.rb | 2 +- lib/chef/knife/role_env_run_list_remove.rb | 4 +- lib/chef/knife/role_run_list_remove.rb | 4 +- lib/chef/knife/ssh.rb | 2 +- lib/chef/mixin/windows_env_helper.rb | 2 +- lib/chef/node.rb | 2 +- lib/chef/provider/mount/windows.rb | 2 +- lib/chef/provider/package.rb | 2 +- lib/chef/provider/resource_update.rb | 2 +- lib/chef/provider/service/windows.rb | 4 +- lib/chef/provider/subversion.rb | 2 +- lib/chef/provider/windows_env.rb | 12 +-- lib/chef/provider/windows_task.rb | 14 +-- lib/chef/resource_reporter.rb | 2 +- lib/chef/role.rb | 4 +- lib/chef/util/backup.rb | 2 +- lib/chef/util/file_edit.rb | 26 ++--- lib/chef/util/windows/net_group.rb | 2 +- lib/chef/util/windows/net_use.rb | 6 +- lib/chef/util/windows/net_user.rb | 22 ++-- lib/chef/util/windows/volume.rb | 4 +- lib/chef/version.rb | 4 +- lib/chef/win32/api.rb | 12 +-- lib/chef/win32/api/error.rb | 4 +- lib/chef/win32/api/file.rb | 24 ++--- lib/chef/win32/api/net.rb | 116 ++++++++++----------- lib/chef/win32/security/securable_object.rb | 8 +- 35 files changed, 158 insertions(+), 158 deletions(-) (limited to 'lib') diff --git a/lib/chef/cookbook/synchronizer.rb b/lib/chef/cookbook/synchronizer.rb index 6df39fece3..6955abd6d7 100644 --- a/lib/chef/cookbook/synchronizer.rb +++ b/lib/chef/cookbook/synchronizer.rb @@ -143,7 +143,7 @@ class Chef end # Synchronizes all the cookbooks from the chef-server. - #) + # ) # === Returns # true:: Always returns true def sync_cookbooks diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb index 1e23cdfb1c..9a71d89abb 100644 --- a/lib/chef/data_bag.rb +++ b/lib/chef/data_bag.rb @@ -157,7 +157,7 @@ class Chef self end - #create a data bag via RESTful API + # create a data bag via RESTful API def create chef_server_rest.post("data", self) self diff --git a/lib/chef/event_loggers/windows_eventlog.rb b/lib/chef/event_loggers/windows_eventlog.rb index a9473ed1f6..860d049314 100644 --- a/lib/chef/event_loggers/windows_eventlog.rb +++ b/lib/chef/event_loggers/windows_eventlog.rb @@ -73,10 +73,10 @@ class Chef ) end - #Failed chef-client run %1 in %2 seconds. - #Exception type: %3 - #Exception message: %4 - #Exception backtrace: %5 + # Failed chef-client run %1 in %2 seconds. + # Exception type: %3 + # Exception message: %4 + # Exception backtrace: %5 def run_failed(e) data = if @run_status diff --git a/lib/chef/formatters/base.rb b/lib/chef/formatters/base.rb index 997577aa7b..fa309b67e7 100644 --- a/lib/chef/formatters/base.rb +++ b/lib/chef/formatters/base.rb @@ -96,7 +96,7 @@ class Chef if @output.indent < 0 # This is left commented out for now. We need to uncomment it and fix at least one bug in # the formatter, and then leave this line uncommented in the future. - #Chef::Log.warn "Internal Formatter Error -- Attempt to indent by negative number of spaces" + # Chef::Log.warn "Internal Formatter Error -- Attempt to indent by negative number of spaces" @output.indent = 0 end @output.indent @@ -110,7 +110,7 @@ class Chef end def registration_failed(node_name, exception, config) - #A Formatters::ErrorDescription object + # A Formatters::ErrorDescription object description = ErrorMapper.registration_failed(node_name, exception, config) display_error(description) end diff --git a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb index b912800bc5..02e8b0d61a 100644 --- a/lib/chef/formatters/error_inspectors/registration_error_inspector.rb +++ b/lib/chef/formatters/error_inspectors/registration_error_inspector.rb @@ -114,13 +114,13 @@ E end def username - #config[:node_name] + # config[:node_name] config[:validation_client_name] end def api_key config[:validation_key] - #config[:client_key] + # config[:client_key] end def server_url diff --git a/lib/chef/handler/json_file.rb b/lib/chef/handler/json_file.rb index 7f29b91449..3dc7c51274 100644 --- a/lib/chef/handler/json_file.rb +++ b/lib/chef/handler/json_file.rb @@ -41,7 +41,7 @@ class Chef savetime = Time.now.strftime("%Y%m%d%H%M%S") File.open(File.join(config[:path], "chef-run-report-#{savetime}.json"), "w") do |file| - #ensure start time and end time are output in the json properly in the event activesupport happens to be on the system + # ensure start time and end time are output in the json properly in the event activesupport happens to be on the system run_data = data run_data[:start_time] = run_data[:start_time].to_s run_data[:end_time] = run_data[:end_time].to_s diff --git a/lib/chef/http/http_request.rb b/lib/chef/http/http_request.rb index de589e429e..475043bdb4 100644 --- a/lib/chef/http/http_request.rb +++ b/lib/chef/http/http_request.rb @@ -27,7 +27,7 @@ require "net/http" # However, in ohai before 0.6.0, the version is defined # in ohai, not ohai/version begin - require "ohai/version" #used in user agent string. + require "ohai/version" # used in user agent string. rescue LoadError require "ohai" end diff --git a/lib/chef/key.rb b/lib/chef/key.rb index ef006f8ace..1020d60ac6 100644 --- a/lib/chef/key.rb +++ b/lib/chef/key.rb @@ -140,7 +140,7 @@ class Chef # defaults the key name to the fingerprint of the key if @name.nil? # if they didn't pass a public_key, - #then they must supply a name because we can't generate a fingerprint + # then they must supply a name because we can't generate a fingerprint unless @public_key.nil? @name = fingerprint else diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb index faa8c54c4b..18cddb19f4 100644 --- a/lib/chef/knife/cookbook_site_install.rb +++ b/lib/chef/knife/cookbook_site_install.rb @@ -86,7 +86,7 @@ class Chef ui.info "Installing #{@cookbook_name} to #{@install_path}" @repo = CookbookSCMRepo.new(@install_path, ui, config) - #cookbook_path = File.join(vendor_path, name_args[0]) + # cookbook_path = File.join(vendor_path, name_args[0]) upstream_file = File.join(@install_path, "#{@cookbook_name}.tar.gz") @repo.sanity_check diff --git a/lib/chef/knife/role_env_run_list_remove.rb b/lib/chef/knife/role_env_run_list_remove.rb index 576e32e2a9..f31f40b58a 100644 --- a/lib/chef/knife/role_env_run_list_remove.rb +++ b/lib/chef/knife/role_env_run_list_remove.rb @@ -33,9 +33,9 @@ class Chef nlist = [] role.run_list_for(environment).each do |entry| nlist << entry unless entry == item_to_remove - #unless entry == @name_args[2] + # unless entry == @name_args[2] # nlist << entry - #end + # end end role.env_run_lists_add(environment => nlist) end diff --git a/lib/chef/knife/role_run_list_remove.rb b/lib/chef/knife/role_run_list_remove.rb index 0dacfee051..6fd35c6aaa 100644 --- a/lib/chef/knife/role_run_list_remove.rb +++ b/lib/chef/knife/role_run_list_remove.rb @@ -33,9 +33,9 @@ class Chef nlist = [] role.run_list_for(environment).each do |entry| nlist << entry unless entry == item_to_remove - #unless entry == @name_args[2] + # unless entry == @name_args[2] # nlist << entry - #end + # end end role.env_run_lists_add(environment => nlist) end diff --git a/lib/chef/knife/ssh.rb b/lib/chef/knife/ssh.rb index 5bdbfd5498..74e457ac8e 100644 --- a/lib/chef/knife/ssh.rb +++ b/lib/chef/knife/ssh.rb @@ -138,7 +138,7 @@ class Chef def session ssh_error_handler = Proc.new do |server| if config[:on_error] - #Net::SSH::Multi magic to force exception to be re-raised. + # Net::SSH::Multi magic to force exception to be re-raised. throw :go, :raise else ui.warn "Failed to connect to #{server.host} -- #{$!.class.name}: #{$!.message}" diff --git a/lib/chef/mixin/windows_env_helper.rb b/lib/chef/mixin/windows_env_helper.rb index 65b4b33cf0..610c0cd075 100644 --- a/lib/chef/mixin/windows_env_helper.rb +++ b/lib/chef/mixin/windows_env_helper.rb @@ -32,7 +32,7 @@ class Chef include Chef::ReservedNames::Win32::API::System end - #see: http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx + # see: http://msdn.microsoft.com/en-us/library/ms682653%28VS.85%29.aspx HWND_BROADCAST = 0xffff WM_SETTINGCHANGE = 0x001A SMTO_BLOCK = 0x0001 diff --git a/lib/chef/node.rb b/lib/chef/node.rb index 114a38d8d0..b9a005e419 100644 --- a/lib/chef/node.rb +++ b/lib/chef/node.rb @@ -495,7 +495,7 @@ class Chef "chef_type" => "node", "default" => attributes.combined_default, "override" => attributes.combined_override, - #Render correctly for run_list items so malformed json does not result + # Render correctly for run_list items so malformed json does not result "run_list" => @primary_runlist.run_list.map { |item| item.to_s }, } # Chef Server rejects node JSON with extra keys; prior to 12.3, diff --git a/lib/chef/provider/mount/windows.rb b/lib/chef/provider/mount/windows.rb index 0fb9184783..1650d1e43a 100644 --- a/lib/chef/provider/mount/windows.rb +++ b/lib/chef/provider/mount/windows.rb @@ -41,7 +41,7 @@ class Chef def load_current_resource if is_volume(@new_resource.device) @mount = Chef::Util::Windows::Volume.new(@new_resource.mount_point) - else #assume network drive + else # assume network drive @mount = Chef::Util::Windows::NetUse.new(@new_resource.mount_point) end diff --git a/lib/chef/provider/package.rb b/lib/chef/provider/package.rb index 0af4f87d7f..01d8829dd2 100644 --- a/lib/chef/provider/package.rb +++ b/lib/chef/provider/package.rb @@ -307,7 +307,7 @@ class Chef # used by subclasses. deprecated. use #a_to_s instead. def expand_options(options) # its deprecated but still work to do to deprecate it fully - #Chef.deprecated(:package_misc, "expand_options is deprecated, use shell_out instead") + # Chef.deprecated(:package_misc, "expand_options is deprecated, use shell_out instead") if options " #{options.is_a?(Array) ? Shellwords.join(options) : options}" else diff --git a/lib/chef/provider/resource_update.rb b/lib/chef/provider/resource_update.rb index e069a8201c..d3c674dd22 100644 --- a/lib/chef/provider/resource_update.rb +++ b/lib/chef/provider/resource_update.rb @@ -31,7 +31,7 @@ class Chef attr_accessor :type attr_accessor :name - attr_accessor :duration #ms + attr_accessor :duration # ms attr_accessor :status attr_accessor :initial_state attr_accessor :final_state diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb index 3e177d744b..2482ce6a5c 100644 --- a/lib/chef/provider/service/windows.rb +++ b/lib/chef/provider/service/windows.rb @@ -33,12 +33,12 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service include Chef::ReservedNames::Win32::API::Error rescue LoadError include Chef::Win32ServiceConstants - #Win32::Service.get_start_type + # Win32::Service.get_start_type AUTO_START = "auto start" MANUAL = "demand start" DISABLED = "disabled" - #Win32::Service.get_current_state + # Win32::Service.get_current_state RUNNING = "running" STOPPED = "stopped" CONTINUE_PENDING = "continue pending" diff --git a/lib/chef/provider/subversion.rb b/lib/chef/provider/subversion.rb index c5c2439d84..dec9e06f87 100644 --- a/lib/chef/provider/subversion.rb +++ b/lib/chef/provider/subversion.rb @@ -16,7 +16,7 @@ # limitations under the License. # -#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" diff --git a/lib/chef/provider/windows_env.rb b/lib/chef/provider/windows_env.rb index 4e7fa34216..e5af49fa8f 100644 --- a/lib/chef/provider/windows_env.rb +++ b/lib/chef/provider/windows_env.rb @@ -63,7 +63,7 @@ class Chef # :: If a change is not required def requires_modify_or_create? if new_resource.delim - #e.g. check for existing value within PATH + # e.g. check for existing value within PATH new_values.inject(0) do |index, val| next_index = current_values.find_index val return true if next_index.nil? || next_index < index @@ -91,18 +91,18 @@ class Chef end end - #e.g. delete a PATH element + # e.g. delete a PATH element # # ==== Returns # :: If we handled the element case and caller should not delete the key # :: Caller should delete the key, either no :delim was specific or value was empty # after we removed the element. def delete_element - return false unless new_resource.delim #no delim: delete the key + return false unless new_resource.delim # no delim: delete the key needs_delete = new_values.any? { |v| current_values.include?(v) } if !needs_delete logger.trace("#{new_resource} element '#{new_resource.value}' does not exist") - return true #do not delete the key + return true # do not delete the key else new_value = current_values.select do |item| @@ -110,13 +110,13 @@ class Chef end.join(new_resource.delim) if new_value.empty? - return false #nothing left here, delete the key + return false # nothing left here, delete the key else old_value = new_resource.value(new_value) create_env logger.trace("#{new_resource} deleted #{old_value} element") new_resource.updated_by_last_action(true) - return true #we removed the element and updated; do not delete the key + return true # we removed the element and updated; do not delete the key end end end diff --git a/lib/chef/provider/windows_task.rb b/lib/chef/provider/windows_task.rb index 1676ec3f6b..af18a3f80d 100644 --- a/lib/chef/provider/windows_task.rb +++ b/lib/chef/provider/windows_task.rb @@ -195,7 +195,7 @@ class Chef logger.trace "#{new_resource} task exists" if current_resource.task.status == "not scheduled" converge_by("#{new_resource} task enabled") do - #TODO wind32-taskscheduler currently not having any method to handle this so using schtasks.exe here + # TODO wind32-taskscheduler currently not having any method to handle this so using schtasks.exe here run_schtasks "CHANGE", "ENABLE" => "" end else @@ -212,7 +212,7 @@ class Chef logger.info "#{new_resource} task exists" if %w{ready running}.include?(current_resource.task.status) converge_by("#{new_resource} task disabled") do - #TODO: in win32-taskscheduler there is no method whcih disbales the task so currently calling disable with schtasks.exe + # TODO: in win32-taskscheduler there is no method whcih disbales the task so currently calling disable with schtasks.exe run_schtasks "CHANGE", "DISABLE" => "" end else @@ -256,7 +256,7 @@ class Chef def trigger start_month, start_day, start_year = new_resource.start_day.to_s.split("/") start_hour, start_minute = new_resource.start_time.to_s.split(":") - #TODO currently end_month, end_year and end_year needs to be set to 0. If not set win32-taskscheduler throwing nil into integer error. + # TODO currently end_month, end_year and end_year needs to be set to 0. If not set win32-taskscheduler throwing nil into integer error. trigger_hash = { start_year: start_year.to_i, start_month: start_month.to_i, @@ -318,7 +318,7 @@ class Chef hours.to_i * 60 if hours end - #TODO : Try to optimize this method + # TODO : Try to optimize this method # known issue : Since start_day and time is not mandatory while updating weekly frequency for which start_day is not mentioned by user idempotency # is not gettting maintained as new_resource.start_day is nil and we fetch the day of week from start_day to set and its currently coming as nil and don't match with current_task def task_needs_update?(task) @@ -452,7 +452,7 @@ class Chef def days_of_week if new_resource.day - #this line of code is just to support backward compatibility of wild card * + # this line of code is just to support backward compatibility of wild card * new_resource.day = "mon, tue, wed, thu, fri, sat, sun" if new_resource.day == "*" && new_resource.frequency == :weekly days = new_resource.day.split(",") days.map! { |day| day.to_s.strip.upcase } @@ -475,7 +475,7 @@ class Chef end if new_resource.months - #this line of code is just to support backward compatibility of wild card * + # this line of code is just to support backward compatibility of wild card * new_resource.months = "jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec" if new_resource.months == "*" && new_resource.frequency == :monthly months = new_resource.months.split(",") months.map! { |month| month.to_s.strip.upcase } @@ -539,7 +539,7 @@ class Chef end end - #TODO: while creating the configuration settings win32-taskscheduler it accepts execution time limit values in ISO8601 formata + # TODO: while creating the configuration settings win32-taskscheduler it accepts execution time limit values in ISO8601 formata def config_settings settings = { execution_time_limit: new_resource.execution_time_limit, diff --git a/lib/chef/resource_reporter.rb b/lib/chef/resource_reporter.rb index aa1e427bc5..1ec25fc79a 100644 --- a/lib/chef/resource_reporter.rb +++ b/lib/chef/resource_reporter.rb @@ -72,7 +72,7 @@ class Chef as_hash["result"] = action.to_s if success? else - #as_hash["result"] = "failed" + # as_hash["result"] = "failed" end if new_resource.cookbook_name as_hash["cookbook_name"] = new_resource.cookbook_name diff --git a/lib/chef/role.rb b/lib/chef/role.rb index 96aa2185ff..f0c4cdd542 100644 --- a/lib/chef/role.rb +++ b/lib/chef/role.rb @@ -141,8 +141,8 @@ class Chef "override_attributes" => @override_attributes, "chef_type" => "role", - #Render to_json correctly for run_list items (both run_list and evn_run_lists) - #so malformed json does not result + # Render to_json correctly for run_list items (both run_list and evn_run_lists) + # so malformed json does not result "run_list" => run_list.run_list.map { |item| item.to_s }, "env_run_lists" => env_run_lists_without_default.inject({}) do |accumulator, (k, v)| accumulator[k] = v.map { |x| x.to_s } diff --git a/lib/chef/util/backup.rb b/lib/chef/util/backup.rb index a14f006d59..5b6bf0b9b8 100644 --- a/lib/chef/util/backup.rb +++ b/lib/chef/util/backup.rb @@ -52,7 +52,7 @@ class Chef nanoseconds = sprintf("%6f", time.to_f).split(".")[1] savetime = time.strftime("%Y%m%d%H%M%S.#{nanoseconds}") backup_filename = "#{path}.chef-#{savetime}" - backup_filename = backup_filename.sub(/^([A-Za-z]:)/, "") #strip drive letter on Windows + backup_filename = backup_filename.sub(/^([A-Za-z]:)/, "") # strip drive letter on Windows end end diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb index 74e2ca6a5f..5a01e72e70 100644 --- a/lib/chef/util/file_edit.rb +++ b/lib/chef/util/file_edit.rb @@ -40,38 +40,38 @@ class Chef @file_edited end - #search the file line by line and match each line with the given regex - #if matched, replace the whole line with newline. + # search the file line by line and match each line with the given regex + # if matched, replace the whole line with newline. def search_file_replace_line(regex, newline) @changes = (editor.replace_lines(regex, newline) > 0) || @changes end - #search the file line by line and match each line with the given regex - #if matched, replace the match (all occurrences) with the replace parameter + # search the file line by line and match each line with the given regex + # if matched, replace the match (all occurrences) with the replace parameter def search_file_replace(regex, replace) @changes = (editor.replace(regex, replace) > 0) || @changes end - #search the file line by line and match each line with the given regex - #if matched, delete the line + # search the file line by line and match each line with the given regex + # if matched, delete the line def search_file_delete_line(regex) @changes = (editor.remove_lines(regex) > 0) || @changes end - #search the file line by line and match each line with the given regex - #if matched, delete the match (all occurrences) from the line + # search the file line by line and match each line with the given regex + # if matched, delete the match (all occurrences) from the line def search_file_delete(regex) search_file_replace(regex, "") end - #search the file line by line and match each line with the given regex - #if matched, insert newline after each matching line + # search the file line by line and match each line with the given regex + # if matched, insert newline after each matching line def insert_line_after_match(regex, newline) @changes = (editor.append_line_after(regex, newline) > 0) || @changes end - #search the file line by line and match each line with the given regex - #if not matched, insert newline at the end of the file + # search the file line by line and match each line with the given regex + # if not matched, insert newline at the end of the file def insert_line_if_no_match(regex, newline) @changes = (editor.append_line_if_missing(regex, newline) > 0) || @changes end @@ -80,7 +80,7 @@ class Chef !!@changes end - #Make a copy of old_file and write new file out (only if file changed) + # Make a copy of old_file and write new file out (only if file changed) def write_file if @changes backup_pathname = original_pathname + ".old" diff --git a/lib/chef/util/windows/net_group.rb b/lib/chef/util/windows/net_group.rb index 214881df56..efe2561bf2 100644 --- a/lib/chef/util/windows/net_group.rb +++ b/lib/chef/util/windows/net_group.rb @@ -19,7 +19,7 @@ require "chef/util/windows" require "chef/win32/net" -#wrapper around a subset of the NetGroup* APIs. +# wrapper around a subset of the NetGroup* APIs. class Chef::Util::Windows::NetGroup private diff --git a/lib/chef/util/windows/net_use.rb b/lib/chef/util/windows/net_use.rb index 196ce42215..99626371a0 100644 --- a/lib/chef/util/windows/net_use.rb +++ b/lib/chef/util/windows/net_use.rb @@ -16,9 +16,9 @@ # limitations under the License. # -#the Win32 Volume APIs do not support mapping network drives. not supported by WMI either. -#see also: WNetAddConnection2 and WNetAddConnection3 -#see also cmd.exe: net use /? +# the Win32 Volume APIs do not support mapping network drives. not supported by WMI either. +# see also: WNetAddConnection2 and WNetAddConnection3 +# see also cmd.exe: net use /? require "chef/util/windows" require "chef/win32/net" diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index cf8bf3615a..d282ba9046 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -21,8 +21,8 @@ require "chef/exceptions" require "chef/win32/net" require "chef/win32/security" -#wrapper around a subset of the NetUser* APIs. -#nothing Chef specific, but not complete enough to be its own gem, so util for now. +# wrapper around a subset of the NetUser* APIs. +# nothing Chef specific, but not complete enough to be its own gem, so util for now. class Chef::Util::Windows::NetUser < Chef::Util::Windows private @@ -91,7 +91,7 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows LOGON32_PROVIDER_DEFAULT = Security::LOGON32_PROVIDER_DEFAULT LOGON32_LOGON_NETWORK = Security::LOGON32_LOGON_NETWORK - #XXX for an extra painful alternative, see: http://support.microsoft.com/kb/180548 + # XXX for an extra painful alternative, see: http://support.microsoft.com/kb/180548 def validate_credentials(passwd) token = Security.logon_user(@username, nil, passwd, LOGON32_LOGON_NETWORK, LOGON32_PROVIDER_DEFAULT) @@ -118,8 +118,8 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows # FIXME: yard with @yield def user_modify user = get_info - user[:last_logon] = user[:units_per_week] = 0 #ignored as per USER_INFO_3 doc - user[:logon_hours] = nil #PBYTE field; \0 == no changes + user[:last_logon] = user[:units_per_week] = 0 # ignored as per USER_INFO_3 doc + user[:logon_hours] = nil # PBYTE field; \0 == no changes yield(user) set_info(user) end @@ -141,9 +141,9 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows def disable_account user_modify do |user| user[:flags] |= NetUser::UF_ACCOUNTDISABLE - #This does not set the password to nil. It (for some reason) means to ignore updating the field. - #See similar behavior for the logon_hours field documented at - #http://msdn.microsoft.com/en-us/library/windows/desktop/aa371338%28v=vs.85%29.aspx + # This does not set the password to nil. It (for some reason) means to ignore updating the field. + # See similar behavior for the logon_hours field documented at + # http://msdn.microsoft.com/en-us/library/windows/desktop/aa371338%28v=vs.85%29.aspx user[:password] = nil end end @@ -151,9 +151,9 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows def enable_account user_modify do |user| user[:flags] &= ~NetUser::UF_ACCOUNTDISABLE - #This does not set the password to nil. It (for some reason) means to ignore updating the field. - #See similar behavior for the logon_hours field documented at - #http://msdn.microsoft.com/en-us/library/windows/desktop/aa371338%28v=vs.85%29.aspx + # This does not set the password to nil. It (for some reason) means to ignore updating the field. + # See similar behavior for the logon_hours field documented at + # http://msdn.microsoft.com/en-us/library/windows/desktop/aa371338%28v=vs.85%29.aspx user[:password] = nil end end diff --git a/lib/chef/util/windows/volume.rb b/lib/chef/util/windows/volume.rb index 358a3f4bb8..ff5f46163f 100644 --- a/lib/chef/util/windows/volume.rb +++ b/lib/chef/util/windows/volume.rb @@ -16,7 +16,7 @@ # limitations under the License. # -#simple wrapper around Volume APIs. might be possible with WMI, but possibly more complex. +# simple wrapper around Volume APIs. might be possible with WMI, but possibly more complex. require "chef/win32/api/file" require "chef/util/windows" @@ -25,7 +25,7 @@ class Chef::Util::Windows::Volume < Chef::Util::Windows attr_reader :mount_point def initialize(name) - name += "\\" unless name =~ /\\$/ #trailing slash required + name += "\\" unless name =~ /\\$/ # trailing slash required @mount_point = name end diff --git a/lib/chef/version.rb b/lib/chef/version.rb index 4854fae472..306c5398fa 100644 --- a/lib/chef/version.rb +++ b/lib/chef/version.rb @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # NOTE: This file is generated by running `rake version` in the top level of # this repo. Do not edit this manually. Edit the VERSION file and run the rake # task instead. -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! require "chef/version_string" diff --git a/lib/chef/win32/api.rb b/lib/chef/win32/api.rb index 503920a0ed..fccedd1d54 100644 --- a/lib/chef/win32/api.rb +++ b/lib/chef/win32/api.rb @@ -51,7 +51,7 @@ class Chef host.typedef :bool, :BOOL host.typedef :bool, :BOOLEAN host.typedef :uchar, :BYTE # Byte (8 bits). Declared as unsigned char - #CALLBACK: K, # Win32.API gem-specific ?? MSDN: #define CALLBACK __stdcall + # CALLBACK: K, # Win32.API gem-specific ?? MSDN: #define CALLBACK __stdcall host.typedef :char, :CHAR # 8-bit Windows (ANSI) character. See http://msdn.microsoft.com/en-us/library/dd183415%28VS.85%29.aspx host.typedef :uint32, :COLORREF # Red, green, blue (RGB) color value (32 bits). See COLORREF for more info. host.typedef :uint32, :DWORD # 32-bit unsigned integer. The range is 0 through 4,294,967,295 decimal. @@ -78,7 +78,7 @@ class Chef host.typedef :ulong, :HDESK # (L) Handle to a desktop. http://msdn.microsoft.com/en-us/library/ms682573%28VS.85%29.aspx host.typedef :ulong, :HDROP # (L) Handle to an internal drop structure. host.typedef :ulong, :HDWP # (L) Handle to a deferred window position structure. - host.typedef :ulong, :HENHMETAFILE #(L) Handle to an enhanced metafile. http://msdn.microsoft.com/en-us/library/dd145051%28VS.85%29.aspx + host.typedef :ulong, :HENHMETAFILE # (L) Handle to an enhanced metafile. http://msdn.microsoft.com/en-us/library/dd145051%28VS.85%29.aspx host.typedef :uint, :HFILE # (I) Special file handle to a file opened by OpenFile, not CreateFile. # WinDef.h: #host.typedef int HFILE; host.typedef :ulong, :HFONT # (L) Handle to a font. http://msdn.microsoft.com/en-us/library/dd162470%28VS.85%29.aspx @@ -107,7 +107,7 @@ class Chef host.typedef :int, :INT # 32-bit signed integer. The range is -2147483648 through 2147483647 decimal. host.typedef :int, :INT_PTR # Signed integer type for pointer precision. Use when casting a pointer to an integer # to perform pointer arithmetic. BaseTsd.h: - #if defined(_WIN64) host.typedef __int64 INT_PTR; #else host.typedef int INT_PTR; + # if defined(_WIN64) host.typedef __int64 INT_PTR; #else host.typedef int INT_PTR; host.typedef :int32, :INT32 # 32-bit signed integer. The range is -2,147,483,648 through +...647 decimal. host.typedef :int64, :INT64 # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807 host.typedef :ushort, :LANGID # Language identifier. For more information, see Locales. WinNT.h: #host.typedef WORD LANGID; @@ -122,7 +122,7 @@ class Chef host.typedef :int64, :LONGLONG # 64-bit signed integer. The range is –9,223,372,036,854,775,808 through +...807 host.typedef :long, :LONG_PTR # Signed long type for pointer precision. Use when casting a pointer to a long to # perform pointer arithmetic. BaseTsd.h: - #if defined(_WIN64) host.typedef __int64 LONG_PTR; #else host.typedef long LONG_PTR; + # if defined(_WIN64) host.typedef __int64 LONG_PTR; #else host.typedef long LONG_PTR; host.typedef :long, :LPARAM # Message parameter. WinDef.h as follows: #host.typedef LONG_PTR LPARAM; host.typedef :pointer, :LPBOOL # Pointer to a BOOL. WinDef.h as follows: #host.typedef BOOL far *LPBOOL; host.typedef :pointer, :LPBYTE # Pointer to a BYTE. WinDef.h as follows: #host.typedef BYTE far *LPBYTE; @@ -160,7 +160,7 @@ class Chef host.typedef :pointer, :PDWORD32 # Pointer to a DWORD32. host.typedef :pointer, :PDWORD64 # Pointer to a DWORD64. host.typedef :pointer, :PFLOAT # Pointer to a FLOAT. - host.typedef :pointer, :PGENERICMAPPING #Pointer to GENERIC_MAPPING + host.typedef :pointer, :PGENERICMAPPING # Pointer to GENERIC_MAPPING host.typedef :pointer, :PHALF_PTR # Pointer to a HALF_PTR. host.typedef :pointer, :PHANDLE # Pointer to a HANDLE. host.typedef :pointer, :PHKEY # Pointer to an HKEY. @@ -235,7 +235,7 @@ class Chef host.typedef :ulong_long, :USN # Update sequence number (USN). host.typedef :ushort, :WCHAR # 16-bit Unicode character. For more information, see Character Sets Used By Fonts. # In WinNT.h: host.typedef wchar_t WCHAR; - #WINAPI: K, # Calling convention for system functions. WinDef.h: define WINAPI __stdcall + # WINAPI: K, # Calling convention for system functions. WinDef.h: define WINAPI __stdcall host.typedef :ushort, :WORD # 16-bit unsigned integer. The range is 0 through 65535 decimal. host.typedef :uint, :WPARAM # Message parameter. WinDef.h as follows: host.typedef UINT_PTR WPARAM; end diff --git a/lib/chef/win32/api/error.rb b/lib/chef/win32/api/error.rb index 758eb98874..e37468c609 100644 --- a/lib/chef/win32/api/error.rb +++ b/lib/chef/win32/api/error.rb @@ -211,9 +211,9 @@ class Chef ERROR_META_EXPANSION_TOO_LONG = 208 # if "*a" > 8.3 ERROR_INVALID_SIGNAL_NUMBER = 209 ERROR_THREAD_1_INACTIVE = 210 - ERROR_INFO_NOT_AVAIL = 211 #@@ PTM 5550 + ERROR_INFO_NOT_AVAIL = 211 # @@ PTM 5550 ERROR_LOCKED = 212 - ERROR_BAD_DYNALINK = 213 #@@ PTM 5760 + ERROR_BAD_DYNALINK = 213 # @@ PTM 5760 ERROR_TOO_MANY_MODULES = 214 ERROR_NESTING_NOT_ALLOWED = 215 ERROR_EXE_MACHINE_TYPE_MISMATCH = 216 diff --git a/lib/chef/win32/api/file.rb b/lib/chef/win32/api/file.rb index 6aa2927e1f..a239671557 100644 --- a/lib/chef/win32/api/file.rb +++ b/lib/chef/win32/api/file.rb @@ -461,22 +461,22 @@ BOOL WINAPI DeviceIoControl( =end safe_attach_function :DeviceIoControl, [:HANDLE, :DWORD, :LPVOID, :DWORD, :LPVOID, :DWORD, :LPDWORD, :pointer], :BOOL -#BOOL WINAPI DeleteVolumeMountPoint( - #_In_ LPCTSTR lpszVolumeMountPoint -#); +# BOOL WINAPI DeleteVolumeMountPoint( + # _In_ LPCTSTR lpszVolumeMountPoint +# ); safe_attach_function :DeleteVolumeMountPointW, [:LPCTSTR], :BOOL -#BOOL WINAPI SetVolumeMountPoint( - #_In_ LPCTSTR lpszVolumeMountPoint, - #_In_ LPCTSTR lpszVolumeName -#); +# BOOL WINAPI SetVolumeMountPoint( + # _In_ LPCTSTR lpszVolumeMountPoint, + # _In_ LPCTSTR lpszVolumeName +# ); safe_attach_function :SetVolumeMountPointW, [:LPCTSTR, :LPCTSTR], :BOOL -#BOOL WINAPI GetVolumeNameForVolumeMountPoint( - #_In_ LPCTSTR lpszVolumeMountPoint, - #_Out_ LPTSTR lpszVolumeName, - #_In_ DWORD cchBufferLength -#); +# BOOL WINAPI GetVolumeNameForVolumeMountPoint( + # _In_ LPCTSTR lpszVolumeMountPoint, + # _Out_ LPTSTR lpszVolumeName, + # _In_ DWORD cchBufferLength +# ); safe_attach_function :GetVolumeNameForVolumeMountPointW, [:LPCTSTR, :LPTSTR, :DWORD], :BOOL =begin diff --git a/lib/chef/win32/api/net.rb b/lib/chef/win32/api/net.rb index 169c68bbdf..e7c191dd9c 100644 --- a/lib/chef/win32/api/net.rb +++ b/lib/chef/win32/api/net.rb @@ -43,7 +43,7 @@ class Chef USE_NOFORCE = 0 USE_FORCE = 1 - USE_LOTS_OF_FORCE = 2 #every windows API should support this flag + USE_LOTS_OF_FORCE = 2 # every windows API should support this flag NERR_Success = 0 # rubocop:disable Naming/ConstantName ERROR_MORE_DATA = 234 @@ -158,32 +158,32 @@ class Chef :ui2_domainname, :LMSTR end - #NET_API_STATUS NetLocalGroupAdd( - #_In_ LPCWSTR servername, - #_In_ DWORD level, - #_In_ LPBYTE buf, - #_Out_ LPDWORD parm_err - #); + # NET_API_STATUS NetLocalGroupAdd( + # _In_ LPCWSTR servername, + # _In_ DWORD level, + # _In_ LPBYTE buf, + # _Out_ LPDWORD parm_err + # ); safe_attach_function :NetLocalGroupAdd, [ :LPCWSTR, :DWORD, :LPBYTE, :LPDWORD ], :DWORD - #NET_API_STATUS NetLocalGroupDel( - #_In_ LPCWSTR servername, - #_In_ LPCWSTR groupname - #); + # NET_API_STATUS NetLocalGroupDel( + # _In_ LPCWSTR servername, + # _In_ LPCWSTR groupname + # ); safe_attach_function :NetLocalGroupDel, [:LPCWSTR, :LPCWSTR], :DWORD - #NET_API_STATUS NetLocalGroupGetMembers( - #_In_ LPCWSTR servername, - #_In_ LPCWSTR localgroupname, - #_In_ DWORD level, - #_Out_ LPBYTE *bufptr, - #_In_ DWORD prefmaxlen, - #_Out_ LPDWORD entriesread, - #_Out_ LPDWORD totalentries, - #_Inout_ PDWORD_PTR resumehandle - #); + # NET_API_STATUS NetLocalGroupGetMembers( + # _In_ LPCWSTR servername, + # _In_ LPCWSTR localgroupname, + # _In_ DWORD level, + # _Out_ LPBYTE *bufptr, + # _In_ DWORD prefmaxlen, + # _Out_ LPDWORD entriesread, + # _Out_ LPDWORD totalentries, + # _Inout_ PDWORD_PTR resumehandle + # ); safe_attach_function :NetLocalGroupGetMembers, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE, :DWORD, :LPDWORD, :LPDWORD, :PDWORD_PTR @@ -209,102 +209,102 @@ class Chef # ); safe_attach_function :NetApiBufferFree, [:LPVOID], :DWORD - #NET_API_STATUS NetUserAdd( - #_In_ LMSTR servername, - #_In_ DWORD level, - #_In_ LPBYTE buf, - #_Out_ LPDWORD parm_err - #); + # NET_API_STATUS NetUserAdd( + # _In_ LMSTR servername, + # _In_ DWORD level, + # _In_ LPBYTE buf, + # _Out_ LPDWORD parm_err + # ); safe_attach_function :NetUserAdd, [ :LMSTR, :DWORD, :LPBYTE, :LPDWORD ], :DWORD - #NET_API_STATUS NetLocalGroupAddMembers( + # NET_API_STATUS NetLocalGroupAddMembers( # _In_ LPCWSTR servername, # _In_ LPCWSTR groupname, # _In_ DWORD level, # _In_ LPBYTE buf, # _In_ DWORD totalentries - #); + # ); safe_attach_function :NetLocalGroupAddMembers, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE, :DWORD ], :DWORD - #NET_API_STATUS NetLocalGroupSetMembers( + # NET_API_STATUS NetLocalGroupSetMembers( # _In_ LPCWSTR servername, # _In_ LPCWSTR groupname, # _In_ DWORD level, # _In_ LPBYTE buf, # _In_ DWORD totalentries - #); + # ); safe_attach_function :NetLocalGroupSetMembers, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE, :DWORD ], :DWORD - #NET_API_STATUS NetLocalGroupDelMembers( + # NET_API_STATUS NetLocalGroupDelMembers( # _In_ LPCWSTR servername, # _In_ LPCWSTR groupname, # _In_ DWORD level, # _In_ LPBYTE buf, # _In_ DWORD totalentries - #); + # ); safe_attach_function :NetLocalGroupDelMembers, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE, :DWORD ], :DWORD - #NET_API_STATUS NetUserGetInfo( + # NET_API_STATUS NetUserGetInfo( # _In_ LPCWSTR servername, # _In_ LPCWSTR username, # _In_ DWORD level, # _Out_ LPBYTE *bufptr - #); + # ); safe_attach_function :NetUserGetInfo, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE ], :DWORD - #NET_API_STATUS NetApiBufferFree( + # NET_API_STATUS NetApiBufferFree( # _In_ LPVOID Buffer - #); + # ); safe_attach_function :NetApiBufferFree, [:LPVOID], :DWORD - #NET_API_STATUS NetUserSetInfo( + # NET_API_STATUS NetUserSetInfo( # _In_ LPCWSTR servername, # _In_ LPCWSTR username, # _In_ DWORD level, # _In_ LPBYTE buf, # _Out_ LPDWORD parm_err - #); + # ); safe_attach_function :NetUserSetInfo, [ :LPCWSTR, :LPCWSTR, :DWORD, :LPBYTE, :LPDWORD ], :DWORD - #NET_API_STATUS NetUserDel( + # NET_API_STATUS NetUserDel( # _In_ LPCWSTR servername, # _In_ LPCWSTR username - #); + # ); safe_attach_function :NetUserDel, [:LPCWSTR, :LPCWSTR], :DWORD - #NET_API_STATUS NetUseDel( - #_In_ LMSTR UncServerName, - #_In_ LMSTR UseName, - #_In_ DWORD ForceCond - #); + # NET_API_STATUS NetUseDel( + # _In_ LMSTR UncServerName, + # _In_ LMSTR UseName, + # _In_ DWORD ForceCond + # ); safe_attach_function :NetUseDel, [:LMSTR, :LMSTR, :DWORD], :DWORD - #NET_API_STATUS NetUseGetInfo( - #_In_ LMSTR UncServerName, - #_In_ LMSTR UseName, - #_In_ DWORD Level, - #_Out_ LPBYTE *BufPtr - #); + # NET_API_STATUS NetUseGetInfo( + # _In_ LMSTR UncServerName, + # _In_ LMSTR UseName, + # _In_ DWORD Level, + # _Out_ LPBYTE *BufPtr + # ); safe_attach_function :NetUseGetInfo, [:LMSTR, :LMSTR, :DWORD, :pointer], :DWORD - #NET_API_STATUS NetUseAdd( - #_In_ LMSTR UncServerName, - #_In_ DWORD Level, - #_In_ LPBYTE Buf, - #_Out_ LPDWORD ParmError - #); + # NET_API_STATUS NetUseAdd( + # _In_ LMSTR UncServerName, + # _In_ DWORD Level, + # _In_ LPBYTE Buf, + # _Out_ LPDWORD ParmError + # ); safe_attach_function :NetUseAdd, [:LMSTR, :DWORD, :LPBYTE, :LPDWORD], :DWORD end end diff --git a/lib/chef/win32/security/securable_object.rb b/lib/chef/win32/security/securable_object.rb index 16841413b7..f0bbfc7354 100644 --- a/lib/chef/win32/security/securable_object.rb +++ b/lib/chef/win32/security/securable_object.rb @@ -42,10 +42,10 @@ class Chef # compare an existing ACE with one you want to create. def predict_rights_mask(generic_mask) mask = generic_mask - #mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_READ if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_READ) != 0 - #mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_WRITE if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE) != 0 - #mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_EXECUTE if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE) != 0 - #mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_ALL if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_ALL) != 0 + # mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_READ if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_READ) != 0 + # mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_WRITE if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE) != 0 + # mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_EXECUTE if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_EXECUTE) != 0 + # mask |= Chef::ReservedNames::Win32::API::Security::STANDARD_RIGHTS_ALL if (mask | Chef::ReservedNames::Win32::API::Security::GENERIC_ALL) != 0 if type == :SE_FILE_OBJECT mask |= Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_READ if (mask & Chef::ReservedNames::Win32::API::Security::GENERIC_READ) != 0 mask |= Chef::ReservedNames::Win32::API::Security::FILE_GENERIC_WRITE if (mask & Chef::ReservedNames::Win32::API::Security::GENERIC_WRITE) != 0 -- cgit v1.2.1