pmcf 6.52.1 → 6.53.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.52.1",
3
+ "version": "6.53.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/content.mjs CHANGED
@@ -37,6 +37,10 @@ export class content extends core {
37
37
  static attributes = {
38
38
  name: { ...name_attribute_writable, packagingProperty: true },
39
39
  description: { ...description_attribute_writable, packagingProperty: true },
40
+ fragments: {
41
+ ...string_set_attribute_writable,
42
+ name: "fragments"
43
+ },
40
44
  permissions: {
41
45
  ...default_collection_attribute_writable,
42
46
  type: permission,
@@ -90,6 +94,7 @@ export class content extends core {
90
94
  addType(this);
91
95
  }
92
96
 
97
+ _fragments = new Set();
93
98
  _permissions = new Map();
94
99
  _packaging = new Set();
95
100
  _provides = new Set();
@@ -256,8 +261,19 @@ export class content extends core {
256
261
  }
257
262
  }
258
263
 
264
+ set fragments(value) {
265
+ this._fragments = union(value, this._fragments);
266
+ }
267
+
268
+ get fragments() {
269
+ return this.expand(
270
+ this.unionFromDirections(["this", "extends"], "_fragments")
271
+ );
272
+ }
273
+
259
274
  async preparePackage() {
260
275
  const packageData = {
276
+ fragments: this.fragments,
261
277
  sources: [],
262
278
  outputs: this.outputs,
263
279
  properties: Object.fromEntries(
@@ -265,7 +281,8 @@ export class content extends core {
265
281
  this.constructor,
266
282
  attribute => attribute.packagingProperty
267
283
  ).map(([path, attribute]) => [path[0], this[path[0]]])
268
- )
284
+ ),
285
+ dir: () => this.sources?.[0].dir
269
286
  };
270
287
 
271
288
  await this.loadHooks(packageData);
@@ -248,7 +248,7 @@ export class bind_key extends base {
248
248
  `${this.name}.conf`,
249
249
  [
250
250
  `key "${this.name}" {`,
251
- ` # ` + asArray(this.tags).join(','),
251
+ ` # ` + asArray(this.tags).join(","),
252
252
  ` algorithm ${this.algorithm};`,
253
253
  ` secret "${this.secret}";`,
254
254
  "};"
@@ -369,7 +369,6 @@ class bind_view extends bind_object {
369
369
  name: "sharedWith",
370
370
  type: bind_view
371
371
  },
372
-
373
372
  matchClients: {
374
373
  ...acl_attribute,
375
374
  name: "matchClients"
@@ -697,19 +696,21 @@ class bind_view extends bind_object {
697
696
  ...(await Array.fromAsync(this.templateContent(this.service.content)))
698
697
  );
699
698
 
700
- for (const config of this.zoneConfigs.values()) {
701
- await config.write(outputControl.dir);
702
- }
699
+ if (outputControl.packageData.fragments.has("zones")) {
700
+ for (const config of this.zoneConfigs.values()) {
701
+ await config.write(outputControl.dir);
702
+ }
703
703
 
704
- if (this.foreignDomains.size) {
705
- addHook(
706
- outputControl.packageData,
707
- "post_upgrade",
708
- `/usr/bin/named-hostname-update ${[...this.foreignDomains].join(" ")}`
709
- );
710
- }
704
+ if (this.foreignDomains.size) {
705
+ addHook(
706
+ outputControl.packageData,
707
+ "post_upgrade",
708
+ `/usr/bin/named-hostname-update ${[...this.foreignDomains].join(" ")}`
709
+ );
710
+ }
711
711
 
712
- return outputControl.packageData;
712
+ return outputControl.packageData;
713
+ }
713
714
  }
714
715
  }
715
716
 
@@ -865,6 +866,7 @@ export class bind extends CoreService {
865
866
  `server ${service.address()} {`,
866
867
  " keys {" +
867
868
  asArray(service.keys.values())
869
+ .filter(key=>key.tags.has('server'))
868
870
  .map(key => ` ${key.name};`)
869
871
  .join("") +
870
872
  " };",
@@ -872,6 +874,7 @@ export class bind extends CoreService {
872
874
  ];
873
875
  })
874
876
  );
877
+ return true;
875
878
  }
876
879
 
877
880
  async *preparePackages(dir) {
@@ -885,27 +888,30 @@ export class bind extends CoreService {
885
888
 
886
889
  const outputControl = { packageData, dir };
887
890
 
888
- for (const key of this.keys.values()) {
889
- await key.packageContent(outputControl);
890
- hasContent = true;
891
- }
892
-
893
- for (const acl of this.acls.values()) {
894
- await acl.packageContent(outputControl);
895
- hasContent = true;
896
- }
897
-
898
891
  for (const view of this.views.values()) {
899
892
  const present = await view.packageContent(outputControl);
900
893
  hasContent ||= present;
901
894
  }
902
895
 
903
- let present;
904
- present = await this.writeServers(outputControl);
896
+ if (packageData.fragments.has("base")) {
897
+ for (const key of this.keys.values()) {
898
+ await key.packageContent(outputControl);
899
+ hasContent = true;
900
+ }
905
901
 
906
- present = await this.writeForwarders(outputControl);
902
+ for (const acl of this.acls.values()) {
903
+ await acl.packageContent(outputControl);
904
+ hasContent = true;
905
+ }
906
+
907
+ let present;
908
+ present = await this.writeForwarders(outputControl);
909
+ hasContent ||= present;
910
+ present = await this.writeServers(outputControl);
911
+ hasContent ||= present;
912
+ }
907
913
 
908
- if (hasContent || present) {
914
+ if (hasContent) {
909
915
  yield packageData;
910
916
  }
911
917
  }
@@ -104,6 +104,7 @@ export class kea extends CoreService {
104
104
  systemGroupName: "kea",
105
105
  services: {
106
106
  "kea-ddns": {
107
+ systemdService: "kea-dhcp-ddns.service",
107
108
  endpoints: [
108
109
  {
109
110
  family: FAMILY_IPV4,
@@ -358,7 +359,7 @@ export class kea extends CoreService {
358
359
  return {
359
360
  name: key.name,
360
361
  algorithm: key.algorithm,
361
- secret: key.secret
362
+ "secret-file": `/run/credentials/kea-dhcp-ddns.service/kea.${key.name}.tsig`
362
363
  };
363
364
  }),
364
365
  "forward-ddns": {