From 28ef86a7ff052e69635caead95e42144ed93f846 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 30 Nov 2015 09:49:41 +0000 Subject: [PATCH] Fix some rubocop warnings --- cookbooks/hardware/templates/default/ohai.rb.erb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cookbooks/hardware/templates/default/ohai.rb.erb b/cookbooks/hardware/templates/default/ohai.rb.erb index 965a52af6..1f0a90fb6 100644 --- a/cookbooks/hardware/templates/default/ohai.rb.erb +++ b/cookbooks/hardware/templates/default/ohai.rb.erb @@ -13,9 +13,9 @@ Ohai.plugin(:Hardware) do def parse_disk_size(size) if size =~ /^(\d+(?:\.\d+))?\s*TB/i - sprintf "%dTB", Regexp.last_match(1).to_f * 2**40 / 1_000_000_000_000 + format "%dTB", Regexp.last_match(1).to_f * 2**40 / 1_000_000_000_000 elsif size =~ /^(\d+(?:\.\d+))?\s*GB/i - sprintf "%dGB", Regexp.last_match(1).to_f * 2**30 / 1000000000 + format "%dGB", Regexp.last_match(1).to_f * 2**30 / 1000000000 end end @@ -119,9 +119,9 @@ Ohai.plugin(:Hardware) do end if size > 1_000_000_000_000 - size = sprintf "%d TB", size / 1_000_000_000_000 + size = format "%d TB", size / 1_000_000_000_000 elsif size > 1000000000 - size = sprintf "%d GB", size / 1000000000 + size = format "%d GB", size / 1000000000 end devices[:disks] << { @@ -265,11 +265,11 @@ Ohai.plugin(:Hardware) do controllers << controller elsif line =~ /^Bus Number\s+:\s+(\d+)$/ - controller[:pci_slot] = sprintf "0000:%02x", Integer("0x#{Regexp.last_match(1)}") + controller[:pci_slot] = format "0000:%02x", Integer("0x#{Regexp.last_match(1)}") elsif line =~ /^Device Number\s+:\s+(\d+)$/ - controller[:pci_slot] = sprintf "%s:%02x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}") + controller[:pci_slot] = format "%s:%02x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}") elsif line =~ /^Function Number\s+:\s+(\d+)$/ - controller[:pci_slot] = sprintf "%s.%01x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}") + controller[:pci_slot] = format "%s.%01x", controller[:pci_slot], Integer("0x#{Regexp.last_match(1)}") end end -- 2.39.5