pmcf 3.10.0 → 3.10.1
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 +3 -3
- package/src/cluster.mjs +1 -1
- package/src/extra-source-service.mjs +1 -1
- package/src/filter.mjs +1 -1
- package/src/host.mjs +3 -8
- package/src/location.mjs +1 -1
- package/src/network-interfaces/ethernet.mjs +1 -1
- package/src/network-interfaces/loopback.mjs +1 -1
- package/src/network-interfaces/network-interface.mjs +8 -8
- package/src/network-interfaces/tun.mjs +1 -1
- package/src/network-interfaces/wireguard.mjs +1 -1
- package/src/network-interfaces/wlan.mjs +1 -1
- package/src/network-support.mjs +2 -2
- package/src/network.mjs +3 -3
- package/src/owner.mjs +1 -1
- package/src/root.mjs +1 -1
- package/src/service.mjs +6 -6
- package/src/services/bind.mjs +25 -20
- package/src/services/chrony.mjs +1 -1
- package/src/services/headscale.mjs +1 -1
- package/src/services/influxdb.mjs +2 -2
- package/src/services/kea.mjs +2 -2
- package/src/services/mosquitto.mjs +3 -3
- package/src/services/openldap.mjs +4 -4
- package/src/services/systemd-journal-remote.mjs +1 -1
- package/src/services/systemd-journal-upload.mjs +1 -1
- package/src/services/systemd-journal.mjs +1 -1
- package/src/services/systemd-resolved.mjs +1 -1
- package/src/services/systemd-timesyncd.mjs +1 -1
- package/src/subnet.mjs +1 -1
- package/src/types.mjs +8 -7
- package/types/base.d.mts +1 -1
- package/types/cluster.d.mts +6 -6
- package/types/extra-source-service.d.mts +4 -4
- package/types/host.d.mts +2 -2
- package/types/location.d.mts +7 -7
- package/types/network-interfaces/ethernet.d.mts +6 -6
- package/types/network-interfaces/loopback.d.mts +5 -5
- package/types/network-interfaces/network-interface.d.mts +4 -4
- package/types/network-interfaces/tun.d.mts +5 -5
- package/types/network-interfaces/wireguard.d.mts +5 -5
- package/types/network-interfaces/wlan.d.mts +8 -8
- package/types/network-support.d.mts +2 -2
- package/types/network.d.mts +4 -4
- package/types/owner.d.mts +3 -3
- package/types/root.d.mts +8 -8
- package/types/service.d.mts +6 -6
- package/types/services/bind.d.mts +11 -11
- package/types/services/chrony.d.mts +6 -6
- package/types/services/headscale.d.mts +6 -6
- package/types/services/influxdb.d.mts +5 -5
- package/types/services/kea.d.mts +5 -5
- package/types/services/mosquitto.d.mts +6 -6
- package/types/services/openldap.d.mts +6 -6
- package/types/services/systemd-journal-remote.d.mts +5 -5
- package/types/services/systemd-journal-upload.d.mts +5 -5
- package/types/services/systemd-journal.d.mts +5 -5
- package/types/services/systemd-resolved.d.mts +6 -6
- package/types/services/systemd-timesyncd.d.mts +6 -6
- package/types/subnet.d.mts +1 -1
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -17,7 +17,7 @@ import { asArray } from "./utils.mjs";
|
|
|
17
17
|
const BaseTypeDefinition = {
|
|
18
18
|
name: "base",
|
|
19
19
|
owners: [],
|
|
20
|
-
|
|
20
|
+
attributes: {
|
|
21
21
|
owner: { type: "base", collection: false, writable: false },
|
|
22
22
|
type: string_attribute,
|
|
23
23
|
name: name_attribute_writable,
|
|
@@ -228,7 +228,7 @@ export class Base {
|
|
|
228
228
|
this._properties = data.properties;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
|
-
for (const [name, attribute] of Object.entries(type.
|
|
231
|
+
for (const [name, attribute] of Object.entries(type.attributes)) {
|
|
232
232
|
if (attribute.writable) {
|
|
233
233
|
const value = this.expand(data[name]);
|
|
234
234
|
|
|
@@ -616,7 +616,7 @@ export function extractFrom(
|
|
|
616
616
|
const json = {};
|
|
617
617
|
|
|
618
618
|
do {
|
|
619
|
-
for (const [name, def] of Object.entries(typeDefinition.
|
|
619
|
+
for (const [name, def] of Object.entries(typeDefinition.attributes)) {
|
|
620
620
|
let value = object[name];
|
|
621
621
|
|
|
622
622
|
switch (typeof value) {
|
package/src/cluster.mjs
CHANGED
|
@@ -12,7 +12,7 @@ const ClusterTypeDefinition = {
|
|
|
12
12
|
owners: [Owner.typeDefinition, "network", "location", "root"],
|
|
13
13
|
priority: 0.7,
|
|
14
14
|
extends: Host.typeDefinition,
|
|
15
|
-
|
|
15
|
+
attributes: {
|
|
16
16
|
routerId: { ...number_attribute_writable },
|
|
17
17
|
masters: { type: "network_interface", collection: true, writable: true },
|
|
18
18
|
backups: { type: "network_interface", collection: true, writable: true },
|
package/src/filter.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export function* objectFilter(type, objects, filter) {
|
|
|
55
55
|
return false;
|
|
56
56
|
};
|
|
57
57
|
for (let t = type; t; t = t.extends) {
|
|
58
|
-
for (const property of Object.values(t.
|
|
58
|
+
for (const property of Object.values(t.attributes)) {
|
|
59
59
|
switch (property.type[0]) {
|
|
60
60
|
case "boolean":
|
|
61
61
|
if (
|
package/src/host.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
boolean_attribute_false
|
|
10
10
|
} from "pacc";
|
|
11
11
|
import { ServiceOwner, Base, addresses } from "pmcf";
|
|
12
|
-
import {
|
|
12
|
+
import { networkAddressAttributes } from "./network-support.mjs";
|
|
13
13
|
import { addHook } from "./hooks.mjs";
|
|
14
14
|
import {
|
|
15
15
|
domainFromDominName,
|
|
@@ -29,8 +29,8 @@ const HostTypeDefinition = {
|
|
|
29
29
|
priority: 0.5,
|
|
30
30
|
owners: ["owner", "network", "root"],
|
|
31
31
|
extends: Base.typeDefinition,
|
|
32
|
-
|
|
33
|
-
...
|
|
32
|
+
attributes: {
|
|
33
|
+
...networkAddressAttributes,
|
|
34
34
|
networkInterfaces: {
|
|
35
35
|
type: "network_interface",
|
|
36
36
|
collection: true,
|
|
@@ -107,11 +107,6 @@ export class Host extends ServiceOwner {
|
|
|
107
107
|
return HostTypeDefinition;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
constructor(owner, data) {
|
|
111
|
-
super(owner, data);
|
|
112
|
-
owner.addObject(this);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
110
|
read(data, type) {
|
|
116
111
|
super.read(data, type);
|
|
117
112
|
|
package/src/location.mjs
CHANGED
|
@@ -10,7 +10,7 @@ export const EthernetNetworkInterfaceTypeDefinition = {
|
|
|
10
10
|
owners: NetworkInterfaceTypeDefinition.owners,
|
|
11
11
|
extends: NetworkInterfaceTypeDefinition,
|
|
12
12
|
priority: 0.1,
|
|
13
|
-
|
|
13
|
+
attributes: {
|
|
14
14
|
arpbridge: { type: "network_interface", collection: true, writable: true }
|
|
15
15
|
}
|
|
16
16
|
};
|
|
@@ -3,8 +3,8 @@ import { hasWellKnownSubnet, normalizeIP } from "ip-utilties";
|
|
|
3
3
|
import { string_attribute_writable, hostname_attribute } from "pacc";
|
|
4
4
|
import { Base, cidrAddresses } from "pmcf";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
networkAttributes,
|
|
7
|
+
networkAddressAttributes
|
|
8
8
|
} from "../network-support.mjs";
|
|
9
9
|
import { asArray, writeLines, sectionLines } from "../utils.mjs";
|
|
10
10
|
import { addType } from "../types.mjs";
|
|
@@ -35,9 +35,9 @@ export const NetworkInterfaceTypeDefinition = {
|
|
|
35
35
|
|
|
36
36
|
return NetworkInterface;
|
|
37
37
|
},
|
|
38
|
-
|
|
39
|
-
...
|
|
40
|
-
...
|
|
38
|
+
attributes: {
|
|
39
|
+
...networkAttributes,
|
|
40
|
+
...networkAddressAttributes,
|
|
41
41
|
|
|
42
42
|
services: { type: "service", collection: true, writable: true },
|
|
43
43
|
hostName: { ...hostname_attribute, writable: true },
|
|
@@ -133,7 +133,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
133
133
|
return (
|
|
134
134
|
this.extendedProperty("_scope") ??
|
|
135
135
|
this.network?.scope ??
|
|
136
|
-
|
|
136
|
+
networkAttributes.scope.default
|
|
137
137
|
);
|
|
138
138
|
}
|
|
139
139
|
|
|
@@ -153,7 +153,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
153
153
|
return (
|
|
154
154
|
this.extendedProperty("_metric") ??
|
|
155
155
|
this.network?.metric ??
|
|
156
|
-
|
|
156
|
+
networkAttributes.metric.default
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -162,7 +162,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
get mtu() {
|
|
165
|
-
return this.extendedProperty("_mtu"); // ??
|
|
165
|
+
return this.extendedProperty("_mtu"); // ?? networkAttributes.mtu.default;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
set class(value) {
|
|
@@ -8,7 +8,7 @@ const WireguardNetworkInterfaceTypeDefinition = {
|
|
|
8
8
|
owners: NetworkInterfaceTypeDefinition.owners,
|
|
9
9
|
extends: NetworkInterfaceTypeDefinition,
|
|
10
10
|
priority: 0.1,
|
|
11
|
-
|
|
11
|
+
attributes: {}
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
export class WireguardNetworkInterface extends SkeletonNetworkInterface {
|
|
@@ -15,7 +15,7 @@ const WLANNetworkInterfaceTypeDefinition = {
|
|
|
15
15
|
owners: EthernetNetworkInterfaceTypeDefinition.owners,
|
|
16
16
|
extends: EthernetNetworkInterfaceTypeDefinition,
|
|
17
17
|
priority: 0.1,
|
|
18
|
-
|
|
18
|
+
attributes: {
|
|
19
19
|
ssid: string_attribute_writable,
|
|
20
20
|
psk: { ...secret_attribute, writable: true },
|
|
21
21
|
secretName: string_attribute_writable
|
package/src/network-support.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
|
|
9
9
|
export const networkAddressType = ["network", "host", "network_interface"];
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const networkAttributes = {
|
|
12
12
|
scope: {
|
|
13
13
|
...string_attribute_writable,
|
|
14
14
|
values: ["global", "site", "link", "host"]
|
|
@@ -31,7 +31,7 @@ export const networkProperties = {
|
|
|
31
31
|
multicastDNS: boolean_attribute_writable
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
export const
|
|
34
|
+
export const networkAddressAttributes = {
|
|
35
35
|
hostName: { ...hostname_attribute, writable: true },
|
|
36
36
|
cidrAddresses: { ...string_collection_attribute_writable },
|
|
37
37
|
cidrAddress: { ...string_attribute_writable },
|
package/src/network.mjs
CHANGED
|
@@ -2,15 +2,15 @@ import { default_attribute_writable } from "pacc";
|
|
|
2
2
|
import { Owner } from "./owner.mjs";
|
|
3
3
|
import { Subnet } from "./subnet.mjs";
|
|
4
4
|
import { addType } from "./types.mjs";
|
|
5
|
-
import {
|
|
5
|
+
import { networkAttributes } from "./network-support.mjs";
|
|
6
6
|
|
|
7
7
|
const NetworkTypeDefinition = {
|
|
8
8
|
name: "network",
|
|
9
9
|
owners: ["location", "owner", "root"],
|
|
10
10
|
priority: 0.8,
|
|
11
11
|
extends: Owner.typeDefinition,
|
|
12
|
-
|
|
13
|
-
...
|
|
12
|
+
attributes: {
|
|
13
|
+
...networkAttributes,
|
|
14
14
|
bridge: {
|
|
15
15
|
...default_attribute_writable,
|
|
16
16
|
type: "network",
|
package/src/owner.mjs
CHANGED
|
@@ -15,7 +15,7 @@ const OwnerTypeDefinition = {
|
|
|
15
15
|
owners: ["location", "owner", "root"],
|
|
16
16
|
priority: 0.9,
|
|
17
17
|
extends: Base.typeDefinition,
|
|
18
|
-
|
|
18
|
+
attributes: {
|
|
19
19
|
networks: { type: "network", collection: true, writable: true },
|
|
20
20
|
hosts: { type: "host", collection: true, writable: true },
|
|
21
21
|
clusters: { type: "cluster", collection: true, writable: true },
|
package/src/root.mjs
CHANGED
package/src/service.mjs
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "pmcf";
|
|
16
16
|
import { addType } from "./types.mjs";
|
|
17
17
|
import { asArray } from "./utils.mjs";
|
|
18
|
-
import {
|
|
18
|
+
import { networkAddressAttributes } from "./network-support.mjs";
|
|
19
19
|
import { serviceTypeEndpoints, ServiceTypes } from "./service-types.mjs";
|
|
20
20
|
import {
|
|
21
21
|
DNSRecord,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
dnsPriority
|
|
26
26
|
} from "./dns-utils.mjs";
|
|
27
27
|
|
|
28
|
-
export const
|
|
28
|
+
export const endpointAttributes = {
|
|
29
29
|
port: { ...number_attribute_writable },
|
|
30
30
|
protocol: {
|
|
31
31
|
...string_attribute_writable,
|
|
@@ -41,7 +41,7 @@ export const EndpointTypeDefinition = {
|
|
|
41
41
|
owners: ["service", "network_interface"],
|
|
42
42
|
priority: 0.4,
|
|
43
43
|
specializations: {},
|
|
44
|
-
|
|
44
|
+
attributes: endpointAttributes
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export const ServiceTypeDefinition = {
|
|
@@ -61,9 +61,9 @@ export const ServiceTypeDefinition = {
|
|
|
61
61
|
|
|
62
62
|
return Service;
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
...
|
|
66
|
-
...
|
|
64
|
+
attributes: {
|
|
65
|
+
...networkAddressAttributes,
|
|
66
|
+
...endpointAttributes,
|
|
67
67
|
alias: { ...string_attribute_writable },
|
|
68
68
|
weight: { ...number_attribute_writable /*default: 1*/ },
|
|
69
69
|
systemd: string_collection_attribute_writable
|
package/src/services/bind.mjs
CHANGED
|
@@ -16,7 +16,12 @@ import {
|
|
|
16
16
|
dnsRecordTypeForAddressFamily,
|
|
17
17
|
sortZoneRecords
|
|
18
18
|
} from "../dns-utils.mjs";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
ExtraSourceService,
|
|
21
|
+
serviceEndpoints,
|
|
22
|
+
addresses,
|
|
23
|
+
networkAddressType
|
|
24
|
+
} from "pmcf";
|
|
20
25
|
import { addType } from "../types.mjs";
|
|
21
26
|
import { Service, ServiceTypeDefinition } from "../service.mjs";
|
|
22
27
|
import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
|
|
@@ -28,8 +33,8 @@ const BindServiceTypeDefinition = {
|
|
|
28
33
|
owners: ServiceTypeDefinition.owners,
|
|
29
34
|
extends: ExtraSourceServiceTypeDefinition,
|
|
30
35
|
priority: 0.1,
|
|
31
|
-
|
|
32
|
-
|
|
36
|
+
attributes: {
|
|
37
|
+
zones: {
|
|
33
38
|
type: [...networkAddressType, "location", "owner"],
|
|
34
39
|
collection: true,
|
|
35
40
|
writable: true
|
|
@@ -104,10 +109,10 @@ export class BindService extends ExtraSourceService {
|
|
|
104
109
|
hasSVRRecords = true;
|
|
105
110
|
hasCatalog = true;
|
|
106
111
|
hasLinkLocalAdresses =
|
|
107
|
-
BindServiceTypeDefinition.
|
|
112
|
+
BindServiceTypeDefinition.attributes.hasLinkLocalAdresses.default;
|
|
108
113
|
hasLocationRecord = true;
|
|
109
114
|
notify = true;
|
|
110
|
-
|
|
115
|
+
_zones = [];
|
|
111
116
|
_trusted = [];
|
|
112
117
|
_exclude = new Set([]);
|
|
113
118
|
_excludeInterfaceKinds = new Set();
|
|
@@ -157,12 +162,12 @@ export class BindService extends ExtraSourceService {
|
|
|
157
162
|
return [this.serial, this.refresh, this.retry, this.expire, this.minimum];
|
|
158
163
|
}
|
|
159
164
|
|
|
160
|
-
set
|
|
161
|
-
this.
|
|
165
|
+
set zones(value) {
|
|
166
|
+
this._zones.push(value);
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
get
|
|
165
|
-
return this.
|
|
169
|
+
get zones() {
|
|
170
|
+
return this._zones;
|
|
166
171
|
}
|
|
167
172
|
|
|
168
173
|
set protected(value) {
|
|
@@ -206,8 +211,8 @@ export class BindService extends ExtraSourceService {
|
|
|
206
211
|
}
|
|
207
212
|
|
|
208
213
|
async *preparePackages(dir) {
|
|
209
|
-
const
|
|
210
|
-
const names =
|
|
214
|
+
const zoneSources = this.zones.length ? this.zones : [this.owner];
|
|
215
|
+
const names = zoneSources.map(a => a.fullName).join(" ");
|
|
211
216
|
const name = this.owner.owner.name || this.owner.name;
|
|
212
217
|
|
|
213
218
|
const configPackageDir = join(dir, "config") + "/";
|
|
@@ -290,7 +295,7 @@ export class BindService extends ExtraSourceService {
|
|
|
290
295
|
new FileContentProvider(zonesPackageDir, ...filePermissions)
|
|
291
296
|
];
|
|
292
297
|
|
|
293
|
-
yield this.generateZoneDefs(
|
|
298
|
+
yield this.generateZoneDefs(zoneSources, packageData);
|
|
294
299
|
|
|
295
300
|
const outfacingZonesPackageDir = join(dir, "outfacingZones") + "/";
|
|
296
301
|
|
|
@@ -307,7 +312,7 @@ export class BindService extends ExtraSourceService {
|
|
|
307
312
|
new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
|
|
308
313
|
];
|
|
309
314
|
|
|
310
|
-
yield* this.generateOutfacingDefs(
|
|
315
|
+
yield* this.generateOutfacingDefs(zoneSources, packageData);
|
|
311
316
|
}
|
|
312
317
|
|
|
313
318
|
async *generateOutfacingDefs(sources, packageData) {
|
|
@@ -338,18 +343,18 @@ export class BindService extends ExtraSourceService {
|
|
|
338
343
|
}
|
|
339
344
|
}
|
|
340
345
|
|
|
341
|
-
async generateZoneDefs(
|
|
346
|
+
async generateZoneDefs(zoneSources, packageData) {
|
|
342
347
|
const configs = [];
|
|
343
348
|
|
|
344
|
-
for (const
|
|
349
|
+
for (const zoneSource of zoneSources) {
|
|
345
350
|
console.log(
|
|
346
351
|
"SOURCE",
|
|
347
|
-
|
|
348
|
-
[...
|
|
352
|
+
zoneSource.toString(),
|
|
353
|
+
[...zoneSource.localDomains].join(" ")
|
|
349
354
|
);
|
|
350
355
|
|
|
351
|
-
for (const domain of
|
|
352
|
-
const locationName =
|
|
356
|
+
for (const domain of zoneSource.localDomains) {
|
|
357
|
+
const locationName = zoneSource.location.name;
|
|
353
358
|
const reverseZones = new Map();
|
|
354
359
|
|
|
355
360
|
const config = {
|
|
@@ -402,7 +407,7 @@ export class BindService extends ExtraSourceService {
|
|
|
402
407
|
networkInterface,
|
|
403
408
|
domainNames,
|
|
404
409
|
family
|
|
405
|
-
} of
|
|
410
|
+
} of zoneSource.networkAddresses()) {
|
|
406
411
|
if (
|
|
407
412
|
!this.exclude.has(networkInterface.network) &&
|
|
408
413
|
!this.excludeInterfaceKinds.has(networkInterface.kind)
|
package/src/services/chrony.mjs
CHANGED
|
@@ -11,7 +11,7 @@ const InfluxdbServiceTypeDefinition = {
|
|
|
11
11
|
owners: ServiceTypeDefinition.owners,
|
|
12
12
|
extends: ServiceTypeDefinition,
|
|
13
13
|
priority: 0.1,
|
|
14
|
-
|
|
14
|
+
attributes: {
|
|
15
15
|
"metrics-disabled": {
|
|
16
16
|
...boolean_attribute_writable_true,
|
|
17
17
|
isCommonOption: true
|
|
@@ -65,7 +65,7 @@ export class InfluxdbService extends Service {
|
|
|
65
65
|
}
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
const lines = Object.entries(InfluxdbServiceTypeDefinition.
|
|
68
|
+
const lines = Object.entries(InfluxdbServiceTypeDefinition.attributes)
|
|
69
69
|
.filter(
|
|
70
70
|
([key, attribute]) =>
|
|
71
71
|
attribute.isCommonOption && this[key] !== undefined
|
package/src/services/kea.mjs
CHANGED
|
@@ -23,7 +23,7 @@ const KeaServiceTypeDefinition = {
|
|
|
23
23
|
owners: ServiceTypeDefinition.owners,
|
|
24
24
|
extends: ServiceTypeDefinition,
|
|
25
25
|
priority: 0.1,
|
|
26
|
-
|
|
26
|
+
attributes: {
|
|
27
27
|
"ddns-send-updates": {
|
|
28
28
|
...boolean_attribute_writable_true,
|
|
29
29
|
isCommonOption: true
|
|
@@ -281,7 +281,7 @@ export class KeaService extends Service {
|
|
|
281
281
|
};
|
|
282
282
|
|
|
283
283
|
for (const [key] of Object.entries(
|
|
284
|
-
KeaServiceTypeDefinition.
|
|
284
|
+
KeaServiceTypeDefinition.attributes
|
|
285
285
|
).filter(
|
|
286
286
|
([key, attribute]) =>
|
|
287
287
|
attribute.isCommonOption && this[key] !== undefined
|
|
@@ -11,7 +11,7 @@ const MosquittoServiceTypeDefinition = {
|
|
|
11
11
|
owners: ServiceTypeDefinition.owners,
|
|
12
12
|
extends: ServiceTypeDefinition,
|
|
13
13
|
priority: 0.1,
|
|
14
|
-
|
|
14
|
+
attributes: {
|
|
15
15
|
log_timestamp: {
|
|
16
16
|
...boolean_attribute_writable_true,
|
|
17
17
|
isCommonOption: true
|
|
@@ -48,7 +48,7 @@ export class MosquittoService extends Service {
|
|
|
48
48
|
dir,
|
|
49
49
|
sources: [new FileContentProvider(dir + "/")],
|
|
50
50
|
outputs: this.outputs,
|
|
51
|
-
|
|
51
|
+
attributes: {
|
|
52
52
|
name: `mosquitto-${this.location.name}-${host.name}`,
|
|
53
53
|
description: `mosquitto definitions for ${this.fullName}@${name}`,
|
|
54
54
|
access: "private",
|
|
@@ -56,7 +56,7 @@ export class MosquittoService extends Service {
|
|
|
56
56
|
}
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
-
const lines = Object.entries(MosquittoServiceTypeDefinition.
|
|
59
|
+
const lines = Object.entries(MosquittoServiceTypeDefinition.attributes)
|
|
60
60
|
.filter(
|
|
61
61
|
([key, attribute]) =>
|
|
62
62
|
attribute.isCommonOption && this[key] !== undefined
|
|
@@ -12,7 +12,7 @@ const OpenLDAPServiceTypeDefinition = {
|
|
|
12
12
|
owners: ServiceTypeDefinition.owners,
|
|
13
13
|
extends: ServiceTypeDefinition,
|
|
14
14
|
priority: 0.1,
|
|
15
|
-
|
|
15
|
+
attributes: {
|
|
16
16
|
baseDN: {
|
|
17
17
|
...string_attribute,
|
|
18
18
|
writable: true
|
|
@@ -110,7 +110,7 @@ export class OpenLDAPService extends Service {
|
|
|
110
110
|
dir,
|
|
111
111
|
sources: [new FileContentProvider(dir + "/", ...filePermissions)],
|
|
112
112
|
outputs: this.outputs,
|
|
113
|
-
|
|
113
|
+
attributes: {
|
|
114
114
|
name: `openldap-${this.location.name}-${name}`,
|
|
115
115
|
description: `openldap definitions for ${this.fullName}@${name}`,
|
|
116
116
|
access: "private",
|
|
@@ -120,13 +120,13 @@ export class OpenLDAPService extends Service {
|
|
|
120
120
|
};
|
|
121
121
|
|
|
122
122
|
addHook(
|
|
123
|
-
packageData.
|
|
123
|
+
packageData.attributes.hooks,
|
|
124
124
|
"post_upgrade",
|
|
125
125
|
"setfacl -m u:ldap:r /etc/letsencrypt/archive/*/privkey*.pem"
|
|
126
126
|
);
|
|
127
127
|
|
|
128
128
|
addHook(
|
|
129
|
-
packageData.
|
|
129
|
+
packageData.attributes.hooks,
|
|
130
130
|
"post_install",
|
|
131
131
|
"setfacl -m u:ldap:r /etc/letsencrypt/archive/*/privkey*.pem"
|
|
132
132
|
);
|
package/src/subnet.mjs
CHANGED
package/src/types.mjs
CHANGED
|
@@ -26,15 +26,15 @@ export function resolveTypeLinks() {
|
|
|
26
26
|
typeof owner === "string" ? types[owner] : owner
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
for (const [name,
|
|
30
|
-
|
|
31
|
-
if (
|
|
32
|
-
type.identifier =
|
|
29
|
+
for (const [name, attribute] of Object.entries(type.attributes)) {
|
|
30
|
+
attribute.name = name;
|
|
31
|
+
if (attribute.isKey) {
|
|
32
|
+
type.identifier = attribute;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
const ts = [];
|
|
36
36
|
|
|
37
|
-
for (const type of asArray(
|
|
37
|
+
for (const type of asArray(attribute.type)) {
|
|
38
38
|
if (typeof type === "string") {
|
|
39
39
|
if (baseTypes.has(type)) {
|
|
40
40
|
ts.push(type);
|
|
@@ -45,7 +45,7 @@ export function resolveTypeLinks() {
|
|
|
45
45
|
} else {
|
|
46
46
|
console.error(
|
|
47
47
|
"Unknown type",
|
|
48
|
-
|
|
48
|
+
attribute.type,
|
|
49
49
|
type.name,
|
|
50
50
|
name
|
|
51
51
|
);
|
|
@@ -55,7 +55,7 @@ export function resolveTypeLinks() {
|
|
|
55
55
|
ts.push(type);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
attribute.type = ts;
|
|
59
59
|
|
|
60
60
|
/*
|
|
61
61
|
if (typeof property.type === "string") {
|
|
@@ -92,5 +92,6 @@ export function typeFactory(type, owner, data) {
|
|
|
92
92
|
const factory = type.factoryFor?.(owner, data) || type.clazz;
|
|
93
93
|
const object = new factory(owner);
|
|
94
94
|
object.read(data);
|
|
95
|
+
owner.addObject(object);
|
|
95
96
|
return object;
|
|
96
97
|
}
|