pmcf 6.43.0 → 6.44.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.43.0",
3
+ "version": "6.44.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/content.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import path, { join } from "node:path";
1
+ import { join } from "node:path";
2
2
  import {
3
3
  name_attribute_writable,
4
4
  string_attribute_writable,
@@ -8,7 +8,8 @@ import {
8
8
  extendingAttributeIterator
9
9
  } from "pacc";
10
10
  import { allOutputs } from "npm-pkgbuild";
11
- import { core, addType } from "pmcf";
11
+ import { core } from "./core.mjs";
12
+ import { addType } from "./type.mjs";
12
13
  import { union } from "./utils.mjs";
13
14
  import { loadHooks } from "./hooks.mjs";
14
15
 
@@ -236,7 +237,9 @@ export class content extends core {
236
237
  }
237
238
 
238
239
  get permissions() {
239
- return this.expand(this.mapFromDirections(["this", "extends"], "_permissions"));
240
+ return this.expand(
241
+ this.mapFromDirections(["this", "extends"], "_permissions")
242
+ );
240
243
  }
241
244
 
242
245
  /**
package/src/core.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  expand,
9
9
  globals
10
10
  } from "pacc";
11
- import { addType } from "pmcf";
11
+ import { addType } from "./type.mjs";
12
12
 
13
13
  export class core {
14
14
  static priority = 1;
@@ -8,7 +8,6 @@ import {
8
8
  ADDRESS_TYPE_LOOPBACK
9
9
  } from "ip-utilties";
10
10
  import {
11
- name_attribute,
12
11
  string_attribute_writable,
13
12
  string_collection_attribute_writable,
14
13
  number_attribute_writable,
@@ -48,6 +47,12 @@ export class kea extends CoreService {
48
47
  type: kea_subnet,
49
48
  name: "subnets"
50
49
  },
50
+ peers: {
51
+ ...default_collection_attribute_writable,
52
+ type: CoreService,
53
+ name: "peers",
54
+ deferredExpression: true
55
+ },
51
56
  dnsServerEndpoints: {
52
57
  ...default_collection_attribute_writable,
53
58
  type: Endpoint,
@@ -183,27 +188,6 @@ export class kea extends CoreService {
183
188
  })
184
189
  );
185
190
 
186
- const peers = async family =>
187
- Array.from(
188
- source.expression(
189
- `services[types[kea] && priority>=${Math.min(this.priority, 100)}]`
190
- )
191
- )
192
- .sort(sortDescendingByPriority)
193
- .map((dhcp, i) => {
194
- const ctrlAgentEndpoint = dhcp.endpoint(`kea-ha-${family}`);
195
-
196
- if (ctrlAgentEndpoint) {
197
- return {
198
- name: dhcp.host.name,
199
- role: i === 0 ? "primary" : i > 1 ? "backup" : "standby",
200
- url: ctrlAgentEndpoint.url,
201
- "auto-failover": i <= 1
202
- };
203
- }
204
- })
205
- .filter(p => p != null);
206
-
207
191
  const loggers = [
208
192
  {
209
193
  "output-options": [
@@ -216,7 +200,9 @@ export class kea extends CoreService {
216
200
  }
217
201
  ];
218
202
 
219
- const commonConfig = async family => {
203
+ const peers = this.peers;
204
+
205
+ const commonConfig = family => {
220
206
  const cfg = {
221
207
  "interfaces-config": {
222
208
  interfaces: listenInterfaces(`IPv${family}`)
@@ -263,7 +249,24 @@ export class kea extends CoreService {
263
249
  "http-listener-threads": 2,
264
250
  "http-client-threads": 2
265
251
  },*/
266
- peers: await peers(family)
252
+ peers: peers
253
+ .sort(sortDescendingByPriority)
254
+ .reduce((a, kea) => {
255
+ const ctrlAgentEndpoint = kea.endpoint(
256
+ `kea-ha-${family}`
257
+ );
258
+ if (ctrlAgentEndpoint) {
259
+ const i = a.length;
260
+ a.push({
261
+ name: kea.host.name,
262
+ role:
263
+ i === 0 ? "primary" : i > 1 ? "backup" : "standby",
264
+ url: ctrlAgentEndpoint.url,
265
+ "auto-failover": i <= 1
266
+ });
267
+ }
268
+ return a;
269
+ }, [])
267
270
  }
268
271
  ]
269
272
  }
@@ -417,18 +420,16 @@ export class kea extends CoreService {
417
420
  endpoint => `${endpoint.networkInterface.name}/${endpoint.address}`
418
421
  );
419
422
 
420
- const pools = subnet => [{ pool: subnet.pool.join(" - ") }];
421
-
422
423
  const dhcp4 = {
423
424
  Dhcp4: {
424
- ...(await commonConfig("4")),
425
+ ...commonConfig("4"),
425
426
  subnet4: subnets
426
427
  .filter(s => s.family === FAMILY_IPV4)
427
428
  .map((subnet, index) => {
428
429
  return {
429
430
  id: index + 1,
430
431
  subnet: subnet.longAddress,
431
- pools: pools(subnet),
432
+ pools: [{ pool: subnet.pool.join(" - ") }],
432
433
  reservations: reservations(subnet, "4"),
433
434
  "option-data": [
434
435
  {
@@ -442,14 +443,14 @@ export class kea extends CoreService {
442
443
  };
443
444
  const dhcp6 = {
444
445
  Dhcp6: {
445
- ...(await commonConfig("6")),
446
+ ...commonConfig("6"),
446
447
  subnet6: subnets
447
448
  .filter(s => s.family === FAMILY_IPV6)
448
449
  .map((subnet, index) => {
449
450
  return {
450
451
  id: index + 1,
451
452
  subnet: subnet.longAddress,
452
- pools: pools(subnet),
453
+ pools: [{ pool: subnet.pool.join(" - ") }],
453
454
  reservations: reservations(subnet, "6")
454
455
  };
455
456
  })