summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:31:50 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-07-02 10:31:50 -0700
commitcdad2f684debda15e8cf773185e78f93892eda35 (patch)
tree24d815246b9130d040608b15a5a36d942e538587 /lib/chef/util
parent34a6dd714503abbb0e6d240a4832f245d5c3ab06 (diff)
downloadchef-cdad2f684debda15e8cf773185e78f93892eda35.tar.gz
fix Layout/LeadingCommentSpace
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/util')
-rw-r--r--lib/chef/util/backup.rb2
-rw-r--r--lib/chef/util/file_edit.rb26
-rw-r--r--lib/chef/util/windows/net_group.rb2
-rw-r--r--lib/chef/util/windows/net_use.rb6
-rw-r--r--lib/chef/util/windows/net_user.rb22
-rw-r--r--lib/chef/util/windows/volume.rb4
6 files changed, 31 insertions, 31 deletions
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