| 2244 | } |
| 2245 | |
| 2246 | Reference<IBackupContainer> openBackupContainer(const char* name, |
| 2247 | const std::string& destinationContainer, |
| 2248 | const Optional<std::string>& proxy, |
| 2249 | const Optional<std::string>& encryptionKeyFile) { |
| 2250 | // Error, if no dest container was specified |
| 2251 | if (destinationContainer.empty()) { |
| 2252 | fprintf(stderr, "ERROR: No backup destination was specified.\n"); |
| 2253 | printHelpTeaser(name); |
| 2254 | throw backup_error(); |
| 2255 | } |
| 2256 | |
| 2257 | Reference<IBackupContainer> c; |
| 2258 | try { |
| 2259 | c = IBackupContainer::openContainer(destinationContainer, proxy, encryptionKeyFile); |
| 2260 | } catch (Error& e) { |
| 2261 | std::string msg = format("ERROR: '%s' on URL '%s'", e.what(), destinationContainer.c_str()); |
| 2262 | if (e.code() == error_code_backup_invalid_url && !IBackupContainer::lastOpenError.empty()) { |
| 2263 | msg += format(": %s", IBackupContainer::lastOpenError.c_str()); |
| 2264 | } |
| 2265 | fprintf(stderr, "%s\n", msg.c_str()); |
| 2266 | printHelpTeaser(name); |
| 2267 | throw; |
| 2268 | } |
| 2269 | |
| 2270 | return c; |
| 2271 | } |
| 2272 | |
| 2273 | // Submit the restore request to the database if "performRestore" is true. Otherwise, |
| 2274 | // check if the restore can be performed. |
no test coverage detected