pmcf 1.47.0 → 1.47.2

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.
@@ -105,7 +105,7 @@ async function generateNetworkDefs(host, dir) {
105
105
  })
106
106
  );
107
107
 
108
- if (ni.arpbridge.length) {
108
+ if (ni.arpbridge) {
109
109
  networkSections.push(
110
110
  "",
111
111
  sectionLines("Link", { Promiscuous: "yes" })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "1.47.0",
3
+ "version": "1.47.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/base.mjs CHANGED
@@ -146,7 +146,11 @@ export class Base {
146
146
  this.owner.typeNamed(property.type.name, value) ||
147
147
  this.root.typeNamed(property.type.name, value); // TODO
148
148
 
149
- assign(property, object);
149
+ if (object) {
150
+ assign(property, object);
151
+ } else {
152
+ this.error("Not found", property.name, property.type.name, value);
153
+ }
150
154
  });
151
155
  }
152
156
  }
package/src/host.mjs CHANGED
@@ -23,14 +23,13 @@ const HostTypeDefinition = {
23
23
  },
24
24
  services: { type: "service", collection: true, writeable: true },
25
25
  os: { type: "string", collection: false, writeable: true },
26
+ "machine-id": { type: "string", collection: false, writeable: true },
26
27
  distribution: { type: "string", collection: false, writeable: true },
27
28
  deployment: { type: "string", collection: false, writeable: true },
28
29
  master: { type: "boolean", collection: false, writeable: true },
29
- model: { type: "string", collection: false, writeable: false },
30
30
  serial: { type: "string", collection: false, writeable: true },
31
31
  vendor: { type: "string", collection: false, writeable: true },
32
32
  chassis: { type: "string", collection: false, writeable: true },
33
- isModel: { type: "boolean", collection: false, writeable: false },
34
33
  priority: { type: "number", collection: false, writeable: true },
35
34
  replaces: { type: "string", collection: true, writeable: true },
36
35
  depends: { type: "string", collection: true, writeable: true },
@@ -38,7 +37,9 @@ const HostTypeDefinition = {
38
37
  extends: { type: "host", collection: true, writeable: true },
39
38
  cidrAddresses: { type: "string", collection: true, writeable: false },
40
39
  rawAddresses: { type: "string", collection: true, writeable: false },
41
- rawAddress: { type: "string", collection: false, writeable: false }
40
+ rawAddress: { type: "string", collection: false, writeable: false },
41
+ model: { type: "string", collection: false, writeable: false },
42
+ isModel: { type: "boolean", collection: false, writeable: false }
42
43
  }
43
44
  };
44
45
 
@@ -140,7 +141,6 @@ export class Host extends Base {
140
141
 
141
142
  get extends() {
142
143
  return this.#extends;
143
- // return this.#extends.map(e => this.expand(e));
144
144
  }
145
145
 
146
146
  set provides(value) {
@@ -247,20 +247,24 @@ export class Host extends Base {
247
247
  }
248
248
  }
249
249
 
250
+ typeNamed(typeName, name) {
251
+ if (typeName === NetworkInterfaceTypeDefinition.name) {
252
+ const ni = this.#networkInterfaces.get(name);
253
+ if (ni) {
254
+ return ni;
255
+ }
256
+ }
257
+
258
+ return super.typeNamed(typeName, name);
259
+ }
260
+
250
261
  get networkInterfaces() {
251
262
  return this.#networkInterfaces;
252
263
  }
253
264
 
254
265
  set networkInterfaces(networkInterface) {
255
266
  this.#networkInterfaces.set(networkInterface.name, networkInterface);
256
-
257
- if (networkInterface.network) {
258
- networkInterface.network.addObject(this);
259
- }
260
- }
261
-
262
- networkInterfaceNamed(name) {
263
- return this.#networkInterfaces.get(name);
267
+ networkInterface.network?.addObject(this);
264
268
  }
265
269
 
266
270
  *networkAddresses() {
@@ -306,8 +310,8 @@ const NetworkInterfaceTypeDefinition = {
306
310
  cidrAddresses: { type: "string", collection: true, writeable: false },
307
311
  rawAddresses: { type: "string", collection: true, writeable: false },
308
312
  network: { type: "network", collection: false, writeable: true },
309
- destination: { type: "host", collection: false, writeable: true },
310
- arpbridge: { type: "host", collection: true, writeable: true }
313
+ destination: { type: "string", collection: false, writeable: true },
314
+ arpbridge: { type: "network_interface", collection: true, writeable: true }
311
315
  }
312
316
  };
313
317
 
@@ -333,7 +337,6 @@ export class NetworkInterface extends Base {
333
337
  constructor(owner, data) {
334
338
  super(owner, data);
335
339
  this.read(data, NetworkInterfaceTypeDefinition);
336
- //owner.addNetworkInterface(this);
337
340
  }
338
341
 
339
342
  addSubnet(address) {
@@ -404,6 +407,10 @@ export class NetworkInterface extends Base {
404
407
  return this.owner;
405
408
  }
406
409
 
410
+ get network_interface() {
411
+ return this;
412
+ }
413
+
407
414
  get network() {
408
415
  return this.#network || this.host.network;
409
416
  }
package/types/host.d.mts CHANGED
@@ -51,22 +51,22 @@ export class Host extends Base {
51
51
  collection: boolean;
52
52
  writeable: boolean;
53
53
  };
54
- distribution: {
54
+ "machine-id": {
55
55
  type: string;
56
56
  collection: boolean;
57
57
  writeable: boolean;
58
58
  };
59
- deployment: {
59
+ distribution: {
60
60
  type: string;
61
61
  collection: boolean;
62
62
  writeable: boolean;
63
63
  };
64
- master: {
64
+ deployment: {
65
65
  type: string;
66
66
  collection: boolean;
67
67
  writeable: boolean;
68
68
  };
69
- model: {
69
+ master: {
70
70
  type: string;
71
71
  collection: boolean;
72
72
  writeable: boolean;
@@ -86,11 +86,6 @@ export class Host extends Base {
86
86
  collection: boolean;
87
87
  writeable: boolean;
88
88
  };
89
- isModel: {
90
- type: string;
91
- collection: boolean;
92
- writeable: boolean;
93
- };
94
89
  priority: {
95
90
  type: string;
96
91
  collection: boolean;
@@ -131,6 +126,16 @@ export class Host extends Base {
131
126
  collection: boolean;
132
127
  writeable: boolean;
133
128
  };
129
+ model: {
130
+ type: string;
131
+ collection: boolean;
132
+ writeable: boolean;
133
+ };
134
+ isModel: {
135
+ type: string;
136
+ collection: boolean;
137
+ writeable: boolean;
138
+ };
134
139
  };
135
140
  };
136
141
  postinstall: any[];
@@ -168,7 +173,6 @@ export class Host extends Base {
168
173
  findServices(filter: any): Generator<any, void, unknown>;
169
174
  set networkInterfaces(networkInterface: Map<any, any>);
170
175
  get networkInterfaces(): Map<any, any>;
171
- networkInterfaceNamed(name: any): any;
172
176
  networkAddresses(): Generator<{
173
177
  networkInterface: any;
174
178
  address: any;
@@ -302,6 +306,7 @@ export class NetworkInterface extends Base {
302
306
  subnetForAddress(address: any): any;
303
307
  get gateway(): any;
304
308
  get gatewayAddress(): any;
309
+ get network_interface(): this;
305
310
  set network(network: any);
306
311
  get network(): any;
307
312
  set scope(value: any);