pmcf 4.21.2 → 4.22.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/README.md +45 -32
- package/package.json +1 -1
- package/src/base.mjs +8 -2
- package/src/host.mjs +7 -7
- package/src/service-owner.mjs +13 -1
package/README.md
CHANGED
|
@@ -43,70 +43,72 @@ generates config packages for:
|
|
|
43
43
|
|
|
44
44
|
* [Base](#base)
|
|
45
45
|
* [Parameters](#parameters)
|
|
46
|
-
* [
|
|
46
|
+
* [unionFromDirections](#unionfromdirections)
|
|
47
47
|
* [Parameters](#parameters-1)
|
|
48
|
-
* [
|
|
48
|
+
* [walkDirections](#walkdirections)
|
|
49
49
|
* [Parameters](#parameters-2)
|
|
50
|
-
* [
|
|
50
|
+
* [extendedAttribute](#extendedattribute)
|
|
51
51
|
* [Parameters](#parameters-3)
|
|
52
|
-
* [
|
|
52
|
+
* [propertyIterator](#propertyiterator)
|
|
53
53
|
* [Parameters](#parameters-4)
|
|
54
|
+
* [getProperties](#getproperties)
|
|
55
|
+
* [Parameters](#parameters-5)
|
|
54
56
|
* [priority](#priority)
|
|
55
57
|
* [expression](#expression)
|
|
56
|
-
* [Parameters](#parameters-5)
|
|
57
|
-
* [templateContent](#templatecontent)
|
|
58
58
|
* [Parameters](#parameters-6)
|
|
59
|
+
* [templateContent](#templatecontent)
|
|
60
|
+
* [Parameters](#parameters-7)
|
|
59
61
|
* [isTemplate](#istemplate)
|
|
60
62
|
* [property](#property)
|
|
61
|
-
* [Parameters](#parameters-7)
|
|
62
|
-
* [expand](#expand)
|
|
63
63
|
* [Parameters](#parameters-8)
|
|
64
|
+
* [expand](#expand)
|
|
65
|
+
* [Parameters](#parameters-9)
|
|
64
66
|
* [PortEndpoint](#portendpoint)
|
|
65
|
-
* [Parameters](#parameters-
|
|
67
|
+
* [Parameters](#parameters-10)
|
|
66
68
|
* [port](#port)
|
|
67
69
|
* [socketAddress](#socketaddress)
|
|
68
70
|
* [HTTPEndpoint](#httpendpoint)
|
|
69
|
-
* [Parameters](#parameters-
|
|
71
|
+
* [Parameters](#parameters-11)
|
|
70
72
|
* [port](#port-1)
|
|
71
73
|
* [id](#id)
|
|
72
|
-
* [InitializationContext](#initializationcontext)
|
|
73
|
-
* [Parameters](#parameters-11)
|
|
74
74
|
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
75
75
|
* [networkAddresses](#networkaddresses)
|
|
76
76
|
* [Parameters](#parameters-12)
|
|
77
|
+
* [InitializationContext](#initializationcontext)
|
|
78
|
+
* [Parameters](#parameters-13)
|
|
77
79
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
78
80
|
* [Properties](#properties)
|
|
79
81
|
* [systemdConfigs](#systemdconfigs)
|
|
80
|
-
* [Parameters](#parameters-
|
|
82
|
+
* [Parameters](#parameters-14)
|
|
81
83
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
82
84
|
* [Properties](#properties-1)
|
|
83
85
|
* [systemdConfigs](#systemdconfigs-1)
|
|
84
|
-
* [Parameters](#parameters-
|
|
86
|
+
* [Parameters](#parameters-15)
|
|
85
87
|
* [NetworkAddress](#networkaddress)
|
|
86
|
-
* [Parameters](#parameters-
|
|
88
|
+
* [Parameters](#parameters-16)
|
|
87
89
|
* [subnet](#subnet)
|
|
88
90
|
* [networkInterface](#networkinterface)
|
|
89
91
|
* [address](#address)
|
|
90
92
|
* [addresses](#addresses)
|
|
91
|
-
* [Parameters](#parameters-16)
|
|
92
|
-
* [cidrAddresses](#cidraddresses)
|
|
93
93
|
* [Parameters](#parameters-17)
|
|
94
|
+
* [cidrAddresses](#cidraddresses)
|
|
95
|
+
* [Parameters](#parameters-18)
|
|
94
96
|
* [secretName](#secretname)
|
|
95
97
|
* [isTemplate](#istemplate-1)
|
|
96
98
|
* [named](#named)
|
|
97
|
-
* [Parameters](#parameters-18)
|
|
98
|
-
* [serviceEndpoints](#serviceendpoints)
|
|
99
99
|
* [Parameters](#parameters-19)
|
|
100
|
-
* [
|
|
100
|
+
* [serviceEndpoints](#serviceendpoints)
|
|
101
101
|
* [Parameters](#parameters-20)
|
|
102
|
-
* [
|
|
102
|
+
* [domainName](#domainname)
|
|
103
103
|
* [Parameters](#parameters-21)
|
|
104
|
-
* [
|
|
104
|
+
* [domainFromDominName](#domainfromdominname)
|
|
105
105
|
* [Parameters](#parameters-22)
|
|
106
|
-
* [
|
|
106
|
+
* [sectionLines](#sectionlines)
|
|
107
107
|
* [Parameters](#parameters-23)
|
|
108
|
-
* [
|
|
108
|
+
* [asArray](#asarray)
|
|
109
109
|
* [Parameters](#parameters-24)
|
|
110
|
+
* [asIterator](#asiterator)
|
|
111
|
+
* [Parameters](#parameters-25)
|
|
110
112
|
|
|
111
113
|
## Base
|
|
112
114
|
|
|
@@ -118,6 +120,17 @@ properties: use defined values to support attribute value definitions
|
|
|
118
120
|
* `owner` **[Base](#base)** 
|
|
119
121
|
* `data` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** 
|
|
120
122
|
|
|
123
|
+
### unionFromDirections
|
|
124
|
+
|
|
125
|
+
Deliver union set of all property values.
|
|
126
|
+
|
|
127
|
+
#### Parameters
|
|
128
|
+
|
|
129
|
+
* `directions` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** (optional, default `["this","extends","owner"]`)
|
|
130
|
+
* `property` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
131
|
+
|
|
132
|
+
Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)\<any>** 
|
|
133
|
+
|
|
121
134
|
### walkDirections
|
|
122
135
|
|
|
123
136
|
Walk the object graph in some directions and deliver seen nodes.
|
|
@@ -237,14 +250,6 @@ Returns **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G
|
|
|
237
250
|
|
|
238
251
|
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
|
|
239
252
|
|
|
240
|
-
## InitializationContext
|
|
241
|
-
|
|
242
|
-
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
243
|
-
|
|
244
|
-
### Parameters
|
|
245
|
-
|
|
246
|
-
* `directory` (optional, default `"/"`)
|
|
247
|
-
|
|
248
253
|
## SkeletonNetworkInterface
|
|
249
254
|
|
|
250
255
|
**Extends ServiceOwner**
|
|
@@ -257,6 +262,14 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
257
262
|
|
|
258
263
|
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
259
264
|
|
|
265
|
+
## InitializationContext
|
|
266
|
+
|
|
267
|
+
Keeps track of all in flight object creations and loose ends during config initialization.
|
|
268
|
+
|
|
269
|
+
### Parameters
|
|
270
|
+
|
|
271
|
+
* `directory` (optional, default `"/"`)
|
|
272
|
+
|
|
260
273
|
## SystemdJournalRemoteService
|
|
261
274
|
|
|
262
275
|
**Extends Service**
|
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -127,7 +127,13 @@ export class Base {
|
|
|
127
127
|
return this.owner.addObject(object);
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Deliver union set of all property values.
|
|
132
|
+
* @param {string[]} directions
|
|
133
|
+
* @param {string} property
|
|
134
|
+
* @returns {Set<any>}
|
|
135
|
+
*/
|
|
136
|
+
unionFromDirections(directions, property) {
|
|
131
137
|
let collected = new Set();
|
|
132
138
|
for (const node of this.walkDirections(directions)) {
|
|
133
139
|
collected = collected.union(node[property]);
|
|
@@ -423,7 +429,7 @@ export class Base {
|
|
|
423
429
|
}
|
|
424
430
|
|
|
425
431
|
get tags() {
|
|
426
|
-
return this.
|
|
432
|
+
return this.unionFromDirections(["this", "extends"], "_tags");
|
|
427
433
|
}
|
|
428
434
|
|
|
429
435
|
set tags(value) {
|
package/src/host.mjs
CHANGED
|
@@ -193,7 +193,7 @@ export class Host extends ServiceOwner {
|
|
|
193
193
|
|
|
194
194
|
get derivedPackaging() {
|
|
195
195
|
return this.expand(
|
|
196
|
-
this.
|
|
196
|
+
this.unionFromDirections(["this", "extends"], "_packaging")
|
|
197
197
|
);
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -219,7 +219,7 @@ export class Host extends ServiceOwner {
|
|
|
219
219
|
|
|
220
220
|
get aliases() {
|
|
221
221
|
return this.expand(
|
|
222
|
-
this.
|
|
222
|
+
this.unionFromDirections(["this", "extends"], "_aliases")
|
|
223
223
|
);
|
|
224
224
|
}
|
|
225
225
|
|
|
@@ -229,7 +229,7 @@ export class Host extends ServiceOwner {
|
|
|
229
229
|
|
|
230
230
|
get provides() {
|
|
231
231
|
return this.expand(
|
|
232
|
-
this.
|
|
232
|
+
this.unionFromDirections(["this", "extends"], "_provides")
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
235
|
|
|
@@ -239,7 +239,7 @@ export class Host extends ServiceOwner {
|
|
|
239
239
|
|
|
240
240
|
get replaces() {
|
|
241
241
|
return this.expand(
|
|
242
|
-
this.
|
|
242
|
+
this.unionFromDirections(["this", "extends"], "_replaces")
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
245
|
|
|
@@ -249,7 +249,7 @@ export class Host extends ServiceOwner {
|
|
|
249
249
|
|
|
250
250
|
get depends() {
|
|
251
251
|
return this.expand(
|
|
252
|
-
this.
|
|
252
|
+
this.unionFromDirections(["this", "extends"], "_depends")
|
|
253
253
|
);
|
|
254
254
|
}
|
|
255
255
|
|
|
@@ -459,9 +459,9 @@ export class Host extends ServiceOwner {
|
|
|
459
459
|
|
|
460
460
|
await generateKnownHosts(this.owner.hosts, join(dir, "root", ".ssh"));
|
|
461
461
|
|
|
462
|
-
console.log([...this.walkDirections(["extends"])].map(e => e.fullName));
|
|
462
|
+
//console.log([...this.walkDirections(["extends"])].map(e => e.fullName));
|
|
463
463
|
|
|
464
|
-
for (const service of this.
|
|
464
|
+
for (const service of this.allServices) {
|
|
465
465
|
//console.log("SERVICE",service.name);
|
|
466
466
|
|
|
467
467
|
if (service.systemdConfigs) {
|
package/src/service-owner.mjs
CHANGED
|
@@ -3,6 +3,17 @@ import { Base, Service } from "pmcf";
|
|
|
3
3
|
export class ServiceOwner extends Base {
|
|
4
4
|
services = [];
|
|
5
5
|
|
|
6
|
+
get allServices()
|
|
7
|
+
{
|
|
8
|
+
return this._allServices();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
*_allServices() {
|
|
12
|
+
for (const node of this.walkDirections(["this", "extends"])) {
|
|
13
|
+
yield* node.services;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
6
17
|
materializeExtends() {
|
|
7
18
|
super.materializeExtends();
|
|
8
19
|
|
|
@@ -17,9 +28,10 @@ export class ServiceOwner extends Base {
|
|
|
17
28
|
const present = this.services.find(s => s.name === service.name);
|
|
18
29
|
|
|
19
30
|
if (present) {
|
|
20
|
-
//console.log("LINK", present.fullName, service.fullName);
|
|
31
|
+
//console.log("LINK SERVICE", this.fullName, present.fullName, service.fullName);
|
|
21
32
|
present.extends.add(service);
|
|
22
33
|
} else {
|
|
34
|
+
//console.log("ADD SERVICE", this.fullName, service.fullName);
|
|
23
35
|
this.services.push(service.forOwner(this));
|
|
24
36
|
}
|
|
25
37
|
}
|