Fix rubocop issues

This commit is contained in:
Brandon High 2019-12-04 16:40:57 -08:00
parent 9a2cd816df
commit 1e67715e2c
No known key found for this signature in database
GPG key ID: 270079C784FCAFDE
4 changed files with 27 additions and 26 deletions

View file

@ -18,6 +18,8 @@ Layout/HashAlignment:
EnforcedHashRocketStyle: table
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Metrics/ParameterLists:
Enabled: False
Style/StderrPuts:
Enabled: false

View file

@ -17,7 +17,7 @@ require 'vmfloaty/ssh'
class Vmfloaty
include Commander::Methods
def run
def run # rubocop:disable Metrics/AbcSize
program :version, Vmfloaty::VERSION
program :description, 'A CLI helper tool for Puppet Labs VM poolers to help you stay afloat'

View file

@ -82,10 +82,10 @@ class ABS
jobs_to_delete = []
retStatus = {}
ret_status = {}
hosts.each do |host|
retStatus[host] = {
'ok' => false
ret_status[host] = {
'ok' => false,
}
end
@ -95,8 +95,8 @@ class ABS
req_hash['allocated_resources'].each do |vm_name, _i|
if hosts.include? vm_name['hostname']
if all_job_resources_accounted_for(req_hash['allocated_resources'], hosts)
retStatus[vm_name['hostname']] = {
'ok' => true
ret_status[vm_name['hostname']] = {
'ok' => true,
}
jobs_to_delete.push(req_hash)
else
@ -118,7 +118,7 @@ class ABS
return_result = conn.post 'return', req_obj.to_json
req_obj['hosts'].each do |host|
response_body[host["hostname"]] = { 'ok' => true } if return_result.body == "OK"
response_body[host['hostname']] = { 'ok' => true } if return_result.body == 'OK'
end
end
@ -187,15 +187,15 @@ class ABS
},
}
if options["priority"]
if options["priority"] == "high"
req_obj[:priority] = 1
elsif options["priority"] == "medium"
req_obj[:priority] = 2
elsif options["priority"] == "low"
req_obj[:priority] = 3
if options['priority']
req_obj[:priority] = if options['priority'] == 'high'
1
elsif options['priority'] == 'medium'
2
elsif options['priority'] == 'low'
3
else
req_obj[:priority] = options["priority"].to_i
options['priority'].to_i
end
end
@ -214,12 +214,11 @@ class ABS
queue_place, res_body = check_queue(conn, saved_job_id, req_obj)
return translated(res_body) if res_body
sleep_seconds = 10 if i >= 10
sleep_seconds = i if i < 10
puts "Waiting #{sleep_seconds} seconds to check if ABS request has been filled. Queue Position: #{queue_place}... (x#{i})"
sleepSeconds = 10 if i >= 10
sleepSeconds = i if i < 10
puts "Waiting #{sleepSeconds} seconds to check if ABS request has been filled. Queue Position: #{queue_place}... (x#{i})"
sleep(sleepSeconds)
sleep(sleep_seconds)
end
nil
end
@ -264,7 +263,7 @@ class ABS
res = conn.get 'status'
return res.body == "OK"
res.body == 'OK'
end
def self.summary(verbose, url)

View file

@ -156,8 +156,8 @@ class Utils
end
end
when 'ABS'
puts "ABS Not OK".red unless status_response
puts "ABS is OK".green if status_response
puts 'ABS Not OK'.red unless status_response
puts 'ABS is OK'.green if status_response
else
raise "Invalid service type #{service.type}"
end