summaryrefslogtreecommitdiff
path: root/lib/backupstore/BackupAccountControl.cpp
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-29 08:46:35 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-29 08:46:35 +0000
commitd7c6a65bc1a534dfb7e8264064bdf04c5862464d (patch)
tree3218ad03ded7d7db7c29c72f07a9ef320a8dc93c /lib/backupstore/BackupAccountControl.cpp
parentace361b403a3308d3c94f05c3b099e3feabeb0fd (diff)
Fix check for existing BackupStoreInfo file on S3 stores
Diffstat (limited to 'lib/backupstore/BackupAccountControl.cpp')
-rw-r--r--lib/backupstore/BackupAccountControl.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/backupstore/BackupAccountControl.cpp b/lib/backupstore/BackupAccountControl.cpp
index a76eec21..331ef841 100644
--- a/lib/backupstore/BackupAccountControl.cpp
+++ b/lib/backupstore/BackupAccountControl.cpp
@@ -13,6 +13,7 @@
#include <iostream>
#include "autogen_CommonException.h"
+#include "autogen_BackupStoreException.h"
#include "BackupAccountControl.h"
#include "BackupStoreConstants.h"
#include "BackupStoreDirectory.h"
@@ -188,10 +189,17 @@ int S3BackupAccountControl::CreateAccount(const std::string& name, int32_t SoftL
std::string info_url = GetFullURL(S3_INFO_FILE_NAME);
HTTPResponse response = GetObject(S3_INFO_FILE_NAME);
+ if(response.GetResponseCode() == HTTPResponse::Code_OK)
+ {
+ THROW_EXCEPTION_MESSAGE(BackupStoreException, AccountAlreadyExists,
+ "The BackupStoreInfo file already exists at this URL: " <<
+ info_url);
+ }
+
if(response.GetResponseCode() != HTTPResponse::Code_NotFound)
{
- mapS3Client->CheckResponse(response, std::string("The BackupStoreInfo file already "
- "exists at this URL: ") + info_url);
+ mapS3Client->CheckResponse(response, std::string("Failed to check for an "
+ "existing BackupStoreInfo file at this URL: ") + info_url);
}
BackupStoreInfo info(0, // fake AccountID for S3 stores