pmcf 2.42.0 → 2.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 +3 -3
- package/src/cluster.mjs +2 -1
- package/src/host.mjs +24 -5
- package/src/service.mjs +11 -0
- package/types/host.d.mts +1 -0
- package/types/service.d.mts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.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/host.mjs
CHANGED
|
@@ -119,6 +119,8 @@ export class Host extends ServiceOwner {
|
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
121
|
}
|
|
122
|
+
|
|
123
|
+
this.extra = data.extra;
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
_applyExtends(host) {
|
|
@@ -451,7 +453,7 @@ export class Host extends ServiceOwner {
|
|
|
451
453
|
}
|
|
452
454
|
|
|
453
455
|
async *preparePackages(dir) {
|
|
454
|
-
|
|
456
|
+
let packageData = {
|
|
455
457
|
dir,
|
|
456
458
|
sources: [
|
|
457
459
|
new FileContentProvider(
|
|
@@ -462,8 +464,7 @@ export class Host extends ServiceOwner {
|
|
|
462
464
|
{ base: this.directory, pattern: "*_key" },
|
|
463
465
|
{ destination: "/etc/ssh/", mode: 0o600 }
|
|
464
466
|
),
|
|
465
|
-
new FileContentProvider(dir + "/")
|
|
466
|
-
new FileContentProvider(join(this.directory, "extra") + "/")
|
|
467
|
+
new FileContentProvider(dir + "/")
|
|
467
468
|
],
|
|
468
469
|
outputs: this.outputs,
|
|
469
470
|
properties: {
|
|
@@ -493,8 +494,10 @@ export class Host extends ServiceOwner {
|
|
|
493
494
|
await generateKnownHosts(this.owner.hosts(), join(dir, "root", ".ssh"));
|
|
494
495
|
|
|
495
496
|
for (const service of this.services) {
|
|
496
|
-
if (service.systemdConfig) {
|
|
497
|
-
const { serviceName, configFileName, content } = service.systemdConfig(
|
|
497
|
+
if (service.systemdConfig) {
|
|
498
|
+
const { serviceName, configFileName, content } = service.systemdConfig(
|
|
499
|
+
this.name
|
|
500
|
+
);
|
|
498
501
|
await writeLines(dir, configFileName, sectionLines(...content));
|
|
499
502
|
|
|
500
503
|
addHook(
|
|
@@ -506,5 +509,21 @@ export class Host extends ServiceOwner {
|
|
|
506
509
|
}
|
|
507
510
|
|
|
508
511
|
yield packageData;
|
|
512
|
+
|
|
513
|
+
if (this.extra) {
|
|
514
|
+
packageData = {
|
|
515
|
+
dir,
|
|
516
|
+
sources: [new FileContentProvider(join(this.directory, "extra") + "/")],
|
|
517
|
+
outputs: this.outputs,
|
|
518
|
+
properties: {
|
|
519
|
+
name: `${this.typeName}-extra-${this.owner.name}-${this.name}`,
|
|
520
|
+
description: `additional files for ${this.fullName}`,
|
|
521
|
+
access: "private",
|
|
522
|
+
dependencies: [`${this.typeName}-${this.owner.name}-${this.name}`]
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
yield packageData;
|
|
527
|
+
}
|
|
509
528
|
}
|
|
510
529
|
}
|
package/src/service.mjs
CHANGED
|
@@ -209,6 +209,17 @@ export class Service extends Base {
|
|
|
209
209
|
return filter ? result.filter(filter) : result;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
+
address(options = { select: e => e.address, limit: 1 }) {
|
|
213
|
+
const all = this.endpoints(options.endpoints);
|
|
214
|
+
const res = [...new Set(options.select ? all.map(options.select) : all)];
|
|
215
|
+
|
|
216
|
+
if (options.limit < res.length) {
|
|
217
|
+
res.length = options.limit;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return options.join ? res.join(options.join) : res;
|
|
221
|
+
}
|
|
222
|
+
|
|
212
223
|
set alias(value) {
|
|
213
224
|
this._alias = value;
|
|
214
225
|
}
|
package/types/host.d.mts
CHANGED
package/types/service.d.mts
CHANGED
|
@@ -316,6 +316,10 @@ export class Service extends Base {
|
|
|
316
316
|
get ipAddressOrDomainName(): any;
|
|
317
317
|
get networks(): Set<any>;
|
|
318
318
|
endpoints(filter: any): any[];
|
|
319
|
+
address(options?: {
|
|
320
|
+
select: (e: any) => any;
|
|
321
|
+
limit: number;
|
|
322
|
+
}): string | any[];
|
|
319
323
|
set alias(value: any);
|
|
320
324
|
get alias(): any;
|
|
321
325
|
set port(value: any);
|