Tmsh: problem moving two files to the Sandbox (from an iApp)
Hello all, While I was developing an iApp, I needed to move two different files from a linux folder (/var/tmp) to the APM's sandbox. This can be done using the TMSH 'modify' command, here an example: tmsh::modify /apm resource sandbox /Common/hosted-content files { add { file1.html { folder /test local-path /var/tmp/file1.html}}} This moves the file 'file1.html' from /var/tmp to the sandbox, and works propperly. The problem occurs when I try to use this command for two different files (regardless it is done in a single command or using two). Running these two commands separately using the command line, it works, but when using a single command for it on the command line or in the iApp case, I get the following error:
01070734:3: Configuration error: DB validation exception, unique constraint violation on table (sandbox_file) object ID (/Common/hosted-content file1.html ). A duplicate value was received for a non-primary key unique index field. DB exception text (Can't save/checkpoint DB object, class:sandbox_file status:13)
Does anybody knows about this issue? I think is related to the SOL14037 one, and this seems to be a previous bug already corrected. By the way, is there any other way for moving two (or more) different files to the sandbox using an iApp for it? Thanks in advance for your help
I see the issue now. I filed it as a product bug. Here is a workaround that calls a script from within the iapp and uses a time delay to solve the timestamp issue.
set fh [open my_script w] puts $fh " tmsh modify apm resource sandbox hosted-content { files add {\ foo1.xml { folder /test local-path /var/tmp/bar1.xml }}} sleep 1 tmsh modify apm resource sandbox hosted-content { files add {\ foo2.xml { folder /test local-path /var/tmp/bar2.xml }}} " close $fh exec bash my_script