pmcf 2.10.0 → 2.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmcf",
3
- "version": "2.10.0",
3
+ "version": "2.10.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -1,4 +1,4 @@
1
- import { writeFile, mkdir, copyFile, glob, chmod } from "node:fs/promises";
1
+ import { writeFile, mkdir, copyFile, glob, chmod, stat } from "node:fs/promises";
2
2
  import { join } from "node:path";
3
3
  import { writeLines, sectionLines } from "../src/utils.mjs";
4
4
  import { addHook } from "./hooks.mjs";
@@ -142,8 +142,11 @@ export async function copySshKeys(host, packageData) {
142
142
  await copyFile(join(host.directory, file), destinationFileName);
143
143
  await chmod(
144
144
  destinationFileName,
145
- destinationFileName.endsWith(".pub") ? 0o0644 : 0o0600
145
+ destinationFileName.endsWith(".pub") ? 0o644 : 0o600
146
146
  );
147
+
148
+ const s = await stat(destinationFileName);
149
+ console.log(destinationFileName,s.mode)
147
150
  }
148
151
  }
149
152
 
@@ -201,7 +201,7 @@ export class DHCPService extends Service {
201
201
  .map((subnet, index) => {
202
202
  return {
203
203
  id: index + 1,
204
- subnet: subnet.address,
204
+ subnet: subnet.longAddress,
205
205
  pools: [{ pool: subnet.addressRange.join(" - ") }],
206
206
  "option-data": [
207
207
  {
package/src/subnet.mjs CHANGED
@@ -61,10 +61,24 @@ export class Subnet extends Base {
61
61
  return isIPv6Address(this.address);
62
62
  }
63
63
 
64
- get addressRange()
65
- {
64
+ get addressRange() {
66
65
  const l = this.prefixLength;
67
- return l === 24 ? [this.prefix + '.0', this.prefix + '.255'] : [this.prefix + '.0.0', this.prefix + '.255.255']
66
+ return l === 24
67
+ ? [this.prefix + ".0", this.prefix + ".255"]
68
+ : [this.prefix + ".0.0", this.prefix + ".255.255"];
69
+ }
70
+
71
+ get longPrefix() {
72
+ const prefix = this.prefix;
73
+
74
+ switch (this.prefixLength) {
75
+ case 24:
76
+ return prefix + ".0";
77
+ case 16:
78
+ return prefix + ".0.0";
79
+ }
80
+
81
+ return prefix;
68
82
  }
69
83
 
70
84
  get prefix() {
@@ -83,6 +97,10 @@ export class Subnet extends Base {
83
97
  return this.name;
84
98
  }
85
99
 
100
+ get longAddress() {
101
+ return `${this.longPrefix}/${this.prefixLength}`;
102
+ }
103
+
86
104
  _traverse(...args) {
87
105
  if (super._traverse(...args)) {
88
106
  for (const network of this.networks) {
@@ -31,9 +31,11 @@ export class Subnet extends Base {
31
31
  get isIPv4(): boolean;
32
32
  get isIPv6(): boolean;
33
33
  get addressRange(): string[];
34
+ get longPrefix(): string;
34
35
  get prefix(): string;
35
36
  get prefixLength(): number;
36
37
  get address(): string;
38
+ get longAddress(): string;
37
39
  _traverse(...args: any[]): boolean;
38
40
  }
39
41
  import { Base } from "./base.mjs";