pmcf 1.78.0 → 1.79.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/bin/pmcf-info +12 -8
- package/package.json +1 -1
- package/src/cli.mjs +2 -1
- package/src/cluster.mjs +1 -1
- package/src/owner.mjs +22 -3
- package/src/service.mjs +0 -12
- package/types/cli.d.mts +1 -1
- package/types/cluster.d.mts +70 -115
- package/types/owner.d.mts +1 -1
package/bin/pmcf-info
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { prepare } from "../src/cli.mjs";
|
|
3
|
-
const { root, args } = await prepare(
|
|
3
|
+
const { root, args, options } = await prepare({
|
|
4
|
+
service: {
|
|
5
|
+
type: "string"
|
|
6
|
+
}
|
|
7
|
+
});
|
|
4
8
|
|
|
5
9
|
const objectName = args[0];
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
console.log(location.name);
|
|
13
|
-
console.log(" ", (await location.service({ type: "dns" }))?.toString());
|
|
11
|
+
const object = objectName ? root.named(objectName) : root;
|
|
12
|
+
|
|
13
|
+
if (options.service) {
|
|
14
|
+
for (const service of root.findServices({ type: options.service })) {
|
|
15
|
+
console.log(service.toString());
|
|
14
16
|
}
|
|
17
|
+
} else {
|
|
18
|
+
console.log(object.toJSON());
|
|
15
19
|
}
|
package/package.json
CHANGED
package/src/cli.mjs
CHANGED
|
@@ -2,10 +2,11 @@ import { parseArgs } from "node:util";
|
|
|
2
2
|
import { argv, cwd, env } from "node:process";
|
|
3
3
|
import { Root } from "./module.mjs";
|
|
4
4
|
|
|
5
|
-
export async function prepare() {
|
|
5
|
+
export async function prepare(options={}) {
|
|
6
6
|
const { values, positionals } = parseArgs({
|
|
7
7
|
args: argv.slice(2),
|
|
8
8
|
options: {
|
|
9
|
+
...options,
|
|
9
10
|
verbose: {
|
|
10
11
|
type: "boolean",
|
|
11
12
|
short: "v",
|
package/src/cluster.mjs
CHANGED
|
@@ -9,7 +9,7 @@ const ClusterTypeDefinition = {
|
|
|
9
9
|
name: "cluster",
|
|
10
10
|
owners: [Owner.typeDefinition, "network", "location", "root"],
|
|
11
11
|
priority: 0.7,
|
|
12
|
-
extends:
|
|
12
|
+
extends: Host.typeDefinition,
|
|
13
13
|
properties: {
|
|
14
14
|
routerId: { type: "number", collection: false, writeable: true },
|
|
15
15
|
masters: { type: "network_interface", collection: true, writeable: true },
|
package/src/owner.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { asIterator, normalizeCIDR } from "./utils.mjs";
|
|
2
2
|
import { Base } from "./base.mjs";
|
|
3
3
|
import { Subnet } from "./subnet.mjs";
|
|
4
|
-
import { addType } from "./types.mjs";
|
|
4
|
+
import { addType, types } from "./types.mjs";
|
|
5
5
|
import { DNSService } from "./dns.mjs";
|
|
6
6
|
import { NTPService } from "./ntp.mjs";
|
|
7
7
|
|
|
@@ -151,8 +151,27 @@ export class Owner extends Base {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
*hosts() {
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const hosts = new Set();
|
|
155
|
+
|
|
156
|
+
for (const type of ["host", "cluster"]) {
|
|
157
|
+
for (const host of this.typeList(type)) {
|
|
158
|
+
if (!hosts.has(host)) {
|
|
159
|
+
hosts.add(host);
|
|
160
|
+
yield host;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
for (const type of types.host.owners) {
|
|
166
|
+
for (const object of this.typeList(type)) {
|
|
167
|
+
for (const host of object.hosts()) {
|
|
168
|
+
if (!hosts.has(host)) {
|
|
169
|
+
hosts.add(host);
|
|
170
|
+
yield host;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
156
175
|
}
|
|
157
176
|
|
|
158
177
|
networkNamed(name) {
|
package/src/service.mjs
CHANGED
|
@@ -222,18 +222,6 @@ export class Service extends Base {
|
|
|
222
222
|
dnsFormatParameters(dnsRecord.parameters)
|
|
223
223
|
)
|
|
224
224
|
);
|
|
225
|
-
|
|
226
|
-
if (this.master && this.alias) {
|
|
227
|
-
records.push(
|
|
228
|
-
DNSRecord(
|
|
229
|
-
this.alias,
|
|
230
|
-
dnsRecord.type,
|
|
231
|
-
this.priority,
|
|
232
|
-
dnsFullName(domainName),
|
|
233
|
-
dnsFormatParameters(dnsRecord.parameters)
|
|
234
|
-
)
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
225
|
}
|
|
238
226
|
|
|
239
227
|
return records;
|
package/types/cli.d.mts
CHANGED
package/types/cluster.d.mts
CHANGED
|
@@ -203,8 +203,8 @@ export class Cluster extends Host {
|
|
|
203
203
|
priority: number;
|
|
204
204
|
extends: {
|
|
205
205
|
name: string;
|
|
206
|
-
owners: string[];
|
|
207
206
|
priority: number;
|
|
207
|
+
owners: string[];
|
|
208
208
|
extends: {
|
|
209
209
|
name: string;
|
|
210
210
|
owners: any[];
|
|
@@ -243,157 +243,112 @@ export class Cluster extends Host {
|
|
|
243
243
|
};
|
|
244
244
|
};
|
|
245
245
|
properties: {
|
|
246
|
-
|
|
246
|
+
networkInterfaces: {
|
|
247
247
|
type: string;
|
|
248
248
|
collection: boolean;
|
|
249
249
|
writeable: boolean;
|
|
250
250
|
};
|
|
251
|
-
|
|
251
|
+
services: {
|
|
252
252
|
type: string;
|
|
253
253
|
collection: boolean;
|
|
254
254
|
writeable: boolean;
|
|
255
255
|
};
|
|
256
|
-
|
|
256
|
+
aliases: {
|
|
257
257
|
type: string;
|
|
258
258
|
collection: boolean;
|
|
259
259
|
writeable: boolean;
|
|
260
260
|
};
|
|
261
|
-
|
|
262
|
-
type:
|
|
263
|
-
name: string;
|
|
264
|
-
owners: string[];
|
|
265
|
-
priority: number;
|
|
266
|
-
constructWithIdentifierOnly: boolean;
|
|
267
|
-
properties: {
|
|
268
|
-
address: {
|
|
269
|
-
type: string;
|
|
270
|
-
collection: boolean;
|
|
271
|
-
writeable: boolean;
|
|
272
|
-
identifier: boolean;
|
|
273
|
-
};
|
|
274
|
-
networks: {
|
|
275
|
-
type: string;
|
|
276
|
-
collection: boolean;
|
|
277
|
-
writeable: boolean;
|
|
278
|
-
};
|
|
279
|
-
prefixLength: {
|
|
280
|
-
type: string;
|
|
281
|
-
collection: boolean;
|
|
282
|
-
writeable: boolean;
|
|
283
|
-
};
|
|
284
|
-
};
|
|
285
|
-
};
|
|
261
|
+
os: {
|
|
262
|
+
type: string;
|
|
286
263
|
collection: boolean;
|
|
287
264
|
writeable: boolean;
|
|
288
265
|
};
|
|
289
|
-
|
|
290
|
-
type:
|
|
291
|
-
name: string;
|
|
292
|
-
owners: string[];
|
|
293
|
-
priority: number;
|
|
294
|
-
properties: {
|
|
295
|
-
source: {
|
|
296
|
-
type: string;
|
|
297
|
-
collection: boolean;
|
|
298
|
-
writeable: boolean;
|
|
299
|
-
};
|
|
300
|
-
trusted: {
|
|
301
|
-
type: string;
|
|
302
|
-
collection: boolean;
|
|
303
|
-
writeable: boolean;
|
|
304
|
-
};
|
|
305
|
-
hasSVRRecords: {
|
|
306
|
-
type: string;
|
|
307
|
-
collection: boolean;
|
|
308
|
-
writeable: boolean;
|
|
309
|
-
};
|
|
310
|
-
hasCatalog: {
|
|
311
|
-
type: string;
|
|
312
|
-
collection: boolean;
|
|
313
|
-
writeable: boolean;
|
|
314
|
-
};
|
|
315
|
-
hasLinkLocalAdresses: {
|
|
316
|
-
type: string;
|
|
317
|
-
collection: boolean;
|
|
318
|
-
writeable: boolean;
|
|
319
|
-
};
|
|
320
|
-
notify: {
|
|
321
|
-
type: string;
|
|
322
|
-
collection: boolean;
|
|
323
|
-
writeable: boolean;
|
|
324
|
-
};
|
|
325
|
-
recordTTL: {
|
|
326
|
-
type: string;
|
|
327
|
-
collection: boolean;
|
|
328
|
-
writeable: boolean;
|
|
329
|
-
};
|
|
330
|
-
refresh: {
|
|
331
|
-
type: string;
|
|
332
|
-
collection: boolean;
|
|
333
|
-
writeable: boolean;
|
|
334
|
-
};
|
|
335
|
-
retry: {
|
|
336
|
-
type: string;
|
|
337
|
-
collection: boolean;
|
|
338
|
-
writeable: boolean;
|
|
339
|
-
};
|
|
340
|
-
expire: {
|
|
341
|
-
type: string;
|
|
342
|
-
collection: boolean;
|
|
343
|
-
writeable: boolean;
|
|
344
|
-
};
|
|
345
|
-
minimum: {
|
|
346
|
-
type: string;
|
|
347
|
-
collection: boolean;
|
|
348
|
-
writeable: boolean;
|
|
349
|
-
};
|
|
350
|
-
allowedUpdates: {
|
|
351
|
-
type: string;
|
|
352
|
-
collection: boolean;
|
|
353
|
-
writeable: boolean;
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
};
|
|
266
|
+
"machine-id": {
|
|
267
|
+
type: string;
|
|
357
268
|
collection: boolean;
|
|
358
269
|
writeable: boolean;
|
|
359
270
|
};
|
|
360
|
-
|
|
361
|
-
type:
|
|
362
|
-
name: string;
|
|
363
|
-
owners: string[];
|
|
364
|
-
priority: number;
|
|
365
|
-
properties: {
|
|
366
|
-
source: {
|
|
367
|
-
type: string;
|
|
368
|
-
collection: boolean;
|
|
369
|
-
writeable: boolean;
|
|
370
|
-
};
|
|
371
|
-
};
|
|
372
|
-
};
|
|
271
|
+
distribution: {
|
|
272
|
+
type: string;
|
|
373
273
|
collection: boolean;
|
|
374
274
|
writeable: boolean;
|
|
375
275
|
};
|
|
376
|
-
|
|
276
|
+
deployment: {
|
|
377
277
|
type: string;
|
|
378
278
|
collection: boolean;
|
|
379
279
|
writeable: boolean;
|
|
380
280
|
};
|
|
381
|
-
|
|
281
|
+
master: {
|
|
382
282
|
type: string;
|
|
383
283
|
collection: boolean;
|
|
384
284
|
writeable: boolean;
|
|
385
285
|
};
|
|
386
|
-
|
|
286
|
+
serial: {
|
|
387
287
|
type: string;
|
|
388
288
|
collection: boolean;
|
|
389
289
|
writeable: boolean;
|
|
390
290
|
};
|
|
391
|
-
|
|
291
|
+
vendor: {
|
|
392
292
|
type: string;
|
|
393
293
|
collection: boolean;
|
|
394
294
|
writeable: boolean;
|
|
395
295
|
};
|
|
396
|
-
|
|
296
|
+
chassis: {
|
|
297
|
+
type: string;
|
|
298
|
+
collection: boolean;
|
|
299
|
+
writeable: boolean;
|
|
300
|
+
};
|
|
301
|
+
priority: {
|
|
302
|
+
type: string;
|
|
303
|
+
collection: boolean;
|
|
304
|
+
writeable: boolean;
|
|
305
|
+
};
|
|
306
|
+
replaces: {
|
|
307
|
+
type: string;
|
|
308
|
+
collection: boolean;
|
|
309
|
+
writeable: boolean;
|
|
310
|
+
};
|
|
311
|
+
depends: {
|
|
312
|
+
type: string;
|
|
313
|
+
collection: boolean;
|
|
314
|
+
writeable: boolean;
|
|
315
|
+
};
|
|
316
|
+
provides: {
|
|
317
|
+
type: string;
|
|
318
|
+
collection: boolean;
|
|
319
|
+
writeable: boolean;
|
|
320
|
+
};
|
|
321
|
+
extends: {
|
|
322
|
+
type: string;
|
|
323
|
+
collection: boolean;
|
|
324
|
+
writeable: boolean;
|
|
325
|
+
};
|
|
326
|
+
model: {
|
|
327
|
+
type: string;
|
|
328
|
+
collection: boolean;
|
|
329
|
+
writeable: boolean;
|
|
330
|
+
};
|
|
331
|
+
isModel: {
|
|
332
|
+
type: string;
|
|
333
|
+
collection: boolean;
|
|
334
|
+
writeable: boolean;
|
|
335
|
+
};
|
|
336
|
+
cidrAddresses: {
|
|
337
|
+
type: string;
|
|
338
|
+
collection: boolean;
|
|
339
|
+
writeable: boolean;
|
|
340
|
+
};
|
|
341
|
+
cidrAddress: {
|
|
342
|
+
type: string;
|
|
343
|
+
collection: boolean;
|
|
344
|
+
writeable: boolean;
|
|
345
|
+
};
|
|
346
|
+
rawAddresses: {
|
|
347
|
+
type: string;
|
|
348
|
+
collection: boolean;
|
|
349
|
+
writeable: boolean;
|
|
350
|
+
};
|
|
351
|
+
rawAddress: {
|
|
397
352
|
type: string;
|
|
398
353
|
collection: boolean;
|
|
399
354
|
writeable: boolean;
|
package/types/owner.d.mts
CHANGED
|
@@ -207,7 +207,7 @@ export class Owner extends Base {
|
|
|
207
207
|
locationNamed(name: any): any;
|
|
208
208
|
locations(): any;
|
|
209
209
|
hostNamed(name: any): any;
|
|
210
|
-
hosts(): Generator<any, void,
|
|
210
|
+
hosts(): Generator<any, void, unknown>;
|
|
211
211
|
networkNamed(name: any): any;
|
|
212
212
|
networks(): any;
|
|
213
213
|
subnetNamed(name: any): any;
|