Skip to content

Commit

Permalink
hound fixes and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sumit Jamgade committed Jan 22, 2019
1 parent 319518b commit e8a34bf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chef/cookbooks/barclamp/libraries/barclamp_library.rb
Original file line number Diff line number Diff line change
Expand Up @@ -444,17 +444,17 @@ def last_two_configs(group, barclamp, instance)

def loadattr(hash, attrlist)
i = 0
return hash unless attrlist.length > 0
return hash if attrlist.empty?
while hash.respond_to?(:[])
unless hash.has_key?(attrlist[i])
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
return nil
unless hash.key?(attrlist[i])
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
return nil
end
hash = hash[attrlist[i]]
i += 1
if attrlist.length == i
# Chef::Log.debug("[smart] loadattr return #{hash}")
return hash
# Chef::Log.debug("[smart] loadattr return #{hash}")
return hash
end
end
Chef::Log.debug("[smart] hash does not respond to []")
Expand Down

0 comments on commit e8a34bf

Please sign in to comment.