pmcf 6.9.0 → 6.10.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.9.0",
3
+ "version": "6.10.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/cluster.mjs CHANGED
@@ -64,7 +64,7 @@ export class Cluster extends Host {
64
64
  );
65
65
  packageData.properties.name = `keepalived-${name}`;
66
66
  packageData.properties.description = `${this.typeName} definitions for ${this.fullName}`;
67
- packageData.properties.groups.push("service-config", name, "keepalived");
67
+ packageData.properties.groups.push("config", name, "keepalived");
68
68
 
69
69
  const extra = [];
70
70
 
@@ -75,7 +75,9 @@ export class CoreService extends Base {
75
75
  alias: { ...string_attribute_writable, name: "alias" },
76
76
  priority: priority_attribute,
77
77
  weight: { ...number_attribute_writable, name: "weight" /*default: 1*/ },
78
- systemdService: { ...string_attribute_writable, name: "systemdService" }
78
+ systemdService: { ...string_attribute_writable, name: "systemdService" },
79
+ systemUserName: { ...string_attribute_writable, name: "systemUserName" },
80
+ systemGroupName: { ...string_attribute_writable, name: "systemGroupName" }
79
81
  };
80
82
 
81
83
  static {
@@ -91,6 +93,22 @@ export class CoreService extends Base {
91
93
  return `${this.fullName}(${this.type})`;
92
94
  }
93
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
+
94
112
  get network() {
95
113
  return this.host.network;
96
114
  }
@@ -262,7 +280,7 @@ export class CoreService extends Base {
262
280
  const name = `${this.owner.owner.name}-${this.owner.name}`;
263
281
  packageData.properties.name = `${this.name}-${name}`;
264
282
  packageData.properties.description = `${this.type} service definitions for ${this.fullName}`;
265
- packageData.properties.groups.push("service-config", name);
283
+ packageData.properties.groups.push("config", name);
266
284
  return packageData;
267
285
  }
268
286
 
@@ -156,12 +156,13 @@ class bind_group extends Base {
156
156
  }
157
157
 
158
158
  async packageContent(outputControl) {
159
- return await this.generateACLs(outputControl) && await this.generateZoneDefs(outputControl, this.entries);
159
+ return (
160
+ (await this.generateACLs(outputControl)) &&
161
+ (await this.generateZoneDefs(outputControl, this.entries))
162
+ );
160
163
  }
161
164
 
162
165
  async generateACLs(outputControl) {
163
- console.log("generateACLs", this.name);
164
-
165
166
  const acls = addressesStatement(
166
167
  `acl ${this.name}`,
167
168
  addresses(this.access, { aggregate: true })
@@ -181,8 +182,6 @@ class bind_group extends Base {
181
182
  }
182
183
 
183
184
  async generateZoneDefs(outputControl, sources) {
184
- console.log("generateZoneDefs", this.name);
185
-
186
185
  for (const source of sources) {
187
186
  console.log(
188
187
  "ZONE",
@@ -480,6 +479,14 @@ export class bind extends ExtraSourceService {
480
479
  return this.primaries ? "secondary" : "primary";
481
480
  }
482
481
 
482
+ get systemUserName() {
483
+ return "named";
484
+ }
485
+
486
+ get systemGroupName() {
487
+ return "named";
488
+ }
489
+
483
490
  async writeForwarders(outputControl) {
484
491
  const forwarders = serviceEndpoints(this.source, {
485
492
  services: "services[types[dns] && priority>=100 && priority<200]",
@@ -494,27 +501,38 @@ export class bind extends ExtraSourceService {
494
501
  `forwarders.conf`,
495
502
  addressesStatement("forwarders", forwarders)
496
503
  );
504
+
505
+ return true;
497
506
  }
498
507
 
499
- return forwarders.length > 0;
508
+ return false;
500
509
  }
501
510
 
502
511
  async *preparePackages(dir) {
512
+ const permissions = this.packageContentPermissions;
503
513
  const packageData = this.packageData;
504
- packageData.sources.push(new FileContentProvider(dir));
505
514
 
506
- const outputControl = newOutputControl(packageData, dir);
515
+ packageData.sources = await Array.fromAsync(
516
+ this.templateContent(...permissions)
517
+ );
507
518
 
508
- let hasContent = false;
519
+ let hasContent = packageData.sources.length > 0;
520
+
521
+ packageData.sources.push(
522
+ new FileContentProvider(dir + "/", ...permissions)
523
+ );
524
+
525
+ const outputControl = newOutputControl(packageData, dir);
509
526
 
510
527
  for (const group of this.groups.values()) {
511
528
  const present = await group.packageContent(outputControl);
512
529
  hasContent ||= present;
513
530
  }
514
531
 
515
- hasContent ||= await this.writeForwarders(outputControl);
532
+ const present = await this.writeForwarders(outputControl);
516
533
 
517
- if (hasContent) {
534
+ if (hasContent || present) {
535
+ console.log(packageData);
518
536
  yield packageData;
519
537
  }
520
538