pmcf 4.11.1 → 4.12.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "4.11.1",
3
+ "version": "4.12.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/dns-utils.mjs CHANGED
@@ -20,9 +20,14 @@ export function sortZoneRecords(a, b) {
20
20
  return order;
21
21
  }
22
22
 
23
- if (a.type === "PTR") {
24
- const toNum = a => {
25
- const s = a.split(".");
23
+ if (
24
+ a.type === "PTR" &&
25
+ b.type === "PTR" &&
26
+ a.key.indexOf(".arpa") > 0 &&
27
+ b.key.indexOf(".arpa") > 0
28
+ ) {
29
+ const toNum = key => {
30
+ const s = key.split(".");
26
31
  s.pop();
27
32
  s.pop();
28
33
  s.pop();
@@ -308,34 +308,37 @@ export class BindService extends ExtraSourceService {
308
308
  name: `named-zones-${name}`,
309
309
  description: `zone definitions for ${names}`,
310
310
  dependencies: ["mf-named"],
311
- access: "private",
312
- hooks: {}
311
+ access: "private"
313
312
  };
314
313
 
315
314
  yield this.generateZoneDefs(sources, packageData);
316
315
 
317
- const outfacingZonesPackageDir = join(dir, "outfacingZones") + "/";
316
+ const location = "outfacing";
317
+
318
+ const outfacingZonesPackageDir = join(dir, location) + "/";
318
319
 
319
320
  packageData.dir = outfacingZonesPackageDir;
320
321
  packageData.sources = [
321
322
  new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
322
323
  ];
323
324
  packageData.properties = {
324
- name: `named-zones-${name}-outfacing`,
325
- description: `outfacing zone definitions for ${names}`,
325
+ name: `named-zones-${name}-${location}`,
326
+ description: `${location} zone definitions for ${names}`,
326
327
  access: "private"
327
328
  };
328
329
 
329
- yield* this.generateOutfacingDefs(sources, packageData);
330
+ yield* this.generateOutfacingDefs(sources, packageData, location);
330
331
  }
331
332
 
332
- async *generateOutfacingDefs(sources, packageData) {
333
+ async *generateOutfacingDefs(sources, packageData, location) {
333
334
  const configs = [];
334
335
 
336
+ const view = this.views.internal;
337
+
335
338
  for (const source of sources) {
336
339
  for (const host of source.hosts()) {
337
340
  configs.push(
338
- ...this.outfacingZones(host, this.views.internal, this.defaultRecords)
341
+ ...this.outfacingZones(host, view, this.defaultRecords)
339
342
  );
340
343
  }
341
344
  }
@@ -343,6 +346,12 @@ export class BindService extends ExtraSourceService {
343
346
  const outfacingZones = configs.map(c => c.zones).flat();
344
347
 
345
348
  if (outfacingZones.length) {
349
+ if (this.hasCatalog) {
350
+ const { catalogZone, config } = this.createCatalogZone(location, view, location);
351
+ configs.push(config);
352
+ outfacingZones.forEach(zone=>zone.catalogZone=catalogZone);
353
+ }
354
+
346
355
  addHook(
347
356
  packageData,
348
357
  "post_upgrade",
@@ -357,9 +366,33 @@ export class BindService extends ExtraSourceService {
357
366
  }
358
367
  }
359
368
 
369
+ createCatalogZone(name, view, directory) {
370
+ const config = {
371
+ view,
372
+ name: `catalog.${name}.zone.conf`,
373
+ type: "master",
374
+ zones: []
375
+ };
376
+
377
+ const catalogZone = {
378
+ catalog: true,
379
+ id: `catalog.${name}`,
380
+ file: `${directory}/catalog.${name}.zone`,
381
+ records: new Set([
382
+ ...this.defaultRecords,
383
+ DNSRecord(dnsFullName(`version.catalog.${name}`), "TXT", '"1"')
384
+ ])
385
+ };
386
+ config.zones.push(catalogZone);
387
+
388
+ return { config, catalogZone };
389
+ }
390
+
360
391
  async generateZoneDefs(sources, packageData) {
361
392
  const configs = [];
362
393
 
394
+ const view = this.views.internal;
395
+
363
396
  for (const source of sources) {
364
397
  console.log(
365
398
  "ZONE",
@@ -372,7 +405,7 @@ export class BindService extends ExtraSourceService {
372
405
  const reverseZones = new Map();
373
406
 
374
407
  const config = {
375
- view: this.views.internal,
408
+ view,
376
409
  name: `${domain}.zone.conf`,
377
410
  type: "master",
378
411
  zones: []
@@ -392,24 +425,9 @@ export class BindService extends ExtraSourceService {
392
425
  config.zones.push(zone);
393
426
 
394
427
  if (this.hasCatalog) {
395
- const catalogConfig = {
396
- view: this.views.internal,
397
- name: `catalog.${domain}.zone.conf`,
398
- type: "master",
399
- zones: []
400
- };
401
- configs.push(catalogConfig);
402
-
403
- zone.catalogZone = {
404
- catalog: true,
405
- id: `catalog.${domain}`,
406
- file: `${locationName}/catalog.${domain}.zone`,
407
- records: new Set([
408
- ...this.defaultRecords,
409
- DNSRecord(dnsFullName(`version.catalog.${domain}`), "TXT", '"1"')
410
- ])
411
- };
412
- catalogConfig.zones.push(zone.catalogZone);
428
+ const { catalogZone, config } = this.createCatalogZone(domain, view, locationName);
429
+ configs.push(config);
430
+ zone.catalogZone = catalogZone;
413
431
  }
414
432
 
415
433
  const hosts = new Set();
@@ -457,7 +475,6 @@ export class BindService extends ExtraSourceService {
457
475
 
458
476
  for (const domainName of domainNames) {
459
477
  if (domainName.endsWith(zone.id) && domainName[0] !== "*") {
460
-
461
478
  zone.records.add(
462
479
  DNSRecord(
463
480
  dnsFullName(domainName),
@@ -9,14 +9,6 @@ const MosquittoServiceTypeDefinition = {
9
9
  owners: ServiceTypeDefinition.owners,
10
10
  key: "name",
11
11
  attributes: {
12
- /*log_timestamp: {
13
- ...boolean_attribute_writable_true,
14
- configurable: true
15
- },
16
- allow_anonymous: {
17
- ...boolean_attribute_writable_true,
18
- configurable: true
19
- },*/
20
12
  listener: {
21
13
  ...port_attribute,
22
14
  writable: true,
@@ -1479,7 +1479,26 @@ export class BindService extends ExtraSourceService {
1479
1479
  set excludeInterfaceKinds(value: Set<any>);
1480
1480
  get excludeInterfaceKinds(): Set<any>;
1481
1481
  preparePackages(dir: any): AsyncGenerator<any, void, unknown>;
1482
- generateOutfacingDefs(sources: any, packageData: any): AsyncGenerator<any, void, unknown>;
1482
+ generateOutfacingDefs(sources: any, packageData: any, location: any): AsyncGenerator<any, void, unknown>;
1483
+ createCatalogZone(name: any, view: any, directory: any): {
1484
+ config: {
1485
+ view: any;
1486
+ name: string;
1487
+ type: string;
1488
+ zones: any[];
1489
+ };
1490
+ catalogZone: {
1491
+ catalog: boolean;
1492
+ id: string;
1493
+ file: string;
1494
+ records: Set<{
1495
+ type: any;
1496
+ key: any;
1497
+ values: any[];
1498
+ toString: (maxKeyLength?: number, ttl?: string) => string;
1499
+ }>;
1500
+ };
1501
+ };
1483
1502
  generateZoneDefs(sources: any, packageData: any): Promise<any>;
1484
1503
  outfacingZones(host: any, view: any, records: any): any;
1485
1504
  get defaultRecords(): {