From c26b6d470536b4c549c1968ac665716a78202eb4 Mon Sep 17 00:00:00 2001 From: "Carlos J. Herrera" <37907824+carloshm91@users.noreply.github.com> Date: Fri, 12 Jul 2019 11:05:05 -0400 Subject: [PATCH] L #~: linting code of vcenter (#3507) Signed-off-by: Carlos J. Herrera Matos --- share/linters/.rubocop.yml | 1 - src/vmm_mad/remotes/vcenter/deploy | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/share/linters/.rubocop.yml b/share/linters/.rubocop.yml index 6b0c943b74..74d776b4fa 100644 --- a/share/linters/.rubocop.yml +++ b/share/linters/.rubocop.yml @@ -111,7 +111,6 @@ AllCops: - src/vmm_mad/remotes/vcenter/shutdown - src/vmm_mad/remotes/vcenter/attach_disk - src/vmm_mad/remotes/vcenter/reboot - - src/vmm_mad/remotes/vcenter/deploy - src/vmm_mad/remotes/vcenter/reset - src/vmm_mad/remotes/vcenter/reconfigure - src/vmm_mad/remotes/vcenter/save diff --git a/src/vmm_mad/remotes/vcenter/deploy b/src/vmm_mad/remotes/vcenter/deploy index 8c45c90f6e..72006e18d1 100755 --- a/src/vmm_mad/remotes/vcenter/deploy +++ b/src/vmm_mad/remotes/vcenter/deploy @@ -19,9 +19,13 @@ ONE_LOCATION = ENV['ONE_LOCATION'] unless defined?(ONE_LOCATION) if !ONE_LOCATION - RUBY_LIB_LOCATION = '/usr/lib/one/ruby' unless defined?(RUBY_LIB_LOCATION) + unless defined?(RUBY_LIB_LOCATION) + RUBY_LIB_LOCATION = '/usr/lib/one/ruby' + end else - RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby' unless defined?(RUBY_LIB_LOCATION) + unless defined?(RUBY_LIB_LOCATION) + RUBY_LIB_LOCATION = ONE_LOCATION + '/lib/ruby' + end end $LOAD_PATH << RUBY_LIB_LOCATION @@ -77,7 +81,7 @@ rescue StandardError => e else message = "Deploy of VM #{vm_id} on vCenter cluster #{cluster_name} " \ "with #{dfile} failed due to \"#{e.message}\"" \ - "on the final attempt." + 'on the final attempt.' if e.message.include?('ManagedObjectNotFound') template_id = drv_action['TEMPLATE/TEMPLATE_ID'].to_i @@ -97,7 +101,9 @@ rescue StandardError => e end end OpenNebula.log_error(message) - STDERR.puts "#{message} #{e.backtrace}" if VCenterDriver::CONFIG[:debug_information] + if VCenterDriver::CONFIG[:debug_information] + STDERR.puts "#{message} #{e.backtrace}" + end sleep CONFIG[:retry_interval].to_i retry if retries < CONFIG[:retries]