@ps-aux/nodebup 0.12.0 → 0.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,22 +23,22 @@ let DirBackupController = (_dec = (0, _inversify.injectable)(), _dec2 = Reflect.
23
23
 
24
24
  _defineProperty(this, "log", (0, _logging.classObjLog)(this));
25
25
 
26
- _defineProperty(this, "backup", inp => {
26
+ _defineProperty(this, "backup", async inp => {
27
27
  const storage = this.storageProvider.provide();
28
28
 
29
29
  const path = _Path.AbsPath.from(inp.path);
30
30
 
31
31
  this.log.info(`Backing up from ${path} to '${storage}'`);
32
- storage.store(path);
32
+ await storage.store(path);
33
33
  });
34
34
 
35
- _defineProperty(this, "restore", inp => {
35
+ _defineProperty(this, "restore", async inp => {
36
36
  const storage = this.storageProvider.provide();
37
37
 
38
38
  const path = _Path.AbsPath.from(inp.path);
39
39
 
40
40
  this.log.info(`Restoring from '${storage}' to ${path}`);
41
- storage.restore(path);
41
+ await storage.restore(path);
42
42
  });
43
43
  }
44
44
 
@@ -102,7 +102,7 @@ let PgBackupController = (_dec = (0, _inversify.injectable)(), _dec2 = Reflect.m
102
102
  stderr: o => this.log.info('gzip: ' + o)
103
103
  });
104
104
  this.log.info('Uploading');
105
- storage.store(dir);
105
+ await storage.store(dir);
106
106
  });
107
107
  });
108
108
 
@@ -131,7 +131,7 @@ let PgBackupController = (_dec = (0, _inversify.injectable)(), _dec2 = Reflect.m
131
131
  await this.fs.inTmpDir('pg-restore', async dirStr => {
132
132
  const dir = _Path.AbsPath.from(dirStr);
133
133
 
134
- storage.restore(dir); // TODO check if the dir contains the with the expected name
134
+ await storage.restore(dir); // TODO check if the dir contains the with the expected name
135
135
  // TODO add e2e test for docker
136
136
 
137
137
  this.log.info('Backup dir restored');
package/lib/cli/app.js CHANGED
@@ -45,6 +45,7 @@ const singleStorageOptions = [storageNameOpt, {
45
45
  }];
46
46
  const backupTagOption = {
47
47
  name: 'backup-tag',
48
+ fromConfig: 'backup.tag',
48
49
  convertCase: true
49
50
  };
50
51
  const backupOptions = [backupTagOption];
@@ -164,6 +165,7 @@ const pg = (0, _nclif.cmdGroup)({
164
165
  options: [...backupOptions, {
165
166
  name: 'backup-name',
166
167
  convertCase: true,
168
+ fromConfig: 'backup.name',
167
169
  required: true
168
170
  }],
169
171
  run: (inp, c) => c.get(_PgBackupController.PgBackupController).backup(inp)
@@ -12,15 +12,15 @@ class BackupStorage {
12
12
  this.backend = backend;
13
13
  this.props = props;
14
14
 
15
- _defineProperty(this, "store", from => {
15
+ _defineProperty(this, "store", async from => {
16
16
  const {
17
17
  tag
18
18
  } = this.props;
19
19
  const tags = tag ? [tag] : undefined;
20
- this.backend.backup(from, tags);
20
+ await this.backend.backup(from, tags);
21
21
  });
22
22
 
23
- _defineProperty(this, "restore", to => {
23
+ _defineProperty(this, "restore", async to => {
24
24
  const {
25
25
  snapshotId
26
26
  } = this.props;
@@ -17,7 +17,7 @@ class RcloneBackupBackend {
17
17
 
18
18
  _defineProperty(this, "log", (0, _logging.classObjLog)(this));
19
19
 
20
- _defineProperty(this, "backup", (from, tags) => {
20
+ _defineProperty(this, "backup", async (from, tags) => {
21
21
  if (tags) throw new _nclif.InvalidInputError(`Rclone does not support tags`);
22
22
  this.log.info('Performing backup', {
23
23
  from
@@ -25,14 +25,14 @@ class RcloneBackupBackend {
25
25
  this.rclone.backup(from);
26
26
  });
27
27
 
28
- _defineProperty(this, "restoreLatest", to => {
28
+ _defineProperty(this, "restoreLatest", async to => {
29
29
  this.log.info('Restoring', {
30
30
  to
31
31
  });
32
32
  this.rclone.restore(to);
33
33
  });
34
34
 
35
- _defineProperty(this, "restoreSnapshot", (to, snapshotId) => {
35
+ _defineProperty(this, "restoreSnapshot", async (to, snapshotId) => {
36
36
  throw new _nclif.InvalidInputError(`Rclone does not support snaphosts`);
37
37
  });
38
38
  }
@@ -17,18 +17,18 @@ class ResticBackupBackend {
17
17
 
18
18
  _defineProperty(this, "log", (0, _logging.classObjLog)(this));
19
19
 
20
- _defineProperty(this, "backup", (from, tags = []) => {
20
+ _defineProperty(this, "backup", async (from, tags = []) => {
21
21
  this.log.info(`Performing backup from=${from}, tags=${tags}`);
22
- this.restic.backup(from, _Path.RelativePath.from('.'), tags);
22
+ await this.restic.backup(from, _Path.RelativePath.from('.'), tags);
23
23
  this.restic.forget();
24
24
  });
25
25
 
26
- _defineProperty(this, "restoreLatest", to => {
26
+ _defineProperty(this, "restoreLatest", async to => {
27
27
  this.log.info(`Restoring latest snapshot to=${to}`);
28
28
  this.restic.restore(to);
29
29
  });
30
30
 
31
- _defineProperty(this, "restoreSnapshot", (to, snapshotId) => {
31
+ _defineProperty(this, "restoreSnapshot", async (to, snapshotId) => {
32
32
  this.log.info(`Restoring snapshot '${snapshotId}'`, {
33
33
  to
34
34
  });
@@ -46,15 +46,18 @@ class ResticClient {
46
46
  });
47
47
  });
48
48
 
49
- _defineProperty(this, "backup", (cwd, from, tags = []) => {
49
+ _defineProperty(this, "backup", async (cwd, from, tags = []) => {
50
50
  this.log.debug('Running backup for repo=%s', this.url);
51
51
  let cmd = `restic backup ${from.str()}`;
52
52
  tags.forEach(t => {
53
53
  cmd += ` --tag=${t}`;
54
54
  });
55
- this.shell.exec(cmd, {
55
+ await this.shell.asyncExec(cmd, {
56
56
  cwd: cwd.str(),
57
57
  env: this.env()
58
+ }, {
59
+ stdout: o => this.log.trace(o),
60
+ stderr: o => this.log.error(o)
58
61
  });
59
62
  });
60
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ps-aux/nodebup",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "",
5
5
  "module": "lib/index.js",
6
6
  "main": "lib/index.js",