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
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']