From 76f1d1bba48570e4fd4f9f26b45c259d5748174a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tino=20V=C3=A1zquez?= Date: Sat, 2 Dec 2023 13:22:31 +0100 Subject: [PATCH] L #-: Linting for rubocop 1.58.0 --- src/cli/oneacct | 2 +- src/cli/oneshowback | 2 +- src/flow/lib/models/role.rb | 4 ++-- src/hem/onehem-server.rb | 2 +- src/onedb/fsck/quotas.rb | 14 +++++++------- src/vmm_mad/exec/one_vmm_exec.rb | 6 +++--- .../remotes/lib/lxc/storage/storageutils.rb | 2 +- .../remotes/lib/vcenter_driver/virtual_machine.rb | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/cli/oneacct b/src/cli/oneacct index 80f08de33e..ef66ee70dd 100755 --- a/src/cli/oneacct +++ b/src/cli/oneacct @@ -75,7 +75,7 @@ CommandParser::CmdParser.new(ARGV) do exit(0) end - filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL) + filter_flag = options[:userfilter] || VirtualMachinePool::INFO_ALL if options[:start_time] start_time = options[:start_time].to_i else diff --git a/src/cli/oneshowback b/src/cli/oneshowback index 9509545cea..7f729243a7 100755 --- a/src/cli/oneshowback +++ b/src/cli/oneshowback @@ -77,7 +77,7 @@ CommandParser::CmdParser.new(ARGV) do exit(0) end - filter_flag = (options[:userfilter] || VirtualMachinePool::INFO_ALL) + filter_flag = options[:userfilter] || VirtualMachinePool::INFO_ALL start_month = -1 start_year = -1 diff --git a/src/flow/lib/models/role.rb b/src/flow/lib/models/role.rb index 512f2b7ddd..020114a54a 100644 --- a/src/flow/lib/models/role.rb +++ b/src/flow/lib/models/role.rb @@ -655,8 +655,8 @@ module OpenNebula return OpenNebula::Error.new("Role #{name} is in DONE state") end - do_offset = (!period.nil? && period.to_i > 0 && - !vms_per_period.nil? && vms_per_period.to_i > 0) + do_offset = !period.nil? && period.to_i > 0 && + !vms_per_period.nil? && vms_per_period.to_i > 0 nodes.each_with_index do |node, index| vm_id = node['deploy_id'] diff --git a/src/hem/onehem-server.rb b/src/hem/onehem-server.rb index 6fc49bb21f..50b1c2720b 100755 --- a/src/hem/onehem-server.rb +++ b/src/hem/onehem-server.rb @@ -193,7 +193,7 @@ module HEMHook def as_stdin? astdin = self['TEMPLATE/ARGUMENTS_STDIN'] - astdin &&= (astdin.casecmp('yes') || astdin.casecmp('true')) + astdin &&= astdin.casecmp('yes') || astdin.casecmp('true') return false if astdin.nil? diff --git a/src/onedb/fsck/quotas.rb b/src/onedb/fsck/quotas.rb index 0468adaddd..481e5b2610 100644 --- a/src/onedb/fsck/quotas.rb +++ b/src/onedb/fsck/quotas.rb @@ -28,7 +28,7 @@ module OneDBFsck # resource[0] = u if user, g if group id_field = "#{resource[0]}id" - oid = row["#{resource}_oid".to_sym] + oid = row["#{resource}_oid"] params = [doc, "#{id_field}=#{oid}", resource.capitalize] if type == 'running' @@ -37,10 +37,10 @@ module OneDBFsck calculate_quotas(*params) end - object = { "#{resource}_oid".to_sym => oid, + object = { "#{resource}_oid" => oid, :body => doc.root.to_s } - @db["#{resource}_quotas".to_sym].insert(object) + @db["#{resource}_quotas"].insert(object) end end @@ -394,10 +394,10 @@ module OneDBFsck vm_elem.xpath("#{cpu}_USED").each do |e| cpu_used = (cpu_used / 100.0) - different = (e.text.to_f != cpu_used || - ![format('%.2f', cpu_used), - format('%.1f', cpu_used), - format('%.0f', cpu_used)].include?(e.text)) + different = e.text.to_f != cpu_used || + ![format('%.2f', cpu_used), + format('%.1f', cpu_used), + format('%.0f', cpu_used)].include?(e.text) cpu_used_str = format('%.2f', cpu_used) diff --git a/src/vmm_mad/exec/one_vmm_exec.rb b/src/vmm_mad/exec/one_vmm_exec.rb index e4c3dba13c..fedd2df181 100755 --- a/src/vmm_mad/exec/one_vmm_exec.rb +++ b/src/vmm_mad/exec/one_vmm_exec.rb @@ -167,8 +167,8 @@ class VmmAction if DriverExecHelper.failed?(result) info << (@data[:failed_info] || '-') - elsif !@data["#{@main_action}_info".to_sym].nil? - info << @data["#{@main_action}_info".to_sym] + elsif !@data["#{@main_action}_info"].nil? + info << @data["#{@main_action}_info"] end @vmm.send_message(VirtualMachineDriver::ACTION[@main_action], @@ -290,7 +290,7 @@ class VmmAction end # Save the step info - @data["#{step[:action]}_info".to_sym] = info.strip + @data["#{step[:action]}_info"] = info.strip # Roll back steps, store failed info and break steps if DriverExecHelper.failed?(result) diff --git a/src/vmm_mad/remotes/lib/lxc/storage/storageutils.rb b/src/vmm_mad/remotes/lib/lxc/storage/storageutils.rb index 2dbbf1c7bb..6be6552743 100644 --- a/src/vmm_mad/remotes/lib/lxc/storage/storageutils.rb +++ b/src/vmm_mad/remotes/lib/lxc/storage/storageutils.rb @@ -55,7 +55,7 @@ module Storage device_fs = device_fs(device) end - opts_fs = options[:mountopts]["dev_#{device_fs}".to_sym] + opts_fs = options[:mountopts]["dev_#{device_fs}"] opts_fs ||= '' # resize and mount operations according to the used filesystem diff --git a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb index 1de36a77b6..02ea268c9c 100644 --- a/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb +++ b/src/vmm_mad/remotes/lib/vcenter_driver/virtual_machine.rb @@ -2720,7 +2720,7 @@ end img_name = VCenterDriver::FileHelper.unescape_path(img_name_escaped) vc_disks.each do |d| - key_matches = (unmanaged_key && d[:key] == unmanaged_key.to_i) + key_matches = unmanaged_key && d[:key] == unmanaged_key.to_i path_matches = (d[:path_wo_ds] == img_name) if key_matches || path_matches