Make user confirm that they use an external disk

This commit is contained in:
Girish Ramakrishnan
2018-06-07 11:19:43 -07:00
parent 04dd8914cd
commit e3897c4c34
3 changed files with 24 additions and 9 deletions

View File

@@ -147,6 +147,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
retentionSecs: 7 * 24 * 60 * 60,
acceptSelfSignedCerts: false,
useHardlinks: true,
externalDisk: false,
format: 'tgz',
clearForm: function () {
@@ -163,6 +164,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.format = 'tgz';
$scope.configureBackup.acceptSelfSignedCerts = false;
$scope.configureBackup.useHardlinks = true;
$scope.configureBackup.externalDisk = false;
},
show: function () {
@@ -190,6 +192,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.configureBackup.format = $scope.backupConfig.format;
$scope.configureBackup.acceptSelfSignedCerts = !!$scope.backupConfig.acceptSelfSignedCerts;
$scope.configureBackup.useHardlinks = !$scope.backupConfig.noHardlinks;
$scope.configureBackup.externalDisk = !!$scope.backupConfig.externalDisk;
$('#configureBackupModal').modal('show');
},
@@ -249,6 +252,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
} else if (backupConfig.provider === 'filesystem') {
backupConfig.backupFolder = $scope.configureBackup.backupFolder;
backupConfig.noHardlinks = !$scope.configureBackup.useHardlinks;
backupConfig.externalDisk = $scope.configureBackup.externalDisk;
}
Client.setBackupConfig(backupConfig, function (error) {
@@ -329,12 +333,17 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
$scope.backupConfig = backupConfig;
// Check if a proper storage backend is configured. TODO: this check fails if /var/backups is actually external
if (backupConfig.provider === 'filesystem' && backupConfig.backupFolder === '/var/backups') {
var actionScope = $scope.$new(true);
actionScope.action = '/#/settings';
Client.clearNotifications();
Client.notify('Backup Configuration', 'Please setup an external backup storage to avoid data loss', false, 'info', actionScope);
// Check if a proper storage backend is configured. TODO: this check fails if /var/backups is actually external
if (backupConfig.provider === 'filesystem' && !backupConfig.externalDisk) {
var actionScope = $scope.$new(true);
actionScope.action = '/#/backups';
Client.notify('Backup Configuration',
'Cloudron backups are currently on the same disk as the Cloudron server instance. This is dangerous and can lead to complete data loss if the disk fails.' +
'Please setup an external backup storage (or use server snapshots) and confirm this in backup configuration',
true /* persistent */, 'error', actionScope);
}
});
}