diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-02 15:09:07 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2019-07-02 15:09:07 -0700 |
commit | 7a1a6c8ef26c787e4b6dd1602f3d158b37e81720 (patch) | |
tree | 1e390cd535b38368d091cbb33e5d419408d5ce00 /lib/chef/util | |
parent | 77f8739a4741e2370e40ec39345a92a6ea393a1a (diff) | |
download | chef-7a1a6c8ef26c787e4b6dd1602f3d158b37e81720.tar.gz |
fix Layout/EmptyLineAfterGuardClause
i like this one, gives visual priority to returns or raises that are
buried in the middle of things.
Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'lib/chef/util')
-rw-r--r-- | lib/chef/util/diff.rb | 3 | ||||
-rw-r--r-- | lib/chef/util/dsc/configuration_generator.rb | 1 | ||||
-rw-r--r-- | lib/chef/util/file_edit.rb | 1 | ||||
-rw-r--r-- | lib/chef/util/windows/net_user.rb | 1 |
4 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb index decff35d85..64cf41fab2 100644 --- a/lib/chef/util/diff.rb +++ b/lib/chef/util/diff.rb @@ -58,6 +58,7 @@ class Chef def for_reporting # caller needs to ensure that new files aren't posted to resource reporting return nil if @diff.nil? + @diff.join("\\n") end @@ -111,6 +112,7 @@ class Chef file_length_difference = hunk.file_length_difference next unless old_hunk next if hunk.merge(old_hunk) + diff_str << old_hunk.diff(:unified) << "\n" ensure old_hunk = hunk @@ -170,6 +172,7 @@ class Chef return buff !~ /\A[\s[:print:]]*\z/m rescue ArgumentError => e return true if e.message =~ /invalid byte sequence/ + raise end end diff --git a/lib/chef/util/dsc/configuration_generator.rb b/lib/chef/util/dsc/configuration_generator.rb index d7fe17f979..a00c703c76 100644 --- a/lib/chef/util/dsc/configuration_generator.rb +++ b/lib/chef/util/dsc/configuration_generator.rb @@ -74,6 +74,7 @@ class Chef::Util::DSC if merged_configuration_flags.key?(switch.to_s.downcase.to_sym) raise ArgumentError, "The `flags` attribute for the dsc_script resource contained a command line switch :#{switch} that is disallowed." end + merged_configuration_flags[switch.to_s.downcase.to_sym] = value end end diff --git a/lib/chef/util/file_edit.rb b/lib/chef/util/file_edit.rb index 5ea3c17129..7d6bb88f60 100644 --- a/lib/chef/util/file_edit.rb +++ b/lib/chef/util/file_edit.rb @@ -30,6 +30,7 @@ class Chef def initialize(filepath) raise ArgumentError, "File '#{filepath}' does not exist" unless File.exist?(filepath) + @editor = Editor.new(File.open(filepath, &:readlines)) @original_pathname = filepath @file_edited = false diff --git a/lib/chef/util/windows/net_user.rb b/lib/chef/util/windows/net_user.rb index 615e666b66..78bd1e31a3 100644 --- a/lib/chef/util/windows/net_user.rb +++ b/lib/chef/util/windows/net_user.rb @@ -103,6 +103,7 @@ class Chef::Util::Windows::NetUser < Chef::Util::Windows if e.to_s =~ /System Error Code: 1326/ return false end + # all other exceptions will assume we cannot logon for a different reason Chef::Log.trace("Unable to login with the specified credentials. Assuming the credentials are valid.") true |