pmcf 2.43.0 → 2.45.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": "2.43.0",
3
+ "version": "2.45.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -16,10 +16,10 @@
16
16
  "config management",
17
17
  "dhcp",
18
18
  "dns",
19
+ "iwd",
19
20
  "kea",
20
21
  "keepalived",
21
- "systemd",
22
- "iwd"
22
+ "systemd"
23
23
  ],
24
24
  "contributors": [
25
25
  {
package/src/cluster.mjs CHANGED
@@ -86,12 +86,13 @@ export class Cluster extends Host {
86
86
  }
87
87
  };
88
88
 
89
+
89
90
  const cfg = [
90
91
  "global_defs {",
91
92
  " notification_email {",
92
93
  " " + this.administratorEmail,
93
94
  " }",
94
- ` smtp_server ${this.smtp.address}`,
95
+ ` smtp_server ${this.smtp.address()}`,
95
96
  ` notification_email_from keepalived@${host.domainName}`,
96
97
  " enable_script_security",
97
98
  " script_user root",
package/src/service.mjs CHANGED
@@ -184,10 +184,6 @@ export class Service extends Base {
184
184
  return this.host.domainName;
185
185
  }
186
186
 
187
- get ipAddressOrDomainName() {
188
- return this.address ?? this.domainName;
189
- }
190
-
191
187
  get networks() {
192
188
  return this.host.networks;
193
189
  }
@@ -209,6 +205,24 @@ export class Service extends Base {
209
205
  return filter ? result.filter(filter) : result;
210
206
  }
211
207
 
208
+ address(
209
+ options = {
210
+ endpoints: e => e.networkInterface?.kind !== "loopbak",
211
+ select: e => e.domainName||e.address,
212
+ limit: 1,
213
+ join: ""
214
+ }
215
+ ) {
216
+ const all = this.endpoints(options.endpoints);
217
+ const res = [...new Set(options.select ? all.map(options.select) : all)];
218
+
219
+ if (options.limit < res.length) {
220
+ res.length = options.limit;
221
+ }
222
+
223
+ return options.join !== undefined ? res.join(options.join) : res;
224
+ }
225
+
212
226
  set alias(value) {
213
227
  this._alias = value;
214
228
  }
@@ -527,20 +527,19 @@ export class BINDService extends ExtraSourceService {
527
527
 
528
528
  get defaultRecords() {
529
529
  const nameService = this.findService({ type: "dns", priority: "<10" });
530
- const rname = this.administratorEmail.replace(/@/, ".");
531
530
 
532
531
  const SOARecord = DNSRecord(
533
532
  "@",
534
533
  "SOA",
535
534
  dnsFullName(nameService.domainName),
536
- dnsFullName(rname),
535
+ dnsFullName(this.administratorEmail.replace(/@/, ".")),
537
536
  `(${[...this.soaUpdates].join(" ")})`
538
537
  );
539
538
 
540
539
  const NSRecord = DNSRecord(
541
540
  "@",
542
541
  "NS",
543
- dnsFullName(nameService.ipAddressOrDomainName)
542
+ dnsFullName(nameService.address())
544
543
  );
545
544
 
546
545
  return [SOARecord, NSRecord];
@@ -313,9 +313,14 @@ export class Service extends Base {
313
313
  get host(): Host;
314
314
  hosts(): Generator<any, void, any>;
315
315
  get domainName(): any;
316
- get ipAddressOrDomainName(): any;
317
316
  get networks(): Set<any>;
318
317
  endpoints(filter: any): any[];
318
+ address(options?: {
319
+ endpoints: (e: any) => boolean;
320
+ select: (e: any) => any;
321
+ limit: number;
322
+ join: string;
323
+ }): string | any[];
319
324
  set alias(value: any);
320
325
  get alias(): any;
321
326
  set port(value: any);