Merge lp:~francois-ctrlaltdel/deja-dup/deja-dup into lp:deja-dup/32

Proposed by Francois Deppierraz
Status: Needs review
Proposed branch: lp:~francois-ctrlaltdel/deja-dup/deja-dup
Merge into: lp:deja-dup/32
Diff against target: 112 lines (+31/-9)
4 files modified
data/org.gnome.DejaDup.gschema.xml.in (+5/-0)
debian/changelog (+1/-1)
deja-dup/widgets/ConfigLocationS3.vala (+3/-0)
libdeja/BackendS3.vala (+22/-8)
To merge this branch: bzr merge lp:~francois-ctrlaltdel/deja-dup/deja-dup
Reviewer Review Type Date Requested Status
KspR (community) Approve
Michael Terry Pending
Déjà Dup Developers Pending
Review via email: mp+224208@code.launchpad.net
To post a comment you must log in.
Revision history for this message
KspR (laurent-ksperis) wrote :

Great !
Patch tested on deja-dup current version (32.0-0ubuntu1) in utopic and Ceph 0.87
Working fine.
(Note : the bucket must exist and ssl enabled on radosgw)

review: Approve

Unmerged revisions

1539. By Francois Deppierraz

Add support for alternative S3 endpoint

This patch allows the user to specify an alternative S3 endpoint during
configuration. A new text area has been added to the S3 configuration
screen with a default value of 's3.amazonaws.com'.

With this patch deja-dup can easily be used with a private ceph cluster
running radosgw or openstack swift as a well as a bunch of public cloud
storage offerings with an S3 compatible API.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/org.gnome.DejaDup.gschema.xml.in'
2--- data/org.gnome.DejaDup.gschema.xml.in 2014-04-29 02:38:47 +0000
3+++ data/org.gnome.DejaDup.gschema.xml.in 2014-06-23 19:56:22 +0000
4@@ -95,6 +95,11 @@
5 <_summary>The Amazon S3 folder</_summary>
6 <_description>An optional folder name to store files in. This folder will be created in the chosen bucket.</_description>
7 </key>
8+ <key name="server" type="s">
9+ <default>'s3.amazonaws.com'</default>
10+ <_summary>The Amazon S3 server hostname to use</_summary>
11+ <_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>
12+ </key>
13 </schema>
14 <schema id="org.gnome.DejaDup.GDrive" path="/org/gnome/deja-dup/gdrive/">
15 <key name="email" type="s">
16
17=== modified file 'debian/changelog'
18--- debian/changelog 2013-10-11 18:53:52 +0000
19+++ debian/changelog 2014-06-23 19:56:22 +0000
20@@ -1,4 +1,4 @@
21-deja-dup (0) UNRELEASED; urgency=low
22+deja-dup (31) UNRELEASED; urgency=low
23
24 * Testing (just a dummy changelog, will be replaced by daily build scripts)
25
26
27=== modified file 'deja-dup/widgets/ConfigLocationS3.vala'
28--- deja-dup/widgets/ConfigLocationS3.vala 2011-08-13 04:16:21 +0000
29+++ deja-dup/widgets/ConfigLocationS3.vala 2014-06-23 19:56:22 +0000
30@@ -32,6 +32,9 @@
31 new ConfigEntry(DejaDup.S3_ID_KEY, DejaDup.S3_ROOT));
32 add_widget(_("_Folder"),
33 new ConfigFolder(DejaDup.S3_FOLDER_KEY, DejaDup.S3_ROOT));
34+ add_widget(_("_Server hostname"),
35+ new ConfigFolder(DejaDup.S3_SERVER_KEY, DejaDup.S3_ROOT));
36+
37 }
38 }
39
40
41=== modified file 'libdeja/BackendS3.vala'
42--- libdeja/BackendS3.vala 2012-10-25 16:00:23 +0000
43+++ libdeja/BackendS3.vala 2014-06-23 19:56:22 +0000
44@@ -25,8 +25,9 @@
45 public const string S3_ID_KEY = "id";
46 public const string S3_BUCKET_KEY = "bucket";
47 public const string S3_FOLDER_KEY = "folder";
48+public const string S3_SERVER_KEY = "server";
49
50-const string S3_SERVER = "s3.amazonaws.com";
51+const string DEFAULT_S3_SERVER = "s3.amazonaws.com";
52
53 public class BackendS3 : Backend
54 {
55@@ -57,9 +58,22 @@
56
57 public override async bool is_ready(out string when) {
58 when = _("Backup will begin when a network connection becomes available.");
59- return yield Network.get().can_reach ("http://%s/".printf(S3_SERVER));
60- }
61-
62+ return yield Network.get().can_reach ("http://%s/".printf(get_server()));
63+ }
64+
65+ public string get_server()
66+ {
67+ var settings = get_settings(S3_ROOT);
68+
69+ var server = settings.get_string(S3_SERVER_KEY);
70+ if (server == null) {
71+ server = DEFAULT_S3_SERVER;
72+ settings.set_string(S3_SERVER_KEY, server);
73+ }
74+
75+ return server;
76+ }
77+
78 public override string get_location(ref bool as_root)
79 {
80 var settings = get_settings(S3_ROOT);
81@@ -74,7 +88,7 @@
82 }
83
84 var folder = get_folder_key(settings, S3_FOLDER_KEY);
85- return "s3+http://%s/%s".printf(bucket, folder);
86+ return "s3://%s/%s/%s".printf(get_server(), bucket, folder);
87 }
88
89 public bool bump_bucket() {
90@@ -146,7 +160,7 @@
91 secret_key = yield Secret.password_lookup(Secret.SCHEMA_COMPAT_NETWORK,
92 null,
93 "user", id,
94- "server", S3_SERVER,
95+ "server", get_server(),
96 "protocol", "https");
97 if (secret_key != null) {
98 got_secret_key();
99@@ -180,11 +194,11 @@
100 try {
101 yield Secret.password_store(Secret.SCHEMA_COMPAT_NETWORK,
102 where,
103- "%s@%s".printf(id, S3_SERVER),
104+ "%s@%s".printf(id, get_server()),
105 secret_key,
106 null,
107 "user", id,
108- "server", S3_SERVER,
109+ "server", get_server(),
110 "protocol", "https");
111 }
112 catch (Error e) {

Subscribers

People subscribed via source and target branches