@iobroker/js-controller-cli 4.0.0-alpha.44-20220112-9d71e247 → 4.0.0-alpha.48-20220120-5fd8ef9c
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.
- package/lib/cli/cliCompact.js +0 -1
- package/lib/cli/cliHost.js +14 -19
- package/lib/cli/cliObjects.js +11 -13
- package/package.json +4 -4
package/lib/cli/cliCompact.js
CHANGED
package/lib/cli/cliHost.js
CHANGED
|
@@ -283,24 +283,19 @@ module.exports = class CLIHost extends CLICommand {
|
|
|
283
283
|
* @param {any} objects The objects DB to use
|
|
284
284
|
* @param {any} instance The instance object
|
|
285
285
|
* @param {string} newHostname The new hostname the instance should be running on
|
|
286
|
+
* @return Promise<void>
|
|
286
287
|
*/
|
|
287
|
-
function changeInstanceHost(objects, instance, newHostname) {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
objects
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
.catch(err => {
|
|
301
|
-
CLI.error.cannotChangeObject(instance._id, err.message);
|
|
302
|
-
// resolve anyways, we don't want to cause errors
|
|
303
|
-
resolve();
|
|
304
|
-
});
|
|
305
|
-
});
|
|
288
|
+
async function changeInstanceHost(objects, instance, newHostname) {
|
|
289
|
+
const oldInstanceHost = instance.common.host;
|
|
290
|
+
instance.from = getObjectFrom();
|
|
291
|
+
instance.ts = Date.now();
|
|
292
|
+
instance.common.host = newHostname;
|
|
293
|
+
// and save it
|
|
294
|
+
try {
|
|
295
|
+
await objects.setObjectAsync(instance._id, instance);
|
|
296
|
+
CLI.success.instanceHostChanged(instance._id, oldInstanceHost, newHostname);
|
|
297
|
+
} catch (e) {
|
|
298
|
+
CLI.error.cannotChangeObject(instance._id, e.message);
|
|
299
|
+
// resolve anyways, we don't want to cause errors
|
|
300
|
+
}
|
|
306
301
|
}
|
package/lib/cli/cliObjects.js
CHANGED
|
@@ -469,7 +469,7 @@ module.exports = class CLIObjects extends CLICommand {
|
|
|
469
469
|
input: process.stdin,
|
|
470
470
|
output: process.stdout
|
|
471
471
|
});
|
|
472
|
-
rl.question(result.length
|
|
472
|
+
rl.question(`${result.length} object(s) will be deleted. Are you sure? [y/N]: `, answer => {
|
|
473
473
|
rl.close();
|
|
474
474
|
if (
|
|
475
475
|
answer === 'y' ||
|
|
@@ -491,21 +491,19 @@ module.exports = class CLIObjects extends CLICommand {
|
|
|
491
491
|
});
|
|
492
492
|
} else {
|
|
493
493
|
// only one object
|
|
494
|
-
objects.delObject(id, err => {
|
|
494
|
+
objects.delObject(id, async err => {
|
|
495
495
|
if (err) {
|
|
496
496
|
CLI.error.objectNotFound(id, err);
|
|
497
|
-
|
|
497
|
+
callback(3);
|
|
498
498
|
} else {
|
|
499
|
-
|
|
500
|
-
.removeIdFromAllEnums(objects, id)
|
|
501
|
-
.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
return void callback(3);
|
|
508
|
-
});
|
|
499
|
+
try {
|
|
500
|
+
await tools.removeIdFromAllEnums(objects, id);
|
|
501
|
+
CLI.success.objectDeleted(id);
|
|
502
|
+
callback();
|
|
503
|
+
} catch (e) {
|
|
504
|
+
CLI.error.cannotDeleteObjectFromEnums(id, e.message);
|
|
505
|
+
callback(3);
|
|
506
|
+
}
|
|
509
507
|
}
|
|
510
508
|
});
|
|
511
509
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/js-controller-cli",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.48-20220120-5fd8ef9c",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12.0.0"
|
|
6
6
|
},
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@iobroker/js-controller-common": "4.0.0-alpha.
|
|
9
|
-
"@iobroker/js-controller-common-db": "4.0.0-alpha.
|
|
8
|
+
"@iobroker/js-controller-common": "4.0.0-alpha.48-20220120-5fd8ef9c",
|
|
9
|
+
"@iobroker/js-controller-common-db": "4.0.0-alpha.48-20220120-5fd8ef9c",
|
|
10
10
|
"chokidar": "^3.5.2",
|
|
11
11
|
"daemonize2": "^0.4.2",
|
|
12
12
|
"debug": "^4.3.3",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"lib/",
|
|
39
39
|
"index.js"
|
|
40
40
|
],
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "36632208e64a38a8e8760ac32cab53b5f908ee82"
|
|
42
42
|
}
|