pmcf 1.48.0 → 1.48.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.
- package/bin/pmcf-host-defs +5 -1
- package/bin/pmcf-named-defs +1 -1
- package/package.json +1 -1
- package/src/host.mjs +2 -0
- package/src/utils.mjs +5 -6
- package/types/host.d.mts +1 -1
package/bin/pmcf-host-defs
CHANGED
|
@@ -15,7 +15,10 @@ const host = await root.load(hostName, { type: types.host });
|
|
|
15
15
|
await generateNetworkDefs(host, options.output);
|
|
16
16
|
await generateMachineInfo(host, options.output);
|
|
17
17
|
await copySshKeys(host, options.output);
|
|
18
|
-
await generateKnownHosts(
|
|
18
|
+
await generateKnownHosts(
|
|
19
|
+
host.owner.hosts(),
|
|
20
|
+
join(options.output, "root", ".ssh")
|
|
21
|
+
);
|
|
19
22
|
|
|
20
23
|
console.log("provides", "host", ...host.provides);
|
|
21
24
|
console.log("depends", `location-${host.location.name}`, ...host.depends);
|
|
@@ -165,6 +168,7 @@ async function generateKnownHosts(hosts, dir) {
|
|
|
165
168
|
for await (const host of hosts) {
|
|
166
169
|
try {
|
|
167
170
|
const [alg, key, desc] = (await host.publicKey("ed25519")).split(/\s+/);
|
|
171
|
+
|
|
168
172
|
keys.push(`${host.domainName} ${alg} ${key}`);
|
|
169
173
|
|
|
170
174
|
for await (const addr of host.networkAddresses()) {
|
package/bin/pmcf-named-defs
CHANGED
|
@@ -32,7 +32,7 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
32
32
|
const zones = [];
|
|
33
33
|
const records = new Set();
|
|
34
34
|
|
|
35
|
-
const nameserver = (await owner.
|
|
35
|
+
const nameserver = (await owner.findService({ type: "dns" }))?.owner;
|
|
36
36
|
const rname = dns.administratorEmail.replace(/@/, ".");
|
|
37
37
|
|
|
38
38
|
let maxKeyLength;
|
package/package.json
CHANGED
package/src/host.mjs
CHANGED
package/src/utils.mjs
CHANGED
|
@@ -3,9 +3,10 @@ import { join } from "node:path";
|
|
|
3
3
|
|
|
4
4
|
export async function writeLines(dir, name, lines) {
|
|
5
5
|
await mkdir(dir, { recursive: true });
|
|
6
|
+
if (typeof lines === "string") lines = [lines];
|
|
6
7
|
return writeFile(
|
|
7
8
|
join(dir, name),
|
|
8
|
-
[...
|
|
9
|
+
[...lines]
|
|
9
10
|
.flat()
|
|
10
11
|
.filter(line => line !== undefined)
|
|
11
12
|
.map(l => l + "\n")
|
|
@@ -130,9 +131,8 @@ export function encodeIP(address) {
|
|
|
130
131
|
return _encode(isIPv4Address(address) ? ipv4 : ipv6, address);
|
|
131
132
|
}
|
|
132
133
|
|
|
133
|
-
export function formatCIDR(address,subnet)
|
|
134
|
-
{
|
|
135
|
-
return subnet ? `${address}/${subnet.prefixLength}`: address;
|
|
134
|
+
export function formatCIDR(address, subnet) {
|
|
135
|
+
return subnet ? `${address}/${subnet.prefixLength}` : address;
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
export function normalizeCIDR(address) {
|
|
@@ -164,8 +164,7 @@ export function normalizeCIDR(address) {
|
|
|
164
164
|
return { prefix, prefixLength, cidr: `${prefix}/${prefixLength}` };
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
export function hasWellKnownSubnet(address)
|
|
168
|
-
{
|
|
167
|
+
export function hasWellKnownSubnet(address) {
|
|
169
168
|
const n = encodeIP(address);
|
|
170
169
|
return n === IPV4_LOCALHOST || n === IPV6_LOCALHOST || isLinkLocal(address);
|
|
171
170
|
}
|
package/types/host.d.mts
CHANGED
|
@@ -181,7 +181,7 @@ export class Host extends Base {
|
|
|
181
181
|
get rawAddress(): any;
|
|
182
182
|
get rawAddresses(): any[];
|
|
183
183
|
get cidrAddresses(): any[];
|
|
184
|
-
publicKey(type?: string): Promise<
|
|
184
|
+
publicKey(type?: string): Promise<string>;
|
|
185
185
|
#private;
|
|
186
186
|
}
|
|
187
187
|
export class NetworkInterface extends Base {
|