pmcf 1.56.8 → 1.57.1
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 +24 -2
- package/src/host.mjs +8 -13
- package/src/owner.mjs +2 -2
- package/types/base.d.mts +10 -2
- package/types/cluster.d.mts +10 -0
- package/types/host.d.mts +10 -8
- package/types/location.d.mts +10 -0
- package/types/network.d.mts +5 -0
- package/types/owner.d.mts +6 -1
- package/types/root.d.mts +10 -0
- package/types/service.d.mts +5 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
+
import { allOutputs } from "npm-pkgbuild";
|
|
2
3
|
import { getAttribute } from "pacc";
|
|
3
4
|
import { addType, primitives } from "./types.mjs";
|
|
4
5
|
|
|
@@ -15,7 +16,8 @@ const BaseTypeDefinition = {
|
|
|
15
16
|
writeable: true
|
|
16
17
|
},
|
|
17
18
|
description: { type: "string", collection: false, writeable: true },
|
|
18
|
-
directory: { type: "string", collection: false, writeable: false }
|
|
19
|
+
directory: { type: "string", collection: false, writeable: false },
|
|
20
|
+
packaging: { type: "string", collection: false, writeable: true }
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
|
|
@@ -288,8 +290,28 @@ export class Base {
|
|
|
288
290
|
return `${this.constructor.typeDefinition.name}-${this.name}`;
|
|
289
291
|
}
|
|
290
292
|
|
|
293
|
+
#packaging = new Set();
|
|
294
|
+
|
|
295
|
+
set packaging(value) {
|
|
296
|
+
this.#packaging.add(value);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
get derivedPackaging() {
|
|
300
|
+
return this.owner?.packaging;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
get packaging() {
|
|
304
|
+
const dp = this.derivedPackaging;
|
|
305
|
+
|
|
306
|
+
if (dp) {
|
|
307
|
+
return this.#packaging.union(dp);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return this.#packaging;
|
|
311
|
+
}
|
|
312
|
+
|
|
291
313
|
get outputs() {
|
|
292
|
-
return
|
|
314
|
+
return new Set(allOutputs.filter(o => this.packaging.has(o.name)));
|
|
293
315
|
}
|
|
294
316
|
|
|
295
317
|
async preparePackage(stagingDir) {
|
package/src/host.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { allOutputs } from "npm-pkgbuild";
|
|
4
3
|
import { Base } from "./base.mjs";
|
|
5
4
|
import { networkProperties } from "./network-support.mjs";
|
|
6
5
|
import {
|
|
@@ -39,7 +38,6 @@ const HostTypeDefinition = {
|
|
|
39
38
|
serial: { type: "string", collection: false, writeable: true },
|
|
40
39
|
vendor: { type: "string", collection: false, writeable: true },
|
|
41
40
|
chassis: { type: "string", collection: false, writeable: true },
|
|
42
|
-
packaging: { type: "string", collection: false, writeable: true },
|
|
43
41
|
priority: { type: "number", collection: false, writeable: true },
|
|
44
42
|
replaces: { type: "string", collection: true, writeable: true },
|
|
45
43
|
depends: { type: "string", collection: true, writeable: true },
|
|
@@ -68,7 +66,6 @@ export class Host extends Base {
|
|
|
68
66
|
#deployment;
|
|
69
67
|
#chassis;
|
|
70
68
|
#vendor;
|
|
71
|
-
#packaging;
|
|
72
69
|
|
|
73
70
|
static {
|
|
74
71
|
addType(this);
|
|
@@ -145,12 +142,8 @@ export class Host extends Base {
|
|
|
145
142
|
return this.#vendor || this.extends.find(e => e.vendor)?.vendor;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
|
-
|
|
149
|
-
this
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
get packaging() {
|
|
153
|
-
return this.#packaging || this.extends.find(e => e.packaging)?.packaging;
|
|
145
|
+
get derivedPackaging() {
|
|
146
|
+
return this.extends.reduce((a, c) => a.union(c.packaging), new Set());
|
|
154
147
|
}
|
|
155
148
|
|
|
156
149
|
get isTemplate() {
|
|
@@ -336,9 +329,8 @@ export class Host extends Base {
|
|
|
336
329
|
return readFile(join(this.directory, `ssh_host_${type}_key.pub`), "utf8");
|
|
337
330
|
}
|
|
338
331
|
|
|
339
|
-
get
|
|
340
|
-
|
|
341
|
-
return new Set(allOutputs.filter(o=>o.name === this.packaging));
|
|
332
|
+
get packageName() {
|
|
333
|
+
return `${this.constructor.typeDefinition.name}-${this.owner.name}-${this.name}`;
|
|
342
334
|
}
|
|
343
335
|
|
|
344
336
|
async preparePackage(stagingDir) {
|
|
@@ -351,7 +343,10 @@ export class Host extends Base {
|
|
|
351
343
|
join(stagingDir, "root", ".ssh")
|
|
352
344
|
);
|
|
353
345
|
|
|
354
|
-
result.properties.dependencies = [
|
|
346
|
+
result.properties.dependencies = [
|
|
347
|
+
this.location.packageName,
|
|
348
|
+
...this.depends
|
|
349
|
+
];
|
|
355
350
|
result.properties.provides = [...this.provides];
|
|
356
351
|
result.properties.replaces = [`mf-${this.hostName}`, ...this.replaces];
|
|
357
352
|
result.properties.backup = "root/.ssh/known_hosts";
|
package/src/owner.mjs
CHANGED
|
@@ -278,10 +278,10 @@ export class Owner extends Base {
|
|
|
278
278
|
}
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
-
get
|
|
281
|
+
get derivedPackaging() {
|
|
282
282
|
let all = new Set();
|
|
283
283
|
for (const host of this.hosts()) {
|
|
284
|
-
all = all.union(host.
|
|
284
|
+
all = all.union(host.packaging);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
287
|
return all;
|
package/types/base.d.mts
CHANGED
|
@@ -31,6 +31,11 @@ export class Base {
|
|
|
31
31
|
collection: boolean;
|
|
32
32
|
writeable: boolean;
|
|
33
33
|
};
|
|
34
|
+
packaging: {
|
|
35
|
+
type: string;
|
|
36
|
+
collection: boolean;
|
|
37
|
+
writeable: boolean;
|
|
38
|
+
};
|
|
34
39
|
};
|
|
35
40
|
};
|
|
36
41
|
static get typeFileName(): string;
|
|
@@ -60,9 +65,12 @@ export class Base {
|
|
|
60
65
|
get directory(): any;
|
|
61
66
|
get fullName(): any;
|
|
62
67
|
get packageName(): string;
|
|
63
|
-
|
|
68
|
+
set packaging(value: Set<any>);
|
|
69
|
+
get packaging(): Set<any>;
|
|
70
|
+
get derivedPackaging(): any;
|
|
71
|
+
get outputs(): Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
64
72
|
preparePackage(stagingDir: any): Promise<{
|
|
65
|
-
outputs:
|
|
73
|
+
outputs: Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
66
74
|
properties: {
|
|
67
75
|
name: string;
|
|
68
76
|
description: string;
|
package/types/cluster.d.mts
CHANGED
|
@@ -35,6 +35,11 @@ export class Cluster extends Owner {
|
|
|
35
35
|
collection: boolean;
|
|
36
36
|
writeable: boolean;
|
|
37
37
|
};
|
|
38
|
+
packaging: {
|
|
39
|
+
type: string;
|
|
40
|
+
collection: boolean;
|
|
41
|
+
writeable: boolean;
|
|
42
|
+
};
|
|
38
43
|
};
|
|
39
44
|
};
|
|
40
45
|
properties: {
|
|
@@ -209,6 +214,11 @@ export class Cluster extends Owner {
|
|
|
209
214
|
collection: boolean;
|
|
210
215
|
writeable: boolean;
|
|
211
216
|
};
|
|
217
|
+
packaging: {
|
|
218
|
+
type: string;
|
|
219
|
+
collection: boolean;
|
|
220
|
+
writeable: boolean;
|
|
221
|
+
};
|
|
212
222
|
};
|
|
213
223
|
};
|
|
214
224
|
properties: {
|
package/types/host.d.mts
CHANGED
|
@@ -33,6 +33,11 @@ export class Host extends Base {
|
|
|
33
33
|
collection: boolean;
|
|
34
34
|
writeable: boolean;
|
|
35
35
|
};
|
|
36
|
+
packaging: {
|
|
37
|
+
type: string;
|
|
38
|
+
collection: boolean;
|
|
39
|
+
writeable: boolean;
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
};
|
|
38
43
|
properties: {
|
|
@@ -86,11 +91,6 @@ export class Host extends Base {
|
|
|
86
91
|
collection: boolean;
|
|
87
92
|
writeable: boolean;
|
|
88
93
|
};
|
|
89
|
-
packaging: {
|
|
90
|
-
type: string;
|
|
91
|
-
collection: boolean;
|
|
92
|
-
writeable: boolean;
|
|
93
|
-
};
|
|
94
94
|
priority: {
|
|
95
95
|
type: string;
|
|
96
96
|
collection: boolean;
|
|
@@ -160,8 +160,6 @@ export class Host extends Base {
|
|
|
160
160
|
get chassis(): any;
|
|
161
161
|
set vendor(value: any);
|
|
162
162
|
get vendor(): any;
|
|
163
|
-
set packaging(value: any);
|
|
164
|
-
get packaging(): any;
|
|
165
163
|
get isTemplate(): true | RegExpMatchArray;
|
|
166
164
|
get isModel(): boolean;
|
|
167
165
|
get model(): any;
|
|
@@ -189,7 +187,6 @@ export class Host extends Base {
|
|
|
189
187
|
get rawAddresses(): any[];
|
|
190
188
|
get cidrAddresses(): any[];
|
|
191
189
|
publicKey(type?: string): Promise<string>;
|
|
192
|
-
get outputs(): Set<typeof import("npm-pkgbuild").ARCH | typeof import("npm-pkgbuild").DOCKER>;
|
|
193
190
|
#private;
|
|
194
191
|
}
|
|
195
192
|
export class NetworkInterface extends Base {
|
|
@@ -227,6 +224,11 @@ export class NetworkInterface extends Base {
|
|
|
227
224
|
collection: boolean;
|
|
228
225
|
writeable: boolean;
|
|
229
226
|
};
|
|
227
|
+
packaging: {
|
|
228
|
+
type: string;
|
|
229
|
+
collection: boolean;
|
|
230
|
+
writeable: boolean;
|
|
231
|
+
};
|
|
230
232
|
};
|
|
231
233
|
};
|
|
232
234
|
properties: {
|
package/types/location.d.mts
CHANGED
|
@@ -35,6 +35,11 @@ export class Location extends Owner {
|
|
|
35
35
|
collection: boolean;
|
|
36
36
|
writeable: boolean;
|
|
37
37
|
};
|
|
38
|
+
packaging: {
|
|
39
|
+
type: string;
|
|
40
|
+
collection: boolean;
|
|
41
|
+
writeable: boolean;
|
|
42
|
+
};
|
|
38
43
|
};
|
|
39
44
|
};
|
|
40
45
|
properties: {
|
|
@@ -209,6 +214,11 @@ export class Location extends Owner {
|
|
|
209
214
|
collection: boolean;
|
|
210
215
|
writeable: boolean;
|
|
211
216
|
};
|
|
217
|
+
packaging: {
|
|
218
|
+
type: string;
|
|
219
|
+
collection: boolean;
|
|
220
|
+
writeable: boolean;
|
|
221
|
+
};
|
|
212
222
|
};
|
|
213
223
|
};
|
|
214
224
|
properties: {
|
package/types/network.d.mts
CHANGED
package/types/owner.d.mts
CHANGED
|
@@ -33,6 +33,11 @@ export class Owner extends Base {
|
|
|
33
33
|
collection: boolean;
|
|
34
34
|
writeable: boolean;
|
|
35
35
|
};
|
|
36
|
+
packaging: {
|
|
37
|
+
type: string;
|
|
38
|
+
collection: boolean;
|
|
39
|
+
writeable: boolean;
|
|
40
|
+
};
|
|
36
41
|
};
|
|
37
42
|
};
|
|
38
43
|
properties: {
|
|
@@ -195,7 +200,7 @@ export class Owner extends Base {
|
|
|
195
200
|
clusters(): any;
|
|
196
201
|
addBridge(network: any, destinationNetworks: any): any;
|
|
197
202
|
_resolveBridges(): void;
|
|
198
|
-
get
|
|
203
|
+
get derivedPackaging(): Set<any>;
|
|
199
204
|
networkAddresses(): Generator<any, void, any>;
|
|
200
205
|
set country(value: any);
|
|
201
206
|
get country(): any;
|
package/types/root.d.mts
CHANGED
|
@@ -39,6 +39,11 @@ export class Root extends Location {
|
|
|
39
39
|
collection: boolean;
|
|
40
40
|
writeable: boolean;
|
|
41
41
|
};
|
|
42
|
+
packaging: {
|
|
43
|
+
type: string;
|
|
44
|
+
collection: boolean;
|
|
45
|
+
writeable: boolean;
|
|
46
|
+
};
|
|
42
47
|
};
|
|
43
48
|
};
|
|
44
49
|
properties: {
|
|
@@ -213,6 +218,11 @@ export class Root extends Location {
|
|
|
213
218
|
collection: boolean;
|
|
214
219
|
writeable: boolean;
|
|
215
220
|
};
|
|
221
|
+
packaging: {
|
|
222
|
+
type: string;
|
|
223
|
+
collection: boolean;
|
|
224
|
+
writeable: boolean;
|
|
225
|
+
};
|
|
216
226
|
};
|
|
217
227
|
};
|
|
218
228
|
properties: {
|