pmcf 4.24.4 → 4.25.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/README.md +11 -11
- package/package.json +1 -1
- package/src/base.mjs +30 -33
- package/src/host.mjs +8 -8
- package/src/initialization-context.mjs +2 -2
- package/src/network-interfaces/network-interface.mjs +7 -7
- package/src/network-interfaces/skeleton.mjs +1 -1
- package/src/network-interfaces/wlan.mjs +3 -3
- package/src/service.mjs +5 -5
- package/src/services/influxdb.mjs +1 -1
- package/src/services/openldap.mjs +2 -2
- package/src/services/systemd-journal-remote.mjs +1 -1
- package/src/services/systemd-journal-upload.mjs +2 -1
- package/src/services/systemd-journald.mjs +1 -1
- package/src/services/systemd-resolved.mjs +2 -2
- package/src/services/systemd-timesyncd.mjs +1 -1
package/README.md
CHANGED
|
@@ -73,11 +73,11 @@ generates config packages for:
|
|
|
73
73
|
* [Parameters](#parameters-12)
|
|
74
74
|
* [port](#port-1)
|
|
75
75
|
* [id](#id)
|
|
76
|
-
* [InitializationContext](#initializationcontext)
|
|
77
|
-
* [Parameters](#parameters-13)
|
|
78
76
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
79
77
|
* [networkAddresses](#networkaddresses)
|
|
80
|
-
* [Parameters](#parameters-
|
|
78
|
+
* [Parameters](#parameters-13)
|
|
79
|
+
* [InitializationContext](#initializationcontext)
|
|
80
|
+
* [Parameters](#parameters-14)
|
|
81
81
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
82
82
|
* [Properties](#properties)
|
|
83
83
|
* [systemdConfigs](#systemdconfigs)
|
|
@@ -263,14 +263,6 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
263
263
|
|
|
264
264
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
265
265
|
|
|
266
|
-
## InitializationContext
|
|
267
|
-
|
|
268
|
-
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
269
|
-
|
|
270
|
-
### Parameters
|
|
271
|
-
|
|
272
|
-
* `directory` (optional, default `"/"`)
|
|
273
|
-
|
|
274
266
|
## SkeletonNetworkInterface
|
|
275
267
|
|
|
276
268
|
**Extends ServiceOwner**
|
|
@@ -283,6 +275,14 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
283
275
|
|
|
284
276
|
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
285
277
|
|
|
278
|
+
## InitializationContext
|
|
279
|
+
|
|
280
|
+
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
281
|
+
|
|
282
|
+
### Parameters
|
|
283
|
+
|
|
284
|
+
* `directory` (optional, default `"/"`)
|
|
285
|
+
|
|
286
286
|
## SystemdJournalRemoteService
|
|
287
287
|
|
|
288
288
|
**Extends Service**
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -29,7 +29,7 @@ import { union } from "./utils.mjs";
|
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
*
|
|
32
|
-
* attributes:
|
|
32
|
+
* attributes: as declared in the types
|
|
33
33
|
* properties: use defined values to support attribute value definitions
|
|
34
34
|
*/
|
|
35
35
|
export class Base {
|
|
@@ -65,12 +65,12 @@ export class Base {
|
|
|
65
65
|
owner;
|
|
66
66
|
description;
|
|
67
67
|
name;
|
|
68
|
+
properties = {};
|
|
68
69
|
extends = new Set();
|
|
69
70
|
_tags = new Set();
|
|
70
71
|
_packaging = new Set();
|
|
71
72
|
_directory;
|
|
72
73
|
_finalize;
|
|
73
|
-
_properties = {};
|
|
74
74
|
|
|
75
75
|
/**
|
|
76
76
|
*
|
|
@@ -222,7 +222,7 @@ export class Base {
|
|
|
222
222
|
* @param {string} name
|
|
223
223
|
* @returns {any}
|
|
224
224
|
*/
|
|
225
|
-
|
|
225
|
+
attribute(name) {
|
|
226
226
|
for (const node of this.walkDirections(["this", "extends"])) {
|
|
227
227
|
const value = getAttribute(node, name);
|
|
228
228
|
if (value !== undefined) {
|
|
@@ -236,7 +236,7 @@ export class Base {
|
|
|
236
236
|
* @param {Function} [filter]
|
|
237
237
|
* @return {Iterable<[string,any]>} values
|
|
238
238
|
*/
|
|
239
|
-
*
|
|
239
|
+
*attributeIterator(filter) {
|
|
240
240
|
for (
|
|
241
241
|
let typeDefinition = this.constructor.typeDefinition;
|
|
242
242
|
typeDefinition;
|
|
@@ -247,7 +247,7 @@ export class Base {
|
|
|
247
247
|
filter
|
|
248
248
|
)) {
|
|
249
249
|
const name = path.join(".");
|
|
250
|
-
const value = this.
|
|
250
|
+
const value = this.attribute(name);
|
|
251
251
|
|
|
252
252
|
if (value !== undefined) {
|
|
253
253
|
yield [def.externalName ?? name, toExternal(value, def), path, def];
|
|
@@ -261,8 +261,31 @@ export class Base {
|
|
|
261
261
|
* @param {Function} [filter]
|
|
262
262
|
* @return {Object} values
|
|
263
263
|
*/
|
|
264
|
-
|
|
265
|
-
return Object.fromEntries(this.
|
|
264
|
+
getAttributes(filter = filterPublic) {
|
|
265
|
+
return Object.fromEntries(this.attributeIterator(filter));
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
valueFor(name, at) {
|
|
269
|
+
if (at !== undefined) {
|
|
270
|
+
return this.attribute(name) ?? this.property(name);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return globals[name];
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
*
|
|
278
|
+
* @param {string} name
|
|
279
|
+
* @returns {any}
|
|
280
|
+
*/
|
|
281
|
+
property(name) {
|
|
282
|
+
for (const node of this.walkDirections()) {
|
|
283
|
+
const value = node.properties?.[name];
|
|
284
|
+
|
|
285
|
+
if (value !== undefined) {
|
|
286
|
+
return this.expand(value);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
266
289
|
}
|
|
267
290
|
|
|
268
291
|
get root() {
|
|
@@ -451,32 +474,6 @@ export class Base {
|
|
|
451
474
|
return this.name?.indexOf("*") >= 0 || this.owner?.isTemplate || false;
|
|
452
475
|
}
|
|
453
476
|
|
|
454
|
-
valueFor(name, at) {
|
|
455
|
-
if (at !== undefined) {
|
|
456
|
-
return this.extendedAttribute(name) ?? this.property(name);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
return globals[name];
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
get properties() {
|
|
463
|
-
return this._properties;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
*
|
|
468
|
-
* @param {string} name
|
|
469
|
-
* @returns {any}
|
|
470
|
-
*/
|
|
471
|
-
property(name) {
|
|
472
|
-
for (const node of this.walkDirections(["this", "extends", "owner"])) {
|
|
473
|
-
const value = node._properties?.[name];
|
|
474
|
-
if (value !== undefined) {
|
|
475
|
-
return this.expand(value);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
477
|
/**
|
|
481
478
|
*
|
|
482
479
|
* @param {any} object
|
package/src/host.mjs
CHANGED
|
@@ -157,7 +157,7 @@ export class Host extends ServiceOwner {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
get serial() {
|
|
160
|
-
return this.
|
|
160
|
+
return this.attribute("_serial");
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
set deployment(value) {
|
|
@@ -165,7 +165,7 @@ export class Host extends ServiceOwner {
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
get deployment() {
|
|
168
|
-
return this.
|
|
168
|
+
return this.attribute("_deployment");
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
set chassis(value) {
|
|
@@ -173,7 +173,7 @@ export class Host extends ServiceOwner {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
get chassis() {
|
|
176
|
-
return this.
|
|
176
|
+
return this.attribute("_chassis");
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
set vendor(value) {
|
|
@@ -181,7 +181,7 @@ export class Host extends ServiceOwner {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
get vendor() {
|
|
184
|
-
return this.
|
|
184
|
+
return this.attribute("_vendor");
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
/**
|
|
@@ -196,7 +196,7 @@ export class Host extends ServiceOwner {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
get keymap() {
|
|
199
|
-
return this.
|
|
199
|
+
return this.attribute("_keymap");
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
set architecture(value) {
|
|
@@ -204,7 +204,7 @@ export class Host extends ServiceOwner {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
get architecture() {
|
|
207
|
-
return this.
|
|
207
|
+
return this.attribute("_architecture");
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
get derivedPackaging() {
|
|
@@ -284,7 +284,7 @@ export class Host extends ServiceOwner {
|
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
get os() {
|
|
287
|
-
return this.
|
|
287
|
+
return this.attribute("_os");
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
set distribution(value) {
|
|
@@ -292,7 +292,7 @@ export class Host extends ServiceOwner {
|
|
|
292
292
|
}
|
|
293
293
|
|
|
294
294
|
get distribution() {
|
|
295
|
-
return this.
|
|
295
|
+
return this.attribute("_distribution");
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
get modelName() {
|
|
@@ -188,7 +188,7 @@ export class InitializationContext {
|
|
|
188
188
|
|
|
189
189
|
read(object, data, type = object.constructor.typeDefinition) {
|
|
190
190
|
if (data?.properties) {
|
|
191
|
-
Object.assign(object.
|
|
191
|
+
Object.assign(object.properties, data.properties);
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
this._read(object, data, type);
|
|
@@ -309,7 +309,7 @@ export class InitializationContext {
|
|
|
309
309
|
const data = JSON.parse(
|
|
310
310
|
await readFile(join(this.directory, name), "utf8")
|
|
311
311
|
);
|
|
312
|
-
this.root.
|
|
312
|
+
this.root.properties = data.properties;
|
|
313
313
|
} else {
|
|
314
314
|
await this.load("/" + name, { type });
|
|
315
315
|
}
|
|
@@ -124,7 +124,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
get hostName() {
|
|
127
|
-
return this.
|
|
127
|
+
return this.attribute("_hostName") ?? this.host.hostName;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
set hostName(value) {
|
|
@@ -145,7 +145,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
145
145
|
|
|
146
146
|
get scope() {
|
|
147
147
|
return (
|
|
148
|
-
this.
|
|
148
|
+
this.attribute("_scope") ??
|
|
149
149
|
this.network?.scope ??
|
|
150
150
|
networkAttributes.scope.default
|
|
151
151
|
);
|
|
@@ -156,7 +156,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
get hwaddr() {
|
|
159
|
-
return this.
|
|
159
|
+
return this.attribute("_hwaddr");
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
set metric(value) {
|
|
@@ -165,7 +165,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
165
165
|
|
|
166
166
|
get metric() {
|
|
167
167
|
return (
|
|
168
|
-
this.
|
|
168
|
+
this.attribute("_metric") ??
|
|
169
169
|
this.network?.metric ??
|
|
170
170
|
networkAttributes.metric.default
|
|
171
171
|
);
|
|
@@ -176,7 +176,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
get mtu() {
|
|
179
|
-
return this.
|
|
179
|
+
return this.attribute("_mtu");
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
set class(value) {
|
|
@@ -184,7 +184,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
get class() {
|
|
187
|
-
return this.
|
|
187
|
+
return this.attribute("_class") ?? this.network?.class;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
set kind(value) {
|
|
@@ -192,7 +192,7 @@ export class NetworkInterface extends SkeletonNetworkInterface {
|
|
|
192
192
|
}
|
|
193
193
|
|
|
194
194
|
get kind() {
|
|
195
|
-
return this.
|
|
195
|
+
return this.attribute("_kind") ?? this.network?.kind;
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
async systemdDefinitions(dir, packageData) {
|
|
@@ -50,7 +50,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
50
50
|
|
|
51
51
|
get secretName() {
|
|
52
52
|
return (
|
|
53
|
-
this.
|
|
53
|
+
this.attribute("_secretName") ??
|
|
54
54
|
this.network?.secretName ??
|
|
55
55
|
`${this.network.name}.password`
|
|
56
56
|
);
|
|
@@ -61,7 +61,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
get ssid() {
|
|
64
|
-
return this.
|
|
64
|
+
return this.attribute("_ssid") ?? this.network?.ssid;
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
set psk(value) {
|
|
@@ -69,7 +69,7 @@ export class WLANNetworkInterface extends EthernetNetworkInterface {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
get psk() {
|
|
72
|
-
return this.
|
|
72
|
+
return this.attribute("_psk") ?? this.network?.psk;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
async systemdDefinitions(dir, packageData) {
|
package/src/service.mjs
CHANGED
|
@@ -213,7 +213,7 @@ export class Service extends Base {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
get alias() {
|
|
216
|
-
return this.
|
|
216
|
+
return this.attribute("_alias");
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
set port(value) {
|
|
@@ -221,7 +221,7 @@ export class Service extends Base {
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
get port() {
|
|
224
|
-
return this.
|
|
224
|
+
return this.attribute("_port") ?? serviceTypeEndpoints(ServiceTypes[this.type])[0]?.port;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
set weight(value) {
|
|
@@ -229,7 +229,7 @@ export class Service extends Base {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
get weight() {
|
|
232
|
-
return this.
|
|
232
|
+
return this.attribute("_weight") ?? this.owner.weight ?? 1;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
235
|
set type(value) {
|
|
@@ -237,7 +237,7 @@ export class Service extends Base {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
get type() {
|
|
240
|
-
return this.
|
|
240
|
+
return this.attribute("_type") ?? this.name;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
get types() {
|
|
@@ -246,7 +246,7 @@ export class Service extends Base {
|
|
|
246
246
|
|
|
247
247
|
get systemdService() {
|
|
248
248
|
return (
|
|
249
|
-
this.
|
|
249
|
+
this.attribute("_systemdService") ??
|
|
250
250
|
ServiceTypes[this.type]?.systemdService
|
|
251
251
|
);
|
|
252
252
|
}
|
|
@@ -62,7 +62,7 @@ export class InfluxdbService extends Service {
|
|
|
62
62
|
await writeLines(
|
|
63
63
|
join(dir, "etc", "influxdb"),
|
|
64
64
|
"config.yml",
|
|
65
|
-
setionLinesFromPropertyIterator(this.
|
|
65
|
+
setionLinesFromPropertyIterator(this.attributeIterator(filterConfigurable))
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
yield packageData;
|
|
@@ -40,7 +40,7 @@ export class OpenLDAPService extends Service {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
get base() {
|
|
43
|
-
return this.
|
|
43
|
+
return this.attribute("_base");
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
set base(value) {
|
|
@@ -48,7 +48,7 @@ export class OpenLDAPService extends Service {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
get uri() {
|
|
51
|
-
return this.
|
|
51
|
+
return this.attribute("_uri");
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
set uri(value) {
|
|
@@ -107,7 +107,7 @@ export class SystemdJournalRemoteService extends Service {
|
|
|
107
107
|
return {
|
|
108
108
|
serviceName: this.systemdService,
|
|
109
109
|
configFileName: `etc/systemd/journal-remote.conf.d/${name}.conf`,
|
|
110
|
-
content: sectionLines("Remote", this.
|
|
110
|
+
content: sectionLines("Remote", this.getAttributes(filterConfigurable))
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -69,10 +69,11 @@ export class SystemdJournalUploadService extends Service {
|
|
|
69
69
|
* @returns {Object}
|
|
70
70
|
*/
|
|
71
71
|
systemdConfigs(name) {
|
|
72
|
+
console.log("PROPS",this.expand(this.getAttributes(filterConfigurable)));
|
|
72
73
|
return {
|
|
73
74
|
serviceName: this.systemdService,
|
|
74
75
|
configFileName: `etc/systemd/journal-upload.conf.d/${name}.conf`,
|
|
75
|
-
content: sectionLines("Upload", this.
|
|
76
|
+
content: sectionLines("Upload", this.getAttributes(filterConfigurable))
|
|
76
77
|
};
|
|
77
78
|
}
|
|
78
79
|
}
|
|
@@ -127,7 +127,7 @@ export class SystemdJournaldService extends Service {
|
|
|
127
127
|
return {
|
|
128
128
|
serviceName: this.systemdService,
|
|
129
129
|
configFileName: `etc/systemd/journal.conf.d/${name}.conf`,
|
|
130
|
-
content: sectionLines("Journal", this.
|
|
130
|
+
content: sectionLines("Journal", this.getAttributes(filterConfigurable))
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -107,12 +107,12 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
107
107
|
return {
|
|
108
108
|
serviceName: this.systemdService,
|
|
109
109
|
configFileName: `etc/systemd/resolved.conf.d/${name}.conf`,
|
|
110
|
-
//content: [...setionLinesFromPropertyIterator(this.
|
|
110
|
+
//content: [...setionLinesFromPropertyIterator(this.attributeIterator( filterConfigurable)), "A=1"]
|
|
111
111
|
content: sectionLines("Resolve", {
|
|
112
112
|
DNS: serviceEndpoints(this, options(300, 399, 4)),
|
|
113
113
|
FallbackDNS: serviceEndpoints(this, options(100, 199, 4)),
|
|
114
114
|
MulticastDNS: yesno(this.network.multicastDNS),
|
|
115
|
-
...this.
|
|
115
|
+
...this.getAttributes(filterConfigurable)
|
|
116
116
|
})
|
|
117
117
|
};
|
|
118
118
|
}
|
|
@@ -63,7 +63,7 @@ export class SystemdTimesyncdService extends ExtraSourceService {
|
|
|
63
63
|
content: sectionLines("Time", {
|
|
64
64
|
NTP: serviceEndpoints(this, options(300, 399)),
|
|
65
65
|
FallbackNTP: serviceEndpoints(this, options(100, 199)),
|
|
66
|
-
...this.
|
|
66
|
+
...this.getAttributes(filterConfigurable)
|
|
67
67
|
})
|
|
68
68
|
};
|
|
69
69
|
}
|