@iobroker/js-controller-common 4.0.6 → 4.0.9-alpha.3-20220211-dbe2094e
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/common/tools.js +10 -11
- package/package.json +2 -2
package/lib/common/tools.js
CHANGED
|
@@ -215,11 +215,15 @@ async function isSingleHost(objects) {
|
|
|
215
215
|
* @return Promise<boolean> true if one or more hosts running else false
|
|
216
216
|
*/
|
|
217
217
|
async function isHostRunning(objects, states) {
|
|
218
|
-
|
|
218
|
+
// do it without object view for now, can be reverted if no one downgrades to < 4 (redis-sets)
|
|
219
|
+
// const res = await objects.getObjectViewAsync('system', 'host', { startkey: '', endkey: '\u9999' });
|
|
220
|
+
|
|
221
|
+
const res = await objects.getObjectList({ startkey: 'system.host.', endkey: 'system.host.\u9999' });
|
|
222
|
+
res.rows = res.rows.filter(obj => obj.value && obj.value.type === 'host');
|
|
219
223
|
|
|
220
224
|
for (const hostObj of res.rows) {
|
|
221
225
|
const state = await states.getState(`${hostObj.id}.alive`);
|
|
222
|
-
if (state.val) {
|
|
226
|
+
if (state && state.val) {
|
|
223
227
|
return true;
|
|
224
228
|
}
|
|
225
229
|
}
|
|
@@ -1474,20 +1478,15 @@ async function detectPackageManagerWithFallback(cwd) {
|
|
|
1474
1478
|
}
|
|
1475
1479
|
);
|
|
1476
1480
|
} catch {
|
|
1477
|
-
// Lockfile not found,
|
|
1481
|
+
// Lockfile not found, use default to avoid picking up a wrong package manager
|
|
1482
|
+
// like a globally installed yarn
|
|
1478
1483
|
}
|
|
1479
1484
|
|
|
1480
1485
|
// Since we have no lockfile to rely on, assume the root dir is 2 levels above js-controller
|
|
1481
1486
|
const ioBrokerRootDir = path.join(getControllerDir(), '../..');
|
|
1482
|
-
|
|
1483
|
-
return await detectPackageManager({ cwd: ioBrokerRootDir, requireLockfile: false });
|
|
1484
|
-
} catch {
|
|
1485
|
-
// Lockfile not found, use default
|
|
1486
|
-
}
|
|
1487
|
-
|
|
1488
|
-
// Fallback to npm
|
|
1487
|
+
// And fallback to npm
|
|
1489
1488
|
const pak = new packageManagers.npm();
|
|
1490
|
-
pak.cwd = ioBrokerRootDir;
|
|
1489
|
+
pak.cwd = cwd || ioBrokerRootDir;
|
|
1491
1490
|
return pak;
|
|
1492
1491
|
}
|
|
1493
1492
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/js-controller-common",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9-alpha.3-20220211-dbe2094e",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12.0.0"
|
|
6
6
|
},
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"lib/",
|
|
48
48
|
"index.js"
|
|
49
49
|
],
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "493815e7ef2dbfa17e667a930835ea8d5aad9802"
|
|
51
51
|
}
|