Skip to content

Commit e9f2fa9

Browse files
author
Sumit Jamgade
committed
hound fixes and refactor
1 parent 319518b commit e9f2fa9

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

chef/cookbooks/barclamp/libraries/barclamp_library.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ def get(recipe)
431431
end
432432
end
433433

434-
class Config
434+
435435
class << self
436436
attr_accessor :node
437437

@@ -444,17 +444,17 @@ def last_two_configs(group, barclamp, instance)
444444

445445
def loadattr(hash, attrlist)
446446
i = 0
447-
return hash unless attrlist.length > 0
447+
return hash if attrlist.empty?
448448
while hash.respond_to?(:[])
449-
unless hash.has_key?(attrlist[i])
450-
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
451-
return nil
449+
unless hash.key?(attrlist[i])
450+
Chef::Log.debug("[smart] hash is missing #{attrlist[i]}")
451+
return nil
452452
end
453453
hash = hash[attrlist[i]]
454454
i += 1
455455
if attrlist.length == i
456-
# Chef::Log.debug("[smart] loadattr return #{hash}")
457-
return hash
456+
# Chef::Log.debug("[smart] loadattr return #{hash}")
457+
return hash
458458
end
459459
end
460460
Chef::Log.debug("[smart] hash does not respond to []")

0 commit comments

Comments
 (0)