← Back to team overview

deja-dup-team team mailing list archive

[Merge] lp:~francois-ctrlaltdel/deja-dup/deja-dup into lp:deja-dup

 

Francois Deppierraz has proposed merging lp:~francois-ctrlaltdel/deja-dup/deja-dup into lp:deja-dup.

Requested reviews:
  Déjà Dup Developers (deja-dup-hackers)
Related bugs:
  Bug #821413 in Déjà Dup: "Add Support for alternative s3 servicepoints"
  https://bugs.launchpad.net/deja-dup/+bug/821413

For more details, see:
https://code.launchpad.net/~francois-ctrlaltdel/deja-dup/deja-dup/+merge/224208
-- 
https://code.launchpad.net/~francois-ctrlaltdel/deja-dup/deja-dup/+merge/224208
Your team Déjà Dup Developers is requested to review the proposed merge of lp:~francois-ctrlaltdel/deja-dup/deja-dup into lp:deja-dup.
=== modified file 'data/org.gnome.DejaDup.gschema.xml.in'
--- data/org.gnome.DejaDup.gschema.xml.in	2014-04-29 02:38:47 +0000
+++ data/org.gnome.DejaDup.gschema.xml.in	2014-06-23 19:56:22 +0000
@@ -95,6 +95,11 @@
       <_summary>The Amazon S3 folder</_summary>
       <_description>An optional folder name to store files in.  This folder will be created in the chosen bucket.</_description>
     </key>
+    <key name="server" type="s">
+      <default>'s3.amazonaws.com'</default>
+      <_summary>The Amazon S3 server hostname to use</_summary>
+      <_description>This parameter allows you to select a non-standard s3 endpoint.  This comes handy for connecting to you own S3-compatible server (based on Ceph or Openstack Swift for example).</_description>
+    </key>
   </schema>
   <schema id="org.gnome.DejaDup.GDrive" path="/org/gnome/deja-dup/gdrive/">
     <key name="email" type="s">

=== modified file 'debian/changelog'
--- debian/changelog	2013-10-11 18:53:52 +0000
+++ debian/changelog	2014-06-23 19:56:22 +0000
@@ -1,4 +1,4 @@
-deja-dup (0) UNRELEASED; urgency=low
+deja-dup (31) UNRELEASED; urgency=low
 
   * Testing (just a dummy changelog, will be replaced by daily build scripts)
 

=== modified file 'deja-dup/widgets/ConfigLocationS3.vala'
--- deja-dup/widgets/ConfigLocationS3.vala	2011-08-13 04:16:21 +0000
+++ deja-dup/widgets/ConfigLocationS3.vala	2014-06-23 19:56:22 +0000
@@ -32,6 +32,9 @@
                new ConfigEntry(DejaDup.S3_ID_KEY, DejaDup.S3_ROOT));
     add_widget(_("_Folder"),
                new ConfigFolder(DejaDup.S3_FOLDER_KEY, DejaDup.S3_ROOT));
+    add_widget(_("_Server hostname"),
+               new ConfigFolder(DejaDup.S3_SERVER_KEY, DejaDup.S3_ROOT));
+
   }
 }
 

=== modified file 'libdeja/BackendS3.vala'
--- libdeja/BackendS3.vala	2012-10-25 16:00:23 +0000
+++ libdeja/BackendS3.vala	2014-06-23 19:56:22 +0000
@@ -25,8 +25,9 @@
 public const string S3_ID_KEY = "id";
 public const string S3_BUCKET_KEY = "bucket";
 public const string S3_FOLDER_KEY = "folder";
+public const string S3_SERVER_KEY = "server";
 
-const string S3_SERVER = "s3.amazonaws.com";
+const string DEFAULT_S3_SERVER = "s3.amazonaws.com";
 
 public class BackendS3 : Backend
 {
@@ -57,9 +58,22 @@
 
   public override async bool is_ready(out string when) {
     when = _("Backup will begin when a network connection becomes available.");
-    return yield Network.get().can_reach ("http://%s/".printf(S3_SERVER));
-  }
-
+    return yield Network.get().can_reach ("http://%s/".printf(get_server()));
+  }
+
+  public string get_server()
+  {
+    var settings = get_settings(S3_ROOT);
+    
+    var server = settings.get_string(S3_SERVER_KEY);
+    if (server == null) {
+      server = DEFAULT_S3_SERVER;
+      settings.set_string(S3_SERVER_KEY, server);
+    }
+
+    return server;
+  }
+ 
   public override string get_location(ref bool as_root)
   {
     var settings = get_settings(S3_ROOT);
@@ -74,7 +88,7 @@
     }
     
     var folder = get_folder_key(settings, S3_FOLDER_KEY);
-    return "s3+http://%s/%s".printf(bucket, folder);
+    return "s3://%s/%s/%s".printf(get_server(), bucket, folder);
   }
   
   public bool bump_bucket() {
@@ -146,7 +160,7 @@
         secret_key = yield Secret.password_lookup(Secret.SCHEMA_COMPAT_NETWORK,
                                                   null, 
                                                   "user", id,
-                                                  "server", S3_SERVER,
+                                                  "server", get_server(),
                                                   "protocol", "https");
         if (secret_key != null) {
           got_secret_key();
@@ -180,11 +194,11 @@
       try {
         yield Secret.password_store(Secret.SCHEMA_COMPAT_NETWORK,
                                     where,
-                                    "%s@%s".printf(id, S3_SERVER),
+                                    "%s@%s".printf(id, get_server()),
                                     secret_key,
                                     null,
                                     "user", id,
-                                    "server", S3_SERVER,
+                                    "server", get_server(),
                                     "protocol", "https");
       }
       catch (Error e) {


Follow ups