]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/amazon_s3.pm
(no commit message)
[ikiwiki.git] / IkiWiki / Plugin / amazon_s3.pm
index 93c10b629320bf78b5fc1d7e28df24598244f2a4..cfd8cd3477f81dd0758564994f35979419e330a0 100644 (file)
@@ -4,7 +4,7 @@ package IkiWiki::Plugin::amazon_s3;
 use warnings;
 no warnings 'redefine';
 use strict;
-use IkiWiki 2.00;
+use IkiWiki 3.00;
 use IkiWiki::Render;
 use Net::Amazon::S3;
 
@@ -133,7 +133,11 @@ sub getbucket {
        }
 
        if (! $bucket) {
-               error(gettext("Failed to create bucket in S3: ").
+               # Try to use existing bucket.
+               $bucket=$s3->bucket($config{amazon_s3_bucket});
+       }
+       if (! $bucket) {
+               error(gettext("Failed to create S3 bucket: ").
                        $s3->err.": ".$s3->errstr."\n");
        }
 
@@ -178,7 +182,7 @@ sub writefile ($$$;$$) {
 
        # First, write the file to disk.
        my $ret=$IkiWiki::Plugin::amazon_s3::subs{'IkiWiki::writefile'}->($file, $destdir, $content, $binary, $writer);
-               
+
        my @keys=IkiWiki::Plugin::amazon_s3::file2keys("$destdir/$file");
 
        # Store the data in S3.