t.add :container_image
t.add :cwd
t.add :environment
+ t.add :exit_code
t.add :finished_at
t.add :log
t.add :mounts
when Complete
if self.state_changed?
- permitted.push :state, :finished_at, :output, :log
+ permitted.push :state, :finished_at, :output, :log, :exit_code
else
errors.add :state, "cannot update record"
end
# that are associated with this container.
if self.state_changed? and [Complete, Cancelled].include? self.state
act_as_system_user do
- # Try to close container requests associated with this container
+ # Notify container requests associated with this container
ContainerRequest.where(container_uuid: uuid,
:state => ContainerRequest::Committed).each do |cr|
- cr.state = ContainerRequest::Final
- cr.save
+ cr.container_completed!
end
# Try to cancel any outstanding container requests made by this container.