Skip to content

Commit 3ab53f0

Browse files
committed
Debugging detached? method
1 parent ca23922 commit 3ab53f0

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/bosh-director/lib/bosh/director/deployment_plan/instance_plan.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,21 @@ def packages_changed?
398398
end
399399

400400
def already_detached?
401-
new? ? false : @existing_instance.detached?
401+
return false if new?
402+
403+
msg = "already_detached? checking: existing_instance.class=#{existing_instance.class}, value=#{existing_instance.inspect}"
404+
@logger.debug(msg)
405+
$stderr.puts "[DEBUG] #{msg}"
406+
407+
unless existing_instance.respond_to?(:detached?)
408+
error_msg = "BUG: existing_instance does not respond to detached?! Class: #{existing_instance.class}, Value: #{existing_instance.inspect}"
409+
@logger.error(error_msg)
410+
$stderr.puts "[ERROR] #{error_msg}"
411+
# Fallback to string comparison for safety
412+
return existing_instance.is_a?(String) ? existing_instance == 'detached' : existing_instance.state == 'detached'
413+
end
414+
415+
existing_instance.detached?
402416
end
403417

404418
def needs_disk?

0 commit comments

Comments
 (0)