pmcf 4.0.4 → 4.0.6

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.0.4",
3
+ "version": "4.0.6",
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.3",
62
+ "@types/node": "^25.0.5",
63
63
  "ava": "^6.4.1",
64
64
  "c8": "^10.1.3",
65
65
  "documentation": "^14.0.3",
@@ -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,15 +236,15 @@ export class BindService extends ExtraSourceService {
236
236
  }
237
237
 
238
238
  async *preparePackages(dir) {
239
- const zoneSources = this.zones.length ? this.zones : [this.owner];
240
- const names = zoneSources.map(a => a.fullName).join(" ");
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") + "/";
244
244
  const packageData = {
245
+ outputs: this.outputs,
245
246
  dir: configPackageDir,
246
247
  sources: [new FileContentProvider(configPackageDir)],
247
- outputs: this.outputs,
248
248
  properties: {
249
249
  name: `named-${name}`,
250
250
  description: `named definitions for ${names}`,
@@ -293,9 +293,18 @@ 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;
305
+ packageData.sources = [
306
+ new FileContentProvider(zonesPackageDir, ...filePermissions)
307
+ ];
299
308
  packageData.properties = {
300
309
  name: `named-zones-${name}`,
301
310
  description: `zone definitions for ${names}`,
@@ -304,28 +313,14 @@ export class BindService extends ExtraSourceService {
304
313
  hooks: {}
305
314
  };
306
315
 
307
- const filePermissions = [
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);
316
+ yield this.generateZoneDefs(sources, packageData);
325
317
 
326
318
  const outfacingZonesPackageDir = join(dir, "outfacingZones") + "/";
327
319
 
328
320
  packageData.dir = outfacingZonesPackageDir;
321
+ packageData.sources = [
322
+ new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
323
+ ];
329
324
  packageData.properties = {
330
325
  name: `named-zones-${name}-outfacing`,
331
326
  description: `outfacing zone definitions for ${names}`,
@@ -333,11 +328,7 @@ export class BindService extends ExtraSourceService {
333
328
  hooks: {}
334
329
  };
335
330
 
336
- packageData.sources = [
337
- new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
338
- ];
339
-
340
- yield* this.generateOutfacingDefs(zoneSources, packageData);
331
+ yield* this.generateOutfacingDefs(sources, packageData);
341
332
  }
342
333
 
343
334
  async *generateOutfacingDefs(sources, packageData) {
@@ -368,18 +359,18 @@ export class BindService extends ExtraSourceService {
368
359
  }
369
360
  }
370
361
 
371
- async generateZoneDefs(zoneSources, packageData) {
362
+ async generateZoneDefs(sources, packageData) {
372
363
  const configs = [];
373
364
 
374
- for (const zoneSource of zoneSources) {
365
+ for (const source of sources) {
375
366
  console.log(
376
- "SOURCE",
377
- zoneSource.toString(),
378
- [...zoneSource.localDomains].join(" ")
367
+ "ZONE",
368
+ source.toString(),
369
+ [...source.localDomains].join(" ")
379
370
  );
380
371
 
381
- for (const domain of zoneSource.localDomains) {
382
- const locationName = zoneSource.location.name;
372
+ for (const domain of source.localDomains) {
373
+ const locationName = source.location.name;
383
374
  const reverseZones = new Map();
384
375
 
385
376
  const config = {
@@ -432,7 +423,7 @@ export class BindService extends ExtraSourceService {
432
423
  networkInterface,
433
424
  domainNames,
434
425
  family
435
- } of zoneSource.networkAddresses()) {
426
+ } of source.networkAddresses()) {
436
427
  if (
437
428
  !this.exclude.has(networkInterface.network) &&
438
429
  !this.excludeInterfaceKinds.has(networkInterface.kind)
@@ -1314,7 +1314,27 @@ export class BindService extends ExtraSourceService {
1314
1314
  additionalValues?: object;
1315
1315
  };
1316
1316
  notify: import("pacc").AttributeDefinition;
1317
- recordTTL: import("pacc").AttributeDefinition;
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(zoneSources: any, packageData: any): Promise<any>;
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;