"Unsafe" rubocop fixes

Adds the remaining "unsafe" fixes that aren't included in #359
This commit is contained in:
Brandon High 2020-03-05 11:16:43 -08:00
parent 252a2c2344
commit f22a84f26f
No known key found for this signature in database
GPG key ID: 270079C784FCAFDE
19 changed files with 46 additions and 9 deletions

View file

@ -1,3 +1,5 @@
# frozen_string_literal: true
module Vmpooler
require 'date'
require 'json'
@ -41,7 +43,7 @@ module Vmpooler
# Bail out if someone attempts to start vmpooler with dummy authentication
# without enbaling debug mode.
if parsed_config.has_key? :auth
if parsed_config.key? :auth
if parsed_config[:auth]['provider'] == 'dummy'
unless ENV['VMPOOLER_DEBUG']
warning = [
@ -94,7 +96,7 @@ module Vmpooler
parsed_config[:graphite]['port'] = string_to_int(ENV['GRAPHITE_PORT']) if ENV['GRAPHITE_PORT']
parsed_config[:auth] = parsed_config[:auth] || {} if ENV['AUTH_PROVIDER']
if parsed_config.has_key? :auth
if parsed_config.key? :auth
parsed_config[:auth]['provider'] = ENV['AUTH_PROVIDER'] if ENV['AUTH_PROVIDER']
parsed_config[:auth][:ldap] = parsed_config[:auth][:ldap] || {} if parsed_config[:auth]['provider'] == 'ldap'
parsed_config[:auth][:ldap]['host'] = ENV['LDAP_HOST'] if ENV['LDAP_HOST']