pmcf 4.18.12 → 4.18.14
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/package.json +1 -1
- package/src/base.mjs +3 -2
- package/src/host.mjs +3 -3
- package/src/network-interfaces/skeleton.mjs +3 -2
- package/src/network.mjs +2 -2
- package/src/owner.mjs +13 -8
- package/src/service-owner.mjs +5 -16
- package/src/service.mjs +3 -2
- package/types/host.d.mts +1 -1
- package/types/network-interfaces/skeleton.d.mts +1 -1
- package/types/owner.d.mts +2 -1
- package/types/service-owner.d.mts +1 -6
- package/types/service.d.mts +1 -1
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -572,11 +572,12 @@ export class Base {
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
get packageData() {
|
|
575
|
+
const nameParts = [this.typeName, this.owner?.name, this.name];
|
|
575
576
|
return {
|
|
576
577
|
sources: [],
|
|
577
578
|
outputs: this.outputs,
|
|
578
579
|
properties: {
|
|
579
|
-
name:
|
|
580
|
+
name: nameParts.filter(n => n !== undefined && n.length > 0).join("-"),
|
|
580
581
|
access: "private",
|
|
581
582
|
dependencies: this.depends,
|
|
582
583
|
groups: [this.typeName]
|
|
@@ -751,7 +752,7 @@ export function extractFrom(
|
|
|
751
752
|
}
|
|
752
753
|
|
|
753
754
|
if (typeof object[Symbol.iterator] === "function") {
|
|
754
|
-
object = [...object].map(o => o instanceof Base ? extractFrom(o) : o);
|
|
755
|
+
object = [...object].map(o => (o instanceof Base ? extractFrom(o) : o));
|
|
755
756
|
|
|
756
757
|
if (object.length === 0) {
|
|
757
758
|
return undefined;
|
package/src/host.mjs
CHANGED
|
@@ -327,8 +327,8 @@ export class Host extends ServiceOwner {
|
|
|
327
327
|
return this;
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
get hosts() {
|
|
331
|
+
return [this];
|
|
332
332
|
}
|
|
333
333
|
|
|
334
334
|
typeNamed(typeName, name) {
|
|
@@ -449,7 +449,7 @@ export class Host extends ServiceOwner {
|
|
|
449
449
|
await writeLines(dir, "etc/vconsole.conf", `KEYMAP=${this.keymap}`);
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
await generateKnownHosts(this.owner.hosts
|
|
452
|
+
await generateKnownHosts(this.owner.hosts, join(dir, "root", ".ssh"));
|
|
453
453
|
|
|
454
454
|
for (const service of this.services) {
|
|
455
455
|
if (service.systemdConfigs) {
|
package/src/network.mjs
CHANGED
|
@@ -58,7 +58,7 @@ export class Network extends Owner {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
hosts() {
|
|
61
|
+
get hosts() {
|
|
62
62
|
if (this.bridge) {
|
|
63
63
|
let hosts = new Set();
|
|
64
64
|
for (const network of this.bridge) {
|
|
@@ -67,7 +67,7 @@ export class Network extends Owner {
|
|
|
67
67
|
return hosts;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
return super.hosts
|
|
70
|
+
return super.hosts;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
get bridge() {
|
package/src/owner.mjs
CHANGED
|
@@ -159,8 +159,13 @@ export class Owner extends Base {
|
|
|
159
159
|
this.addTypeObject(object.typeName, object.name, object);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
+
get services()
|
|
163
|
+
{
|
|
164
|
+
return [...this.hosts].map(host=>host.services).flat();
|
|
165
|
+
}
|
|
166
|
+
|
|
162
167
|
*findServices(filter) {
|
|
163
|
-
for (const host of this.hosts
|
|
168
|
+
for (const host of this.hosts) {
|
|
164
169
|
yield* host.findServices(filter);
|
|
165
170
|
}
|
|
166
171
|
}
|
|
@@ -186,12 +191,12 @@ export class Owner extends Base {
|
|
|
186
191
|
return hosts;
|
|
187
192
|
}
|
|
188
193
|
|
|
189
|
-
hosts() {
|
|
194
|
+
get hosts() {
|
|
190
195
|
let hosts = this.directHosts();
|
|
191
196
|
|
|
192
197
|
for (const type of types.host.owners) {
|
|
193
198
|
for (const object of this.typeList(type)) {
|
|
194
|
-
hosts = hosts.union(object.hosts
|
|
199
|
+
hosts = hosts.union(object.hosts);
|
|
195
200
|
}
|
|
196
201
|
}
|
|
197
202
|
|
|
@@ -338,7 +343,7 @@ export class Owner extends Base {
|
|
|
338
343
|
|
|
339
344
|
get derivedPackaging() {
|
|
340
345
|
let all = new Set();
|
|
341
|
-
for (const host of this.hosts
|
|
346
|
+
for (const host of this.hosts) {
|
|
342
347
|
all = all.union(host.packaging);
|
|
343
348
|
}
|
|
344
349
|
|
|
@@ -346,7 +351,7 @@ export class Owner extends Base {
|
|
|
346
351
|
}
|
|
347
352
|
|
|
348
353
|
*networkAddresses(filter) {
|
|
349
|
-
for (const host of this.hosts
|
|
354
|
+
for (const host of this.hosts) {
|
|
350
355
|
yield* host.networkAddresses(filter);
|
|
351
356
|
}
|
|
352
357
|
}
|
|
@@ -415,7 +420,7 @@ export class Owner extends Base {
|
|
|
415
420
|
get domains() {
|
|
416
421
|
let domains = new Set();
|
|
417
422
|
|
|
418
|
-
for (const object of this.hosts
|
|
423
|
+
for (const object of this.hosts) {
|
|
419
424
|
domains = domains.union(object.domains);
|
|
420
425
|
}
|
|
421
426
|
|
|
@@ -429,7 +434,7 @@ export class Owner extends Base {
|
|
|
429
434
|
get domainNames() {
|
|
430
435
|
let names = new Set();
|
|
431
436
|
|
|
432
|
-
for (const host of this.hosts
|
|
437
|
+
for (const host of this.hosts) {
|
|
433
438
|
names = names.union(new Set(host.domainNames));
|
|
434
439
|
}
|
|
435
440
|
|
|
@@ -449,7 +454,7 @@ export class Owner extends Base {
|
|
|
449
454
|
|
|
450
455
|
const architectures = new Set();
|
|
451
456
|
|
|
452
|
-
for (const host of this.hosts
|
|
457
|
+
for (const host of this.hosts) {
|
|
453
458
|
architectures.add(host.architecture);
|
|
454
459
|
}
|
|
455
460
|
|
package/src/service-owner.mjs
CHANGED
|
@@ -1,38 +1,27 @@
|
|
|
1
1
|
import { Base, Service } from "pmcf";
|
|
2
2
|
|
|
3
3
|
export class ServiceOwner extends Base {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
get services() {
|
|
7
|
-
return this._services;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @param {Service} service
|
|
12
|
-
*/
|
|
13
|
-
set services(service) {
|
|
14
|
-
this._services.push(service);
|
|
15
|
-
}
|
|
4
|
+
services = [];
|
|
16
5
|
|
|
17
6
|
_applyExtends(owner) {
|
|
18
7
|
super._applyExtends(owner);
|
|
19
8
|
|
|
20
9
|
for (const service of owner.services) {
|
|
21
|
-
const present = this.
|
|
10
|
+
const present = this.services.find(s => s.name === service.name);
|
|
22
11
|
|
|
23
12
|
if (present && service.isTemplate) {
|
|
24
13
|
if (present.extends.indexOf(service) < 0) {
|
|
25
14
|
present.extends.push(service);
|
|
26
15
|
}
|
|
27
16
|
} else {
|
|
28
|
-
this.services
|
|
17
|
+
this.services.push(service.forOwner(this));
|
|
29
18
|
}
|
|
30
19
|
}
|
|
31
20
|
}
|
|
32
21
|
|
|
33
22
|
_traverse(...args) {
|
|
34
23
|
if (super._traverse(...args)) {
|
|
35
|
-
for (const service of this.
|
|
24
|
+
for (const service of this.services) {
|
|
36
25
|
service._traverse(...args);
|
|
37
26
|
}
|
|
38
27
|
|
|
@@ -71,6 +60,6 @@ export class ServiceOwner extends Base {
|
|
|
71
60
|
* @returns {Service|undefined}
|
|
72
61
|
*/
|
|
73
62
|
named(name) {
|
|
74
|
-
return this.
|
|
63
|
+
return this.services.find(s => s.name === name);
|
|
75
64
|
}
|
|
76
65
|
}
|
package/src/service.mjs
CHANGED
package/types/host.d.mts
CHANGED
|
@@ -250,7 +250,7 @@ export class Host extends ServiceOwner {
|
|
|
250
250
|
domainNamesIn(domain: any): Generator<string, void, unknown>;
|
|
251
251
|
get clusters(): Set<any>;
|
|
252
252
|
get host(): this;
|
|
253
|
-
hosts():
|
|
253
|
+
get hosts(): this[];
|
|
254
254
|
named(name: any): any;
|
|
255
255
|
get networks(): Set<any>;
|
|
256
256
|
set networkInterfaces(networkInterface: Map<any, any>);
|
|
@@ -5,7 +5,7 @@ export class SkeletonNetworkInterface extends ServiceOwner {
|
|
|
5
5
|
_network: any;
|
|
6
6
|
get typeName(): string;
|
|
7
7
|
get host(): Host;
|
|
8
|
-
hosts():
|
|
8
|
+
get hosts(): Host[];
|
|
9
9
|
get network_interface(): this;
|
|
10
10
|
get domainName(): string;
|
|
11
11
|
get domainNames(): Set<any>;
|
package/types/owner.d.mts
CHANGED
|
@@ -190,12 +190,13 @@ export class Owner extends Base {
|
|
|
190
190
|
typeList(typeName: any): any;
|
|
191
191
|
addTypeObject(typeName: any, name: any, object: any): void;
|
|
192
192
|
addObject(object: any): void;
|
|
193
|
+
get services(): any[];
|
|
193
194
|
findServices(filter: any): Generator<any, void, any>;
|
|
194
195
|
locationNamed(name: any): any;
|
|
195
196
|
get locations(): any;
|
|
196
197
|
hostNamed(name: any): any;
|
|
197
198
|
directHosts(): Set<any>;
|
|
198
|
-
hosts(): Set<any>;
|
|
199
|
+
get hosts(): Set<any>;
|
|
199
200
|
networkNamed(name: any): any;
|
|
200
201
|
get networks(): any;
|
|
201
202
|
subnetNamed(name: any): any;
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export class ServiceOwner extends Base {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @param {Service} service
|
|
5
|
-
*/
|
|
6
|
-
set services(service: Service);
|
|
7
|
-
get services(): Service;
|
|
2
|
+
services: any[];
|
|
8
3
|
_applyExtends(owner: any): void;
|
|
9
4
|
_traverse(...args: any[]): boolean;
|
|
10
5
|
findServices(filter: any): Generator<any, void, unknown>;
|
package/types/service.d.mts
CHANGED