pmcf 6.10.4 → 6.11.0

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": "6.10.4",
3
+ "version": "6.11.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -93,22 +93,6 @@ export class CoreService extends Base {
93
93
  return `${this.fullName}(${this.type})`;
94
94
  }
95
95
 
96
- set systemUserName(value) {
97
- this._systemUserName = value;
98
- }
99
-
100
- get systemUserName() {
101
- return this.attribute("_systemUserName") ?? super.systemUserName;
102
- }
103
-
104
- set systemGroupName(value) {
105
- this._systemGroupName = value;
106
- }
107
-
108
- get systemGroupName() {
109
- return this.attribute("_systemGroupName") ?? super.systemGroupName;
110
- }
111
-
112
96
  get network() {
113
97
  return this.host.network;
114
98
  }
@@ -275,6 +259,30 @@ export class CoreService extends Base {
275
259
  );
276
260
  }
277
261
 
262
+ set systemUserName(value) {
263
+ this._systemUserName = value;
264
+ }
265
+
266
+ get systemUserName() {
267
+ return (
268
+ this.attribute("_systemUserName") ??
269
+ ServiceTypes[this.type]?.systemUserName ??
270
+ super.systemUserName
271
+ );
272
+ }
273
+
274
+ set systemGroupName(value) {
275
+ this._systemGroupName = value;
276
+ }
277
+
278
+ get systemGroupName() {
279
+ return (
280
+ this.attribute("_systemGroupName") ??
281
+ ServiceTypes[this.type]?.systemGroupName ??
282
+ super.systemGroupName
283
+ );
284
+ }
285
+
278
286
  get packageData() {
279
287
  const packageData = super.packageData;
280
288
  const name = `${this.owner.owner.name}-${this.owner.name}`;
@@ -122,9 +122,16 @@ class bind_group extends Base {
122
122
  hasCatalog = true;
123
123
  hasSVRRecords = true;
124
124
  hasLinkLocalAdresses = bind_group.attributes.hasLinkLocalAdresses.default;
125
-
126
125
  recordTTL = "1W";
127
126
 
127
+ get type() {
128
+ if (this.entries.length > 0 || this.sharedWith) {
129
+ return "view";
130
+ }
131
+
132
+ return "unknown";
133
+ }
134
+
128
135
  get service() {
129
136
  return this.owner;
130
137
  }
@@ -157,9 +164,28 @@ class bind_group extends Base {
157
164
 
158
165
  async packageContent(outputControl) {
159
166
  return (
160
- (await this.generateACLs(outputControl)) &&
161
- (await this.generateZoneDefs(outputControl, this.entries))
162
- );
167
+ await Promise.all([
168
+ this.generateACLs(outputControl),
169
+ this.generateTypeDefinition(outputControl),
170
+ this.generateZoneDefs(outputControl, this.entries)
171
+ ])
172
+ ).find(r => r)
173
+ ? true
174
+ : false;
175
+ }
176
+
177
+ async generateTypeDefinition(outputControl) {
178
+ if (this.type === "view") {
179
+ await writeLines(
180
+ join(outputControl.dir, "etc/named/views"),
181
+ `gen-${this.name}.conf`,
182
+ [
183
+ `view ${this.name} {`,
184
+ `include "/etc/named/views/${this.name}/*.conf";`,
185
+ "};"
186
+ ]
187
+ );
188
+ }
163
189
  }
164
190
 
165
191
  async generateACLs(outputControl) {
@@ -439,8 +465,10 @@ export class bind extends ExtraSourceService {
439
465
  }
440
466
  };
441
467
  static service = {
442
- systemdService: "bind.service",
443
468
  extends: ["dns"],
469
+ systemdService: "named.service",
470
+ systemUserName: "named",
471
+ systemGroupName: "named",
444
472
  services: {
445
473
  "bind-statistics": {
446
474
  endpoints: [
@@ -486,14 +514,6 @@ export class bind extends ExtraSourceService {
486
514
  return this.primaries ? "secondary" : "primary";
487
515
  }
488
516
 
489
- get systemUserName() {
490
- return "named";
491
- }
492
-
493
- get systemGroupName() {
494
- return "named";
495
- }
496
-
497
517
  async writeForwarders(outputControl) {
498
518
  const forwarders = serviceEndpoints(this.source, {
499
519
  services: "services[types[dns] && priority>=100 && priority<200]",
@@ -542,58 +562,6 @@ export class bind extends ExtraSourceService {
542
562
  console.log(packageData);
543
563
  yield packageData;
544
564
  }
545
-
546
- /*
547
- const sources = this.zones.length ? this.zones : [this.owner];
548
- const names = sources.map(a => a.fullName).join(" ");
549
- const name = this.owner.owner.name || this.owner.name;
550
-
551
- Object.assign(packageData.properties, {
552
- name: `named-${name}`,
553
- description: `named definitions for ${names}`
554
- });
555
-
556
- const ownerAndGroup = { owner: "named", group: "named" };
557
- const filePermissions = [
558
- { ...ownerAndGroup, mode: 0o644 },
559
- { ...ownerAndGroup, mode: 0o755 }
560
- ];
561
-
562
- const zonesPackageDir = join(dir, "zones") + "/";
563
-
564
- packageData.sources = [
565
- new FileContentProvider(zonesPackageDir, ...filePermissions)
566
- ];
567
- packageData.properties = {
568
- name: `named-zones-${name}`,
569
- description: `zone definitions for ${names}`,
570
- dependencies: ["mf-named"],
571
- access: "private"
572
- };
573
-
574
- yield this.generateZoneDefs(
575
- newOutputControl(packageData, zonesPackageDir),
576
- sources
577
- );
578
-
579
- const location = "outfacing";
580
-
581
- const outfacingZonesPackageDir = join(dir, location) + "/";
582
-
583
- packageData.sources = [
584
- new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
585
- ];
586
- packageData.properties = {
587
- name: `named-zones-${name}-${location}`,
588
- description: `${location} zone definitions for ${names}`,
589
- access: "private"
590
- };
591
-
592
- yield* this.generateOutfacingDefs(
593
- newOutputControl(packageData, outfacingZonesPackageDir),
594
- sources
595
- );
596
- */
597
565
  }
598
566
 
599
567
  async *generateOutfacingDefs(outputControl, sources) {