pmcf 6.46.12 → 6.47.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 +1 -1
- package/src/base.mjs +30 -11
- package/src/cluster.mjs +3 -14
- package/src/content.mjs +1 -1
- package/src/host.mjs +1 -11
- package/src/services/bind.mjs +7 -16
- package/src/services/chrony.mjs +1 -13
- package/src/services/influxdb.mjs +1 -11
- package/src/services/kea.mjs +1 -13
- package/src/services/mosquitto.mjs +1 -11
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -225,17 +225,36 @@ export class base extends core {
|
|
|
225
225
|
return this._content;
|
|
226
226
|
}
|
|
227
227
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
async preparePackage(options) {
|
|
229
|
+
const content = this.content;
|
|
230
|
+
if (content) {
|
|
231
|
+
const pd = await content.preparePackage();
|
|
232
|
+
|
|
233
|
+
pd.sources.push(
|
|
234
|
+
...(await Array.fromAsync(this.templateContent(content)))
|
|
235
|
+
);
|
|
236
|
+
|
|
237
|
+
switch (typeof options) {
|
|
238
|
+
case "string":
|
|
239
|
+
options = { dir: options };
|
|
240
|
+
case "object":
|
|
241
|
+
pd.sources.push(
|
|
242
|
+
new FileContentProvider({
|
|
243
|
+
pattern: ["**/*"],
|
|
244
|
+
permissions: content.permissions,
|
|
245
|
+
...options
|
|
246
|
+
})
|
|
247
|
+
);
|
|
248
|
+
}
|
|
234
249
|
|
|
235
|
-
|
|
250
|
+
return pd;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
236
253
|
|
|
237
|
-
|
|
238
|
-
|
|
254
|
+
async *preparePackages(dir) {
|
|
255
|
+
const packageData = await this.preparePackage(dir);
|
|
256
|
+
if (packageData) {
|
|
257
|
+
yield packageData;
|
|
239
258
|
}
|
|
240
259
|
}
|
|
241
260
|
|
|
@@ -258,7 +277,7 @@ export class base extends core {
|
|
|
258
277
|
*
|
|
259
278
|
* @returns {AsyncIterable<ContentProvider>}
|
|
260
279
|
*/
|
|
261
|
-
async *templateContent() {
|
|
280
|
+
async *templateContent(content) {
|
|
262
281
|
for (const node of this.walkDirections(["this", "extends"])) {
|
|
263
282
|
const dir = join(node.directory, "content");
|
|
264
283
|
|
|
@@ -268,7 +287,7 @@ export class base extends core {
|
|
|
268
287
|
new FileContentProvider({
|
|
269
288
|
dir,
|
|
270
289
|
pattern: "**/*",
|
|
271
|
-
permissions:
|
|
290
|
+
permissions: content.permissions
|
|
272
291
|
}),
|
|
273
292
|
this.templateTransformers
|
|
274
293
|
);
|
package/src/cluster.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
2
|
import { FAMILY_IPV4 } from "ip-utilties";
|
|
4
3
|
import { duration_attribute_writable } from "pacc";
|
|
5
4
|
import { host } from "./host.mjs";
|
|
@@ -46,11 +45,10 @@ export class cluster extends host {
|
|
|
46
45
|
return new Set(this.masters).union(new Set(this.backups));
|
|
47
46
|
}
|
|
48
47
|
|
|
49
|
-
get isCluster()
|
|
50
|
-
{
|
|
48
|
+
get isCluster() {
|
|
51
49
|
return true;
|
|
52
50
|
}
|
|
53
|
-
|
|
51
|
+
|
|
54
52
|
isMember(host) {
|
|
55
53
|
return super.isMember(host) || this.hosts.get(host.name) === host;
|
|
56
54
|
}
|
|
@@ -71,16 +69,7 @@ export class cluster extends host {
|
|
|
71
69
|
const host = ni.host;
|
|
72
70
|
|
|
73
71
|
const packageStagingDir = join(stagingDir, host.name);
|
|
74
|
-
const packageData = await host.
|
|
75
|
-
|
|
76
|
-
packageData.sources.push(
|
|
77
|
-
...(await Array.fromAsync(this.templateContent())),
|
|
78
|
-
new FileContentProvider({
|
|
79
|
-
dir: packageStagingDir,
|
|
80
|
-
pattern: "**/*",
|
|
81
|
-
permissions: this.content.permissions
|
|
82
|
-
})
|
|
83
|
-
);
|
|
72
|
+
const packageData = await host.preparePackage({ dir: packageStagingDir });
|
|
84
73
|
|
|
85
74
|
const extra = [];
|
|
86
75
|
|
package/src/content.mjs
CHANGED
package/src/host.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
3
|
import { AggregatedMap } from "aggregated-map";
|
|
5
4
|
import {
|
|
6
5
|
string_attribute,
|
|
@@ -323,16 +322,7 @@ export class host extends ServiceOwner {
|
|
|
323
322
|
}
|
|
324
323
|
|
|
325
324
|
async *preparePackages(dir) {
|
|
326
|
-
const packageData = await this.
|
|
327
|
-
|
|
328
|
-
packageData.sources.push(
|
|
329
|
-
...(await Array.fromAsync(this.templateContent())),
|
|
330
|
-
new FileContentProvider({
|
|
331
|
-
dir,
|
|
332
|
-
pattern: ["**/*", "**/.ssh/*"],
|
|
333
|
-
permissions: this.content.permissions
|
|
334
|
-
})
|
|
335
|
-
);
|
|
325
|
+
const packageData = await this.preparePackage({ dir, pattern: ["**/*", "**/.ssh/*"]});
|
|
336
326
|
|
|
337
327
|
for (const ni of this.networkInterfaces.values()) {
|
|
338
328
|
await ni.systemdDefinitions(dir, packageData);
|
package/src/services/bind.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
3
|
import { reverseArpa } from "ip-utilties";
|
|
5
4
|
import {
|
|
6
5
|
default_collection_attribute,
|
|
@@ -159,8 +158,7 @@ class bind_zone_config extends base {
|
|
|
159
158
|
this.name = name;
|
|
160
159
|
}
|
|
161
160
|
|
|
162
|
-
async write(
|
|
163
|
-
const dir = outputControl.dir;
|
|
161
|
+
async write(dir) {
|
|
164
162
|
const view = this.owner;
|
|
165
163
|
const type = this.type;
|
|
166
164
|
|
|
@@ -631,11 +629,11 @@ class bind_view extends bind_object {
|
|
|
631
629
|
|
|
632
630
|
async packageContent(outputControl) {
|
|
633
631
|
outputControl.packageData.sources.push(
|
|
634
|
-
...(await Array.fromAsync(this.templateContent()))
|
|
632
|
+
...(await Array.fromAsync(this.templateContent(this.service.content)))
|
|
635
633
|
);
|
|
636
634
|
|
|
637
635
|
for (const config of this.zoneConfigs.values()) {
|
|
638
|
-
await config.write(outputControl);
|
|
636
|
+
await config.write(outputControl.dir);
|
|
639
637
|
}
|
|
640
638
|
|
|
641
639
|
if (this.foreignDomains.size) {
|
|
@@ -794,21 +792,14 @@ export class bind extends CoreService {
|
|
|
794
792
|
}
|
|
795
793
|
|
|
796
794
|
async *preparePackages(dir) {
|
|
797
|
-
const packageData = await this.
|
|
795
|
+
const packageData = await this.preparePackage(dir);
|
|
798
796
|
|
|
799
|
-
packageData
|
|
800
|
-
|
|
801
|
-
|
|
797
|
+
if(!packageData) {
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
802
800
|
|
|
803
801
|
let hasContent = packageData.sources.length > 0;
|
|
804
802
|
|
|
805
|
-
packageData.sources.push(
|
|
806
|
-
new FileContentProvider({
|
|
807
|
-
dir: dir + "/",
|
|
808
|
-
permissions: this.content.permissions
|
|
809
|
-
})
|
|
810
|
-
);
|
|
811
|
-
|
|
812
803
|
const outputControl = { packageData, dir };
|
|
813
804
|
|
|
814
805
|
for (const key of this.keys.values()) {
|
package/src/services/chrony.mjs
CHANGED
|
@@ -46,19 +46,7 @@ export class chrony extends CoreService {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
async *preparePackages(dir) {
|
|
49
|
-
const packageData = await this.
|
|
50
|
-
|
|
51
|
-
packageData.sources.push(
|
|
52
|
-
...(await Array.fromAsync(this.templateContent()))
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
packageData.sources.push(
|
|
56
|
-
new FileContentProvider({
|
|
57
|
-
dir: dir + "/",
|
|
58
|
-
permissions: this.content.permissions
|
|
59
|
-
})
|
|
60
|
-
);
|
|
61
|
-
|
|
49
|
+
const packageData = await this.preparePackage(dir);
|
|
62
50
|
const subnets = [...new Map(this.subnets).values()]; // TODO should be normal
|
|
63
51
|
const host = this.host;
|
|
64
52
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { stringify } from "yaml";
|
|
3
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
3
|
import { boolean_attribute_writable_true } from "pacc";
|
|
5
4
|
import { CoreService, addType, FAMILY_IPV4_IPV6 } from "pmcf";
|
|
6
5
|
import { writeLines, filterConfigurable } from "../utils.mjs";
|
|
@@ -31,16 +30,7 @@ export class influxdb extends CoreService {
|
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
async *preparePackages(dir) {
|
|
34
|
-
const packageData = await this.
|
|
35
|
-
|
|
36
|
-
packageData.sources.push(
|
|
37
|
-
...(await Array.fromAsync(this.templateContent())),
|
|
38
|
-
new FileContentProvider({
|
|
39
|
-
dir,
|
|
40
|
-
pattern: ["**/*"],
|
|
41
|
-
permissions: this.content.permissions
|
|
42
|
-
})
|
|
43
|
-
);
|
|
33
|
+
const packageData = await this.preparePackage(dir);
|
|
44
34
|
|
|
45
35
|
await writeLines(
|
|
46
36
|
join(dir, "etc", "influxdb"),
|
package/src/services/kea.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
2
|
import {
|
|
4
3
|
reverseArpa,
|
|
5
4
|
addressType,
|
|
@@ -185,18 +184,7 @@ export class kea extends CoreService {
|
|
|
185
184
|
const name = host.name;
|
|
186
185
|
const subnets = [...this.subnets.values()];
|
|
187
186
|
const dnsServerEndpoints = this.dnsServerEndpoints;
|
|
188
|
-
const packageData = await this.
|
|
189
|
-
|
|
190
|
-
packageData.sources.push(
|
|
191
|
-
...(await Array.fromAsync(this.templateContent()))
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
packageData.sources.push(
|
|
195
|
-
new FileContentProvider({
|
|
196
|
-
dir: dir + "/",
|
|
197
|
-
permissions: this.content.permissions
|
|
198
|
-
})
|
|
199
|
-
);
|
|
187
|
+
const packageData = await this.preparePackage(dir);
|
|
200
188
|
|
|
201
189
|
const loggers = [
|
|
202
190
|
{
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
|
-
import { FileContentProvider } from "npm-pkgbuild";
|
|
3
2
|
import { port_attribute, string_attribute_writable } from "pacc";
|
|
4
3
|
import { CoreService, addType } from "pmcf";
|
|
5
4
|
import {
|
|
@@ -51,16 +50,7 @@ export class mosquitto extends CoreService {
|
|
|
51
50
|
}
|
|
52
51
|
|
|
53
52
|
async *preparePackages(dir) {
|
|
54
|
-
const packageData = await this.
|
|
55
|
-
|
|
56
|
-
packageData.sources.push(
|
|
57
|
-
...(await Array.fromAsync(this.templateContent())),
|
|
58
|
-
new FileContentProvider({
|
|
59
|
-
dir,
|
|
60
|
-
pattern: ["**/*"],
|
|
61
|
-
permissions: this.content.permissions
|
|
62
|
-
})
|
|
63
|
-
);
|
|
53
|
+
const packageData = await this.preparePackage(dir);
|
|
64
54
|
|
|
65
55
|
await writeLines(
|
|
66
56
|
join(dir, "etc", "mosquitto"),
|