Merge pull request #360 from highb/2020-03-05_unsafe_rubocop_fixes

"Unsafe" rubocop fixes
This commit is contained in:
mattkirby 2020-03-05 16:03:21 -08:00 committed by GitHub
commit f85f5126e8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 46 additions and 9 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class API < Sinatra::Base
def initialize

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class API
class Dashboard < Sinatra::Base

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class API

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class API
class Reroute < Sinatra::Base

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class API
class V1 < Sinatra::Base
@ -934,7 +936,7 @@ module Vmpooler
end
end
if failure.size > 0
if !failure.empty?
status 400
result['failure'] = failure
else

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class Dashboard < Sinatra::Base
def config

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class DummyStatsd
attr_reader :server, :port, :prefix

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'connection_pool'
module Vmpooler

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rubygems' unless defined?(Gem)
module Vmpooler

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rubygems' unless defined?(Gem)
module Vmpooler

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'vmpooler/providers'
require 'spicy-proton'
@ -54,7 +56,7 @@ module Vmpooler
pool_keys.each do |k|
to_set[k] = pool[k]
end
to_set['alias'] = pool['alias'].join(',') if to_set.has_key?('alias')
to_set['alias'] = pool['alias'].join(',') if to_set.key?('alias')
$redis.hmset("vmpooler__pool__#{pool['name']}", to_set.to_a.flatten) unless to_set.empty?
end
previously_configured_pools.each do |pool|

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'pathname'
module Vmpooler
@ -37,7 +39,7 @@ module Vmpooler
# we don't exactly know if the provider name matches the main file name that should be loaded
# so we use globs to get everything like the name
# this could mean that vsphere5 and vsphere6 are loaded when only vsphere5 is used
Dir.glob(File.join(gem_path, "*#{name}*.rb")).each do |file|
Dir.glob(File.join(gem_path, "*#{name}*.rb")).sort.each do |file|
require file
end
end

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
class PoolManager
class Provider

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'yaml'
require 'vmpooler/providers/base'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'vmpooler/providers/base'
module Vmpooler
@ -483,9 +485,9 @@ module Vmpooler
end
# vSphere helper methods
ADAPTER_TYPE = 'lsiLogic'.freeze
DISK_TYPE = 'thin'.freeze
DISK_MODE = 'persistent'.freeze
ADAPTER_TYPE = 'lsiLogic'
DISK_TYPE = 'thin'
DISK_MODE = 'persistent'
def ensured_vsphere_connection(connection_pool_object)
connection_pool_object[:connection] = connect_to_vsphere unless vsphere_connection_ok?(connection_pool_object[:connection])

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rubygems' unless defined?(Gem)
require 'statsd'

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
VERSION = '0.10.3'.freeze
VERSION = '0.10.3'
end