cloudron 5.14.7 → 5.14.8

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/actions.js +15 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "5.14.7",
3
+ "version": "5.14.8",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "main": "main.js",
package/src/actions.js CHANGED
@@ -89,7 +89,7 @@ function createRequest(method, apiPath, options) {
89
89
  function requestError(response) {
90
90
  if (response.status === 401) return 'Invalid token. Use cloudron login again.';
91
91
 
92
- return `${response.status} message: ${response.body.message || JSON.stringify(response.body)}`; // body is sometimes just a string like in 401
92
+ return `${response.status} message: ${response.body.message || JSON.stringify(String(response.body))}`; // body is sometimes just a string like in 401
93
93
  }
94
94
 
95
95
  async function selectDomain(location, options) {
@@ -132,7 +132,8 @@ async function stopActiveTask(app, options) {
132
132
 
133
133
  console.log(`Stopping app's current active task ${app.taskId}`);
134
134
 
135
- const response = await createRequest('POST', `/api/v1/tasks/${app.taskId}/stop`, options);
135
+ const request = createRequest('POST', `/api/v1/tasks/${app.taskId}/stop`, options);
136
+ const response = await request.send({});
136
137
  if (response.status !== 204) throw `Failed to stop active task: ${requestError(response)}`;
137
138
  }
138
139
 
@@ -295,7 +296,8 @@ async function stopApp(app, options) {
295
296
  assert.strictEqual(typeof app, 'object');
296
297
  assert.strictEqual(typeof options, 'object');
297
298
 
298
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/stop`, options);
299
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/stop`, options);
300
+ const response = await request.send({});
299
301
  if (response.status !== 202) throw `Failed to stop app: ${requestError(response)}`;
300
302
 
301
303
  await waitForTask(response.body.taskId, options);
@@ -305,7 +307,8 @@ async function startApp(app, options) {
305
307
  assert.strictEqual(typeof app, 'object');
306
308
  assert.strictEqual(typeof options, 'object');
307
309
 
308
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/start`, options);
310
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/start`, options);
311
+ const response = await request.send({});
309
312
  if (response.status !== 202) throw `Failed to start app: ${requestError(response)}`;
310
313
 
311
314
  await waitForTask(response.body.taskId, options);
@@ -315,7 +318,8 @@ async function restartApp(app, options) {
315
318
  assert.strictEqual(typeof app, 'object');
316
319
  assert.strictEqual(typeof options, 'object');
317
320
 
318
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/restart`, options);
321
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/restart`, options);
322
+ const response = await request.send({});
319
323
  if (response.status !== 202) throw `Failed to restart app: ${requestError(response)}`;
320
324
 
321
325
  await waitForTask(response.body.taskId, options);
@@ -894,7 +898,8 @@ async function uninstall(localOptions, cmd) {
894
898
 
895
899
  await stopActiveTask(app, options);
896
900
 
897
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/uninstall`, options);
901
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/uninstall`, options);
902
+ const response = await request.send({});
898
903
  if (response.status !== 202) return exit(`Failed to uninstall app: ${requestError(response)}`);
899
904
 
900
905
  process.stdout.write('\n => ' + 'Waiting for app to be uninstalled ');
@@ -1061,7 +1066,8 @@ async function backupCreate(localOptions, cmd) {
1061
1066
  const app = await getApp(options);
1062
1067
  if (!app) return exit(NO_APP_FOUND_ERROR_STRING);
1063
1068
 
1064
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/backup`, options);
1069
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/backup`, options);
1070
+ const response = await request.send({});
1065
1071
  if (response.status !== 202) return exit(`Failed to start backup: ${requestError(response)}`);
1066
1072
 
1067
1073
  // FIXME: this should be waitForHealthCheck but the box code incorrectly modifies the installationState
@@ -1193,7 +1199,8 @@ async function importApp(localOptions, cmd) {
1193
1199
  if (backupKey) data.backupConfig.key = backupKey;
1194
1200
  }
1195
1201
 
1196
- const response = await createRequest('POST', `/api/v1/apps/${app.id}/import`, options);
1202
+ const request = createRequest('POST', `/api/v1/apps/${app.id}/import`, options);
1203
+ const response = await request.send({});
1197
1204
  if (response.status !== 202) return exit(`Failed to import app: ${requestError(response)}`);
1198
1205
 
1199
1206
  await waitForFinishInstallation(app.id, response.body.taskId, options);