pmcf 4.0.3 → 4.0.5
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 +2 -2
- package/src/base.mjs +2 -10
- package/src/services/bind.mjs +32 -43
- package/types/base.d.mts +1 -3
- package/types/services/bind.d.mts +22 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"package-directory": "^8.1.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@types/node": "^25.0.
|
|
62
|
+
"@types/node": "^25.0.5",
|
|
63
63
|
"ava": "^6.4.1",
|
|
64
64
|
"c8": "^10.1.3",
|
|
65
65
|
"documentation": "^14.0.3",
|
package/src/base.mjs
CHANGED
|
@@ -42,11 +42,11 @@ export class Base {
|
|
|
42
42
|
owner;
|
|
43
43
|
description;
|
|
44
44
|
name;
|
|
45
|
+
extends = [];
|
|
45
46
|
_tags = new Set();
|
|
46
47
|
_packaging = new Set();
|
|
47
48
|
_directory;
|
|
48
49
|
_finalize;
|
|
49
|
-
_extends = [];
|
|
50
50
|
_properties;
|
|
51
51
|
|
|
52
52
|
static {
|
|
@@ -285,14 +285,6 @@ export class Base {
|
|
|
285
285
|
|
|
286
286
|
_applyExtends() {}
|
|
287
287
|
|
|
288
|
-
set extends(value) {
|
|
289
|
-
this._extends.push(value);
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
get extends() {
|
|
293
|
-
return this._extends;
|
|
294
|
-
}
|
|
295
|
-
|
|
296
288
|
named(name) {}
|
|
297
289
|
|
|
298
290
|
typeNamed(typeName, name) {
|
|
@@ -327,7 +319,7 @@ export class Base {
|
|
|
327
319
|
forOwner(owner) {
|
|
328
320
|
if (this.owner !== owner) {
|
|
329
321
|
const newObject = Object.create(this);
|
|
330
|
-
|
|
322
|
+
newObject.extends = [...this.extends];
|
|
331
323
|
newObject.owner = owner;
|
|
332
324
|
return newObject;
|
|
333
325
|
}
|
package/src/services/bind.mjs
CHANGED
|
@@ -12,13 +12,6 @@ import {
|
|
|
12
12
|
string_collection_attribute_writable,
|
|
13
13
|
name_attribute_writable
|
|
14
14
|
} from "pacc";
|
|
15
|
-
import { yesno, writeLines, asArray } from "../utils.mjs";
|
|
16
|
-
import {
|
|
17
|
-
DNSRecord,
|
|
18
|
-
dnsFullName,
|
|
19
|
-
dnsRecordTypeForAddressFamily,
|
|
20
|
-
sortZoneRecords
|
|
21
|
-
} from "../dns-utils.mjs";
|
|
22
15
|
import {
|
|
23
16
|
ExtraSourceService,
|
|
24
17
|
serviceEndpoints,
|
|
@@ -26,6 +19,13 @@ import {
|
|
|
26
19
|
networkAddressType,
|
|
27
20
|
addServiceType
|
|
28
21
|
} from "pmcf";
|
|
22
|
+
import { yesno, writeLines, asArray } from "../utils.mjs";
|
|
23
|
+
import {
|
|
24
|
+
DNSRecord,
|
|
25
|
+
dnsFullName,
|
|
26
|
+
dnsRecordTypeForAddressFamily,
|
|
27
|
+
sortZoneRecords
|
|
28
|
+
} from "../dns-utils.mjs";
|
|
29
29
|
import { ServiceTypeDefinition } from "../service.mjs";
|
|
30
30
|
import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
|
|
31
31
|
import { addHook } from "../hooks.mjs";
|
|
@@ -86,7 +86,7 @@ const BindServiceTypeDefinition = {
|
|
|
86
86
|
collection: true
|
|
87
87
|
},
|
|
88
88
|
notify: boolean_attribute_writable_false,
|
|
89
|
-
recordTTL: string_attribute_writable,
|
|
89
|
+
recordTTL: { ...string_attribute_writable, default: "1W" },
|
|
90
90
|
serial: number_attribute_writable,
|
|
91
91
|
refresh: { ...string_attribute_writable, default: 36000 },
|
|
92
92
|
retry: { ...string_attribute_writable, default: 72000 },
|
|
@@ -236,8 +236,8 @@ export class BindService extends ExtraSourceService {
|
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
async *preparePackages(dir) {
|
|
239
|
-
const
|
|
240
|
-
const names =
|
|
239
|
+
const sources = this.zones.length ? this.zones : [this.owner];
|
|
240
|
+
const names = sources.map(a => a.fullName).join(" ");
|
|
241
241
|
const name = this.owner.owner.name || this.owner.name;
|
|
242
242
|
|
|
243
243
|
const configPackageDir = join(dir, "config") + "/";
|
|
@@ -293,6 +293,12 @@ export class BindService extends ExtraSourceService {
|
|
|
293
293
|
yield packageData;
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
+
const ownerAndGroup = { owner: "named", group: "named" };
|
|
297
|
+
const filePermissions = [
|
|
298
|
+
{ ...ownerAndGroup, mode: 0o644 },
|
|
299
|
+
{ ...ownerAndGroup, mode: 0o755 }
|
|
300
|
+
];
|
|
301
|
+
|
|
296
302
|
const zonesPackageDir = join(dir, "zones") + "/";
|
|
297
303
|
|
|
298
304
|
packageData.dir = zonesPackageDir;
|
|
@@ -301,27 +307,11 @@ export class BindService extends ExtraSourceService {
|
|
|
301
307
|
description: `zone definitions for ${names}`,
|
|
302
308
|
dependencies: ["mf-named"],
|
|
303
309
|
access: "private",
|
|
304
|
-
hooks: {}
|
|
310
|
+
hooks: {},
|
|
311
|
+
sources: [new FileContentProvider(zonesPackageDir, ...filePermissions)]
|
|
305
312
|
};
|
|
306
313
|
|
|
307
|
-
|
|
308
|
-
{
|
|
309
|
-
mode: 0o644,
|
|
310
|
-
owner: "named",
|
|
311
|
-
group: "named"
|
|
312
|
-
},
|
|
313
|
-
{
|
|
314
|
-
mode: 0o755,
|
|
315
|
-
owner: "named",
|
|
316
|
-
group: "named"
|
|
317
|
-
}
|
|
318
|
-
];
|
|
319
|
-
|
|
320
|
-
packageData.sources = [
|
|
321
|
-
new FileContentProvider(zonesPackageDir, ...filePermissions)
|
|
322
|
-
];
|
|
323
|
-
|
|
324
|
-
yield this.generateZoneDefs(zoneSources, packageData);
|
|
314
|
+
yield this.generateZoneDefs(sources, packageData);
|
|
325
315
|
|
|
326
316
|
const outfacingZonesPackageDir = join(dir, "outfacingZones") + "/";
|
|
327
317
|
|
|
@@ -330,14 +320,13 @@ export class BindService extends ExtraSourceService {
|
|
|
330
320
|
name: `named-zones-${name}-outfacing`,
|
|
331
321
|
description: `outfacing zone definitions for ${names}`,
|
|
332
322
|
access: "private",
|
|
333
|
-
hooks: {}
|
|
323
|
+
hooks: {},
|
|
324
|
+
sources: [
|
|
325
|
+
new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
|
|
326
|
+
]
|
|
334
327
|
};
|
|
335
328
|
|
|
336
|
-
|
|
337
|
-
new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
|
|
338
|
-
];
|
|
339
|
-
|
|
340
|
-
yield* this.generateOutfacingDefs(zoneSources, packageData);
|
|
329
|
+
yield* this.generateOutfacingDefs(sources, packageData);
|
|
341
330
|
}
|
|
342
331
|
|
|
343
332
|
async *generateOutfacingDefs(sources, packageData) {
|
|
@@ -368,18 +357,18 @@ export class BindService extends ExtraSourceService {
|
|
|
368
357
|
}
|
|
369
358
|
}
|
|
370
359
|
|
|
371
|
-
async generateZoneDefs(
|
|
360
|
+
async generateZoneDefs(sources, packageData) {
|
|
372
361
|
const configs = [];
|
|
373
362
|
|
|
374
|
-
for (const
|
|
363
|
+
for (const source of sources) {
|
|
375
364
|
console.log(
|
|
376
|
-
"
|
|
377
|
-
|
|
378
|
-
[...
|
|
365
|
+
"ZONE",
|
|
366
|
+
source.toString(),
|
|
367
|
+
[...source.localDomains].join(" ")
|
|
379
368
|
);
|
|
380
369
|
|
|
381
|
-
for (const domain of
|
|
382
|
-
const locationName =
|
|
370
|
+
for (const domain of source.localDomains) {
|
|
371
|
+
const locationName = source.location.name;
|
|
383
372
|
const reverseZones = new Map();
|
|
384
373
|
|
|
385
374
|
const config = {
|
|
@@ -432,7 +421,7 @@ export class BindService extends ExtraSourceService {
|
|
|
432
421
|
networkInterface,
|
|
433
422
|
domainNames,
|
|
434
423
|
family
|
|
435
|
-
} of
|
|
424
|
+
} of source.networkAddresses()) {
|
|
436
425
|
if (
|
|
437
426
|
!this.exclude.has(networkInterface.network) &&
|
|
438
427
|
!this.excludeInterfaceKinds.has(networkInterface.kind)
|
package/types/base.d.mts
CHANGED
|
@@ -48,17 +48,15 @@ export class Base {
|
|
|
48
48
|
owner: Base;
|
|
49
49
|
description: any;
|
|
50
50
|
name: string;
|
|
51
|
+
extends: any[];
|
|
51
52
|
_tags: Set<any>;
|
|
52
53
|
_packaging: Set<any>;
|
|
53
54
|
_directory: any;
|
|
54
55
|
_finalize: any;
|
|
55
|
-
_extends: any[];
|
|
56
56
|
_properties: any;
|
|
57
57
|
ownerFor(attribute: any, data: any): any;
|
|
58
58
|
read(data: any, type?: any): void;
|
|
59
59
|
_applyExtends(): void;
|
|
60
|
-
set extends(value: any[]);
|
|
61
|
-
get extends(): any[];
|
|
62
60
|
named(name: any): void;
|
|
63
61
|
typeNamed(typeName: any, name: any): any;
|
|
64
62
|
addObject(object: any): any;
|
|
@@ -1314,7 +1314,27 @@ export class BindService extends ExtraSourceService {
|
|
|
1314
1314
|
additionalValues?: object;
|
|
1315
1315
|
};
|
|
1316
1316
|
notify: import("pacc").AttributeDefinition;
|
|
1317
|
-
recordTTL:
|
|
1317
|
+
recordTTL: {
|
|
1318
|
+
default: string;
|
|
1319
|
+
type: object;
|
|
1320
|
+
isKey: boolean;
|
|
1321
|
+
writable: boolean;
|
|
1322
|
+
mandatory: boolean;
|
|
1323
|
+
collection: boolean;
|
|
1324
|
+
private?: boolean;
|
|
1325
|
+
credential?: boolean;
|
|
1326
|
+
persistent?: boolean;
|
|
1327
|
+
depends?: string;
|
|
1328
|
+
description?: string;
|
|
1329
|
+
set?: Function;
|
|
1330
|
+
get?: Function;
|
|
1331
|
+
toInternal?: Function;
|
|
1332
|
+
toExternal?: Function;
|
|
1333
|
+
values?: Set<any>;
|
|
1334
|
+
externalName?: string;
|
|
1335
|
+
env?: string[] | string;
|
|
1336
|
+
additionalValues?: object;
|
|
1337
|
+
};
|
|
1318
1338
|
serial: import("pacc").AttributeDefinition;
|
|
1319
1339
|
refresh: {
|
|
1320
1340
|
default: number;
|
|
@@ -1460,7 +1480,7 @@ export class BindService extends ExtraSourceService {
|
|
|
1460
1480
|
get excludeInterfaceKinds(): Set<any>;
|
|
1461
1481
|
preparePackages(dir: any): AsyncGenerator<any, void, unknown>;
|
|
1462
1482
|
generateOutfacingDefs(sources: any, packageData: any): AsyncGenerator<any, void, unknown>;
|
|
1463
|
-
generateZoneDefs(
|
|
1483
|
+
generateZoneDefs(sources: any, packageData: any): Promise<any>;
|
|
1464
1484
|
outfacingZones(host: any, view: any, records: any): any;
|
|
1465
1485
|
get defaultRecords(): {
|
|
1466
1486
|
type: any;
|