pmcf 1.42.2 → 1.43.0
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/bin/pmcf-host-defs +1 -1
- package/package.json +1 -1
- package/src/base.mjs +12 -8
- package/src/cluster.mjs +6 -2
- package/src/dns.mjs +13 -3
- package/src/host.mjs +31 -8
- package/src/location.mjs +12 -2
- package/src/network.mjs +18 -2
- package/src/owner.mjs +9 -9
- package/src/root.mjs +7 -2
- package/src/service.mjs +16 -2
- package/src/subnet.mjs +8 -2
- package/src/types.mjs +5 -1
- package/types/base.d.mts +4 -2
- package/types/cluster.d.mts +5 -0
- package/types/host.d.mts +16 -7
- package/types/owner.d.mts +23 -19
- package/types/root.d.mts +5 -0
- package/types/service.d.mts +5 -0
- package/types/subnet.d.mts +5 -0
package/bin/pmcf-host-defs
CHANGED
|
@@ -15,7 +15,7 @@ const host = await root.load(hostName, { type: Host });
|
|
|
15
15
|
await generateNetworkDefs(host, options.output);
|
|
16
16
|
await generateMachineInfo(host, options.output);
|
|
17
17
|
await copySshKeys(host, options.output);
|
|
18
|
-
await generateKnownHosts(
|
|
18
|
+
await generateKnownHosts(host.owner.hosts(), join(options.output, "root", ".ssh"));
|
|
19
19
|
|
|
20
20
|
console.log("provides", "host", ...host.provides);
|
|
21
21
|
console.log("depends", `location-${host.location.name}`, ...host.depends);
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -9,19 +9,21 @@ export class Base {
|
|
|
9
9
|
description;
|
|
10
10
|
|
|
11
11
|
static get typeName() {
|
|
12
|
-
return
|
|
12
|
+
return this.typeDefinition.name;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
static get typeDefinition() {
|
|
16
16
|
return {
|
|
17
|
-
|
|
17
|
+
name: "base",
|
|
18
|
+
properties: {
|
|
19
|
+
/* name: { type: "string" },
|
|
20
|
+
description: { type: "string" },
|
|
21
|
+
directory: { type: "string" },
|
|
22
|
+
owner: {}*/
|
|
23
|
+
}
|
|
18
24
|
};
|
|
19
25
|
}
|
|
20
26
|
|
|
21
|
-
static get pluralTypeName() {
|
|
22
|
-
return this.typeName + "s";
|
|
23
|
-
}
|
|
24
|
-
|
|
25
27
|
static get nameLookupName() {
|
|
26
28
|
return this.typeName + "Named";
|
|
27
29
|
}
|
|
@@ -62,7 +64,7 @@ export class Base {
|
|
|
62
64
|
|
|
63
65
|
read(data) {
|
|
64
66
|
for (const [slotName, typeDef] of Object.entries(
|
|
65
|
-
this.constructor.typeDefinition
|
|
67
|
+
this.constructor.typeDefinition.properties
|
|
66
68
|
)) {
|
|
67
69
|
const slot = data[slotName];
|
|
68
70
|
if (slot) {
|
|
@@ -79,7 +81,9 @@ export class Base {
|
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
} else {
|
|
82
|
-
|
|
84
|
+
// if (typeDef.type) {
|
|
85
|
+
this[typeDef.type] = new typesByName[typeDef.type](this, slot);
|
|
86
|
+
// }
|
|
83
87
|
}
|
|
84
88
|
}
|
|
85
89
|
}
|
package/src/cluster.mjs
CHANGED
|
@@ -6,8 +6,12 @@ export class Cluster extends Owner {
|
|
|
6
6
|
addType(this);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
static get
|
|
10
|
-
return
|
|
9
|
+
static get typeDefinition() {
|
|
10
|
+
return {
|
|
11
|
+
name: "cluster",
|
|
12
|
+
extends: "owner",
|
|
13
|
+
properties: {}
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
constructor(owner, data) {
|
package/src/dns.mjs
CHANGED
|
@@ -14,9 +14,19 @@ export class DNSService extends Base {
|
|
|
14
14
|
static {
|
|
15
15
|
addType(this);
|
|
16
16
|
}
|
|
17
|
-
|
|
18
|
-
static get
|
|
19
|
-
return
|
|
17
|
+
|
|
18
|
+
static get typeDefinition() {
|
|
19
|
+
return {
|
|
20
|
+
name: "dns",
|
|
21
|
+
properties: {
|
|
22
|
+
/*recordTTL: {},
|
|
23
|
+
soaUpdates: {},
|
|
24
|
+
hasSVRRecords: {},
|
|
25
|
+
hasCatalog: {},
|
|
26
|
+
forwardsTo: {},
|
|
27
|
+
allowedUpdates: {}*/
|
|
28
|
+
}
|
|
29
|
+
};
|
|
20
30
|
}
|
|
21
31
|
|
|
22
32
|
constructor(owner, data) {
|
package/src/host.mjs
CHANGED
|
@@ -27,14 +27,21 @@ export class Host extends Base {
|
|
|
27
27
|
addType(this);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
static get typeName() {
|
|
31
|
-
return "host";
|
|
32
|
-
}
|
|
33
|
-
|
|
34
30
|
static get typeDefinition() {
|
|
35
31
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
name: "host",
|
|
33
|
+
extends: "base",
|
|
34
|
+
properties: {
|
|
35
|
+
networkInterfaces: { type: "network_interface", collection: true },
|
|
36
|
+
services: { type: "service", collection: true }
|
|
37
|
+
/*os: {},
|
|
38
|
+
distribution: {},
|
|
39
|
+
deployment: {},
|
|
40
|
+
master: { },
|
|
41
|
+
model: {},
|
|
42
|
+
replaces: { },
|
|
43
|
+
depends: { }*/
|
|
44
|
+
}
|
|
38
45
|
};
|
|
39
46
|
}
|
|
40
47
|
|
|
@@ -299,8 +306,24 @@ export class NetworkInterface extends Base {
|
|
|
299
306
|
addType(this);
|
|
300
307
|
}
|
|
301
308
|
|
|
302
|
-
static get
|
|
303
|
-
return
|
|
309
|
+
static get typeDefinition() {
|
|
310
|
+
return {
|
|
311
|
+
name: "network_interface",
|
|
312
|
+
extends: "base",
|
|
313
|
+
properties: {
|
|
314
|
+
/*
|
|
315
|
+
arpbridge: {},
|
|
316
|
+
hwaddr: {},
|
|
317
|
+
network: {},
|
|
318
|
+
gateway: {},
|
|
319
|
+
ssid: {},
|
|
320
|
+
psk: {},
|
|
321
|
+
scope: {},
|
|
322
|
+
metric: {},
|
|
323
|
+
kind: {},
|
|
324
|
+
ipAddresses: {}*/
|
|
325
|
+
}
|
|
326
|
+
};
|
|
304
327
|
}
|
|
305
328
|
|
|
306
329
|
#ipAddresses = new Map();
|
package/src/location.mjs
CHANGED
|
@@ -6,8 +6,18 @@ export class Location extends Owner {
|
|
|
6
6
|
addType(this);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
static get
|
|
10
|
-
return
|
|
9
|
+
static get typeDefinition() {
|
|
10
|
+
return {
|
|
11
|
+
name: "location",
|
|
12
|
+
extends: "owner",
|
|
13
|
+
properties: {
|
|
14
|
+
networks: { type: "network", collection: true },
|
|
15
|
+
hosts: { type: "host", collection: true },
|
|
16
|
+
clusters: { type: "cluster", collection: true },
|
|
17
|
+
subnets: { type: "subnet", collection: true },
|
|
18
|
+
dns: { type: "dns", collection: false }
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
}
|
|
12
22
|
|
|
13
23
|
get location() {
|
package/src/network.mjs
CHANGED
|
@@ -13,8 +13,24 @@ export class Network extends Owner {
|
|
|
13
13
|
addType(this);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
static get
|
|
17
|
-
return
|
|
16
|
+
static get typeDefinition() {
|
|
17
|
+
return {
|
|
18
|
+
name: "network",
|
|
19
|
+
extends: "owner",
|
|
20
|
+
properties: {
|
|
21
|
+
networks: { type: "network", collection: true },
|
|
22
|
+
hosts: { type: "host", collection: true },
|
|
23
|
+
clusters: { type: "cluster", collection: true },
|
|
24
|
+
subnets: { type: "subnet", collection: true },
|
|
25
|
+
dns: { type: "dns", collection: false }
|
|
26
|
+
|
|
27
|
+
/* kind: {},
|
|
28
|
+
scope: {},
|
|
29
|
+
metric: {},
|
|
30
|
+
bridge: {},
|
|
31
|
+
gateway: {}*/
|
|
32
|
+
}
|
|
33
|
+
};
|
|
18
34
|
}
|
|
19
35
|
|
|
20
36
|
constructor(owner, data) {
|
package/src/owner.mjs
CHANGED
|
@@ -14,17 +14,17 @@ export class Owner extends Base {
|
|
|
14
14
|
addType(this);
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
static get typeName() {
|
|
18
|
-
return "owner";
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
static get typeDefinition() {
|
|
22
18
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
name: "owner",
|
|
20
|
+
extends: "base",
|
|
21
|
+
properties: {
|
|
22
|
+
networks: { type: "network", collection: true },
|
|
23
|
+
hosts: { type: "host", collection: true },
|
|
24
|
+
clusters: { type: "cluster", collection: true },
|
|
25
|
+
subnets: { type: "subnet", collection: true },
|
|
26
|
+
dns: { type: "dns", collection: false }
|
|
27
|
+
}
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
|
package/src/root.mjs
CHANGED
|
@@ -10,8 +10,13 @@ export class Root extends Location {
|
|
|
10
10
|
addType(this);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
static get
|
|
14
|
-
return
|
|
13
|
+
static get typeDefinition() {
|
|
14
|
+
return {
|
|
15
|
+
name: "root",
|
|
16
|
+
extends: "location",
|
|
17
|
+
properties: {
|
|
18
|
+
}
|
|
19
|
+
};
|
|
15
20
|
}
|
|
16
21
|
|
|
17
22
|
constructor(directory) {
|
package/src/service.mjs
CHANGED
|
@@ -26,8 +26,22 @@ export class Service extends Base {
|
|
|
26
26
|
addType(this);
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
static get
|
|
30
|
-
return
|
|
29
|
+
static get typeDefinition() {
|
|
30
|
+
return {
|
|
31
|
+
name: "service",
|
|
32
|
+
extends: "base",
|
|
33
|
+
properties: {
|
|
34
|
+
/*ipAddresses: {},
|
|
35
|
+
addresses: {},
|
|
36
|
+
port: {},
|
|
37
|
+
protocol: {},
|
|
38
|
+
alias: {},
|
|
39
|
+
type: {},
|
|
40
|
+
master: {},
|
|
41
|
+
priority: {},
|
|
42
|
+
weight: {}*/
|
|
43
|
+
}
|
|
44
|
+
};
|
|
31
45
|
}
|
|
32
46
|
|
|
33
47
|
constructor(owner, data) {
|
package/src/subnet.mjs
CHANGED
|
@@ -9,8 +9,14 @@ export class Subnet extends Base {
|
|
|
9
9
|
addType(this);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
static get
|
|
13
|
-
return
|
|
12
|
+
static get typeDefinition() {
|
|
13
|
+
return {
|
|
14
|
+
name: "subnet",
|
|
15
|
+
extends: "base",
|
|
16
|
+
properties: {
|
|
17
|
+
// address: {}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
14
20
|
}
|
|
15
21
|
|
|
16
22
|
constructor(owner, address) {
|
package/src/types.mjs
CHANGED
package/types/base.d.mts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export function extractFrom(object: any): {};
|
|
2
2
|
export class Base {
|
|
3
3
|
static get typeName(): string;
|
|
4
|
-
static get typeDefinition(): {
|
|
5
|
-
|
|
4
|
+
static get typeDefinition(): {
|
|
5
|
+
name: string;
|
|
6
|
+
properties: {};
|
|
7
|
+
};
|
|
6
8
|
static get nameLookupName(): string;
|
|
7
9
|
static get typeFileName(): string;
|
|
8
10
|
static get fileNameGlob(): string;
|
package/types/cluster.d.mts
CHANGED
package/types/host.d.mts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export class Host extends Base {
|
|
2
2
|
static get typeDefinition(): {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string;
|
|
5
|
+
properties: {
|
|
6
|
+
networkInterfaces: {
|
|
7
|
+
type: string;
|
|
8
|
+
collection: boolean;
|
|
9
|
+
};
|
|
10
|
+
services: {
|
|
11
|
+
type: string;
|
|
12
|
+
collection: boolean;
|
|
13
|
+
};
|
|
10
14
|
};
|
|
11
15
|
};
|
|
12
16
|
static prepareData(root: any, data: any): Promise<typeof Host>;
|
|
@@ -52,6 +56,11 @@ export class Host extends Base {
|
|
|
52
56
|
#private;
|
|
53
57
|
}
|
|
54
58
|
export class NetworkInterface extends Base {
|
|
59
|
+
static get typeDefinition(): {
|
|
60
|
+
name: string;
|
|
61
|
+
extends: string;
|
|
62
|
+
properties: {};
|
|
63
|
+
};
|
|
55
64
|
arpbridge: any;
|
|
56
65
|
hwaddr: any;
|
|
57
66
|
set network(networkOrName: any);
|
package/types/owner.d.mts
CHANGED
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
export class Owner extends Base {
|
|
2
2
|
static get typeDefinition(): {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
3
|
+
name: string;
|
|
4
|
+
extends: string;
|
|
5
|
+
properties: {
|
|
6
|
+
networks: {
|
|
7
|
+
type: string;
|
|
8
|
+
collection: boolean;
|
|
9
|
+
};
|
|
10
|
+
hosts: {
|
|
11
|
+
type: string;
|
|
12
|
+
collection: boolean;
|
|
13
|
+
};
|
|
14
|
+
clusters: {
|
|
15
|
+
type: string;
|
|
16
|
+
collection: boolean;
|
|
17
|
+
};
|
|
18
|
+
subnets: {
|
|
19
|
+
type: string;
|
|
20
|
+
collection: boolean;
|
|
21
|
+
};
|
|
22
|
+
dns: {
|
|
23
|
+
type: string;
|
|
24
|
+
collection: boolean;
|
|
25
|
+
};
|
|
22
26
|
};
|
|
23
27
|
};
|
|
24
28
|
constructor(owner: any, data?: {});
|
package/types/root.d.mts
CHANGED
package/types/service.d.mts
CHANGED