Backup/Restore API?

3 messages Options
Embed this post
Permalink
Gene Gotimer () Backup/Restore API?
Reply Threaded More More options
Print post
Permalink
Is there a way to programmatically backup/restore a Sonar configuration?

I'm trying to write a shell script to do a backup, and handling the database is obviously easy. I could backup the conf directory itself, but I thought it would be cleaner to use the interface that is already there. But as far as I could tell, I'd have to use curl or something similar to simulate a user logging in and clicking the backup button.

Before I do that I want to make sure there isn't an easier way.

Olivier Gaudin () Re: Backup/Restore API?
Reply Threaded More More options
Print post
Permalink
Hello Gene,

No there isn't an easier way. You need to use the url to do so. Here is an example of integration test that does it :

<httppost url="http://localhost:9000/sessions/login" logLevel="none">
     <post name="login" value="admin"/>
     <post name="password" value="admin"/>
   </httppost>
   <echo message="Logged in."/>

   <httpmpost url="http://localhost:9000/backup/import" logLevel="none">
     <postFile name="file" file="${restore.backup}"/>
   </httpmpost>

Olivier


On Tue, Oct 6, 2009 at 4:28 AM, Gene Gotimer <[hidden email]> wrote:
Is there a way to programmatically backup/restore a Sonar configuration?

I'm trying to write a shell script to do a backup, and handling the database is obviously easy. I could backup the conf directory itself, but I thought it would be cleaner to use the interface that is already there. But as far as I could tell, I'd have to use curl or something similar to simulate a user logging in and clicking the backup button.

Before I do that I want to make sure there isn't an easier way.


Gene Gotimer-2 () Re: Backup/Restore API?
Reply Threaded More More options
Print post
Permalink
That seems easy enough. Thanks.

I just wanted to make sure I wasn't going about it in a roundabout way.

On Tue, Oct 6, 2009 at 5:21 AM, Olivier Gaudin <[hidden email]> wrote:
Hello Gene,

No there isn't an easier way. You need to use the url to do so. Here is an example of integration test that does it :

<httppost url="http://localhost:9000/sessions/login" logLevel="none">
     <post name="login" value="admin"/>
     <post name="password" value="admin"/>
   </httppost>
   <echo message="Logged in."/>

   <httpmpost url="http://localhost:9000/backup/import" logLevel="none">
     <postFile name="file" file="${restore.backup}"/>
   </httpmpost>

Olivier



On Tue, Oct 6, 2009 at 4:28 AM, Gene Gotimer <[hidden email]> wrote:
Is there a way to programmatically backup/restore a Sonar configuration?

I'm trying to write a shell script to do a backup, and handling the database is obviously easy. I could backup the conf directory itself, but I thought it would be cleaner to use the interface that is already there. But as far as I could tell, I'd have to use curl or something similar to simulate a user logging in and clicking the backup button.

Before I do that I want to make sure there isn't an easier way.