Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions scripts/migrate-to-diego.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,26 @@ def apps_running_on_dea(batch_number,reverse)


def migrate_app(app_guid, reverse)
puts "migrating #{app_guid}"
initial_state = app_state(app_guid)
cf_output= `cf curl /v2/apps/#{app_guid} -X PUT -d '{"diego":#{(!reverse).to_s}}'`
output = JSON.parse(cf_output)
unless output["error_code"].nil?
puts "ERROR: Failed to set diego to true for app #{app_guid}\n#{cf_output}"
return false
end
puts "completed #{app_guid}"
final_state = app_state(app_guid)
changed = (initial_state == final_state) ? '' : " -- CHANGED --"
puts "completed #{app_guid}: initial_state: #{initial_state}, final_state:#{final_state} #{changed}"
true
end

def app_state(app_guid)
raw = `cf curl /v2/apps/#{app_guid}`
parsed = JSON.parse(raw)
parsed['entity']['state']
end


def migrate_in_parallel(queue, max_in_flight, reverse)
thread_pool = []
max_in_flight.times do |i|
Expand Down