Forum Discussion

estradjs_130284's avatar
estradjs_130284
Icon for Nimbostratus rankNimbostratus
Aug 29, 2013
Solved

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
    

4 Replies

  • Fred_Slater_856's avatar
    Fred_Slater_856
    Historic F5 Account

    What TMOS version are you running? I had no problem adding 3 files to the sandbox on v11.4.

     

    root@(fs-ve02)(/Common)(tmos) modify apm resource sandbox hosted-content files add { file1.html { folder /test local-path /var/tmp/scriptd.out }} root@(fs-ve02)(/Common)(tmos) modify apm resource sandbox hosted-content files add { file2.html { folder /test local-path /var/tmp/lind.out }} root@(fs-ve02)(/Common)(tmos) modify apm resource sandbox hosted-content files add { file3.html { folder /test local-path /var/tmp/logd.out }}

     

  • Hello and thanks a lot for the answer. I am currently using v11.4 too. Using the command line, I can move the files with different calls to the command, but it can't be possible in a single call like:

     

    root@(bigip)(cfg-sync Standalone)(ModuleNotLicensed:Active)(/Common)(tmos) modify /apm resource sandbox /Common/hosted-content files add { file1.xml { folder /test/globalconfig local-path /var/tmp/file1.xml } } files add { file1.html { folder /test local-path /var/tmp/file1.html } }

     

    The same error occurs (regardless running one or two calls to the command) from an iApp. That is why I have the problem, I need to move the two files using an iApp, and then I always get the error (the same as if you try to move the to files using a single call to the command from the tmsh shell(:

     

    01070734:3: Configuration error: DB validation exception, unique constraint violation on table (sandbox_file) object ID (/Common/hosted-content jwtcon.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

     

    I suspect the same "numerical ID" generated for every file stored in the sandbox is in this case the same (if I am not wrong, this number is generated using a timestamp from 'now'), so both the iApp with two commands or the tmsh shell single command have the same database constraint violation error because of this. Any ideas?

     

  • Fred_Slater_856's avatar
    Fred_Slater_856
    Historic F5 Account

    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
    
  • Hello again Fred, You were completely right! I have tested your solution and it works perfectly well. I had tried using a sleep or after command, but it had no effect as it was not executed as a script apart form the iApp (it was only delaying the iApp final execution). Thank you very much for your help and the suggested workaround!