# Finalize the container request after the container has
# finished/cancelled.
def finalize!
- update_collections(container: Container.find_by_uuid(container_uuid))
+ container = Container.find_by_uuid(container_uuid)
+ update_collections(container: container)
+
+ log_col = Collection.where(portable_data_hash: container.log).first
+ if log_col
+ # Need to save collection
+ completed_coll = Collection.new(
+ owner_uuid: self.owner_uuid,
+ name: "Container log for container #{container_uuid}",
+ properties: {
+ 'type' => 'log',
+ 'container_request' => self.uuid,
+ 'container_uuid' => container_uuid,
+ },
+ portable_data_hash: log_col.portable_data_hash,
+ manifest_text: log_col.manifest_text)
+ completed_coll.save_with_unique_name!
+ end
+
update_attributes!(state: Final)
end
end
if out_type == "log"
+ # Copy the log into a merged collection
src = Arv::Collection.new(manifest)
dst = Arv::Collection.new(coll.manifest_text)
dst.cp_r("./", ".", src)
def run_container(cr)
act_as_system_user do
+ logc = Collection.new(owner_uuid: system_user_uuid,
+ manifest_text: ". ef772b2f28e2c8ca84de45466ed19ee9+7815 0:0:arv-mount.txt\n")
+ logc.save!
+
c = Container.find_by_uuid(cr.container_uuid)
c.update_attributes!(state: Container::Locked)
c.update_attributes!(state: Container::Running)
c.update_attributes!(state: Container::Complete,
exit_code: 0,
- output: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45')
+ output: '1f4b0bc7583c2a7f9102c395f4ffc5e3+45',
+ log: logc.portable_data_hash)
+ logc.destroy
c
end
end