pmcf 2.5.1 → 2.6.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/network.mjs +13 -1
- package/src/owner.mjs +8 -3
- package/src/services/dns.mjs +18 -1
- package/types/owner.d.mts +1 -0
package/package.json
CHANGED
package/src/network.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { networkProperties } from "./network-support.mjs";
|
|
|
5
5
|
|
|
6
6
|
const NetworkTypeDefinition = {
|
|
7
7
|
name: "network",
|
|
8
|
-
owners: ["location", "
|
|
8
|
+
owners: ["location", "owner", "root"],
|
|
9
9
|
priority: 0.8,
|
|
10
10
|
extends: Owner.typeDefinition,
|
|
11
11
|
properties: {
|
|
@@ -53,6 +53,18 @@ export class Network extends Owner {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
hosts() {
|
|
57
|
+
if (this.bridge) {
|
|
58
|
+
let hosts = new Set();
|
|
59
|
+
for (const network of this.bridge) {
|
|
60
|
+
hosts = hosts.union(network.directHosts());
|
|
61
|
+
}
|
|
62
|
+
return hosts;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return super.hosts();
|
|
66
|
+
}
|
|
67
|
+
|
|
56
68
|
get bridge() {
|
|
57
69
|
return this._bridge;
|
|
58
70
|
}
|
package/src/owner.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { addType, types } from "./types.mjs";
|
|
|
5
5
|
|
|
6
6
|
const OwnerTypeDefinition = {
|
|
7
7
|
name: "owner",
|
|
8
|
-
owners: ["owner", "root"],
|
|
8
|
+
owners: ["location", "owner", "root"],
|
|
9
9
|
priority: 0.9,
|
|
10
10
|
extends: Base.typeDefinition,
|
|
11
11
|
properties: {
|
|
@@ -137,13 +137,18 @@ export class Owner extends Base {
|
|
|
137
137
|
return this.typeNamed("host", name) || this.typeNamed("cluster", name);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
directHosts() {
|
|
141
141
|
let hosts = new Set();
|
|
142
|
-
|
|
143
142
|
for (const type of ["host", "cluster"]) {
|
|
144
143
|
hosts = hosts.union(new Set(Array.from(this.typeList(type))));
|
|
145
144
|
}
|
|
146
145
|
|
|
146
|
+
return hosts;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
hosts() {
|
|
150
|
+
let hosts = this.directHosts();
|
|
151
|
+
|
|
147
152
|
for (const type of types.host.owners) {
|
|
148
153
|
for (const object of this.typeList(type)) {
|
|
149
154
|
hosts = hosts.union(object.hosts());
|
package/src/services/dns.mjs
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ExtraSourceServiceTypeDefinition
|
|
17
17
|
} from "../extra-source-service.mjs";
|
|
18
18
|
import { subnets } from "../subnet.mjs";
|
|
19
|
+
import { addHook } from "../hooks.mjs";
|
|
19
20
|
|
|
20
21
|
const DNSServiceTypeDefinition = {
|
|
21
22
|
name: "dns",
|
|
@@ -202,7 +203,8 @@ export class DNSService extends ExtraSourceService {
|
|
|
202
203
|
description: `zone definitions for ${location.fullName}`,
|
|
203
204
|
dependencies: ["mf-named"],
|
|
204
205
|
replaces: ["mf-named-zones"],
|
|
205
|
-
access: "private"
|
|
206
|
+
access: "private",
|
|
207
|
+
hooks: {}
|
|
206
208
|
};
|
|
207
209
|
|
|
208
210
|
packageData.sources = [
|
|
@@ -257,6 +259,13 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
257
259
|
file: `FOREIGN/${domain}.zone`,
|
|
258
260
|
records: new Set([SOARecord, NSRecord])
|
|
259
261
|
};
|
|
262
|
+
|
|
263
|
+
addHook(
|
|
264
|
+
packageData.properties.hooks,
|
|
265
|
+
"post_install",
|
|
266
|
+
`rm /var/lib/named/${zone.file}.jnl`
|
|
267
|
+
);
|
|
268
|
+
|
|
260
269
|
const config = {
|
|
261
270
|
name: `${domain}.zone.conf`,
|
|
262
271
|
zones: [zone]
|
|
@@ -273,6 +282,14 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
273
282
|
}
|
|
274
283
|
}
|
|
275
284
|
}
|
|
285
|
+
|
|
286
|
+
if (configs.length > 0) {
|
|
287
|
+
addHook(
|
|
288
|
+
packageData.properties.hooks,
|
|
289
|
+
"post_install",
|
|
290
|
+
"systemctl restart named"
|
|
291
|
+
);
|
|
292
|
+
}
|
|
276
293
|
}
|
|
277
294
|
|
|
278
295
|
for (const domain of dns.localDomains) {
|
package/types/owner.d.mts
CHANGED