@openstrap/utm 0.1.0 → 0.2.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/dist/index.js +30 -2
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -177,6 +177,7 @@ var ImageCache = class _ImageCache {
|
|
|
177
177
|
|
|
178
178
|
// src/seed/CloudInitSeed.ts
|
|
179
179
|
import { execFile as execFile2 } from "node:child_process";
|
|
180
|
+
import { randomBytes } from "node:crypto";
|
|
180
181
|
import { mkdtemp, rm as rm3, writeFile } from "node:fs/promises";
|
|
181
182
|
import { tmpdir } from "node:os";
|
|
182
183
|
import { join as join3 } from "node:path";
|
|
@@ -215,6 +216,31 @@ var CloudInitSeed = class {
|
|
|
215
216
|
].join("\n");
|
|
216
217
|
}
|
|
217
218
|
userData(request) {
|
|
219
|
+
const own = this.ownUserData(request);
|
|
220
|
+
if (request.userData === void 0) return own;
|
|
221
|
+
const boundary = `openstrap-${randomBytes(16).toString("hex")}`;
|
|
222
|
+
return [
|
|
223
|
+
`Content-Type: multipart/mixed; boundary="${boundary}"`,
|
|
224
|
+
"MIME-Version: 1.0",
|
|
225
|
+
"",
|
|
226
|
+
`--${boundary}`,
|
|
227
|
+
'Content-Type: text/cloud-config; charset="utf-8"',
|
|
228
|
+
'Content-Disposition: attachment; filename="openstrap.cfg"',
|
|
229
|
+
"",
|
|
230
|
+
own,
|
|
231
|
+
`--${boundary}`,
|
|
232
|
+
// text/plain: cloud-init tells the part's kind from how it starts (#cloud-config, #!, …).
|
|
233
|
+
'Content-Type: text/plain; charset="utf-8"',
|
|
234
|
+
'Content-Disposition: attachment; filename="project"',
|
|
235
|
+
"Merge-Type: list(append)+dict(recurse_array)+str()",
|
|
236
|
+
"",
|
|
237
|
+
request.userData.endsWith("\n") ? request.userData : `${request.userData}
|
|
238
|
+
`,
|
|
239
|
+
`--${boundary}--`,
|
|
240
|
+
""
|
|
241
|
+
].join("\n");
|
|
242
|
+
}
|
|
243
|
+
ownUserData(request) {
|
|
218
244
|
return [
|
|
219
245
|
"#cloud-config",
|
|
220
246
|
"users:",
|
|
@@ -608,7 +634,8 @@ var UTM = class {
|
|
|
608
634
|
scopes: ["guest"],
|
|
609
635
|
types: ["vm"],
|
|
610
636
|
resize: false,
|
|
611
|
-
portForward: true
|
|
637
|
+
portForward: true,
|
|
638
|
+
cloudInit: true
|
|
612
639
|
};
|
|
613
640
|
seed = new CloudInitSeed();
|
|
614
641
|
disk = new MachineDisk();
|
|
@@ -670,7 +697,8 @@ var UTM = class {
|
|
|
670
697
|
name: request.name,
|
|
671
698
|
user: request.user,
|
|
672
699
|
publicKey: request.publicKey,
|
|
673
|
-
destination: join4(this.cacheDirectory, `${request.name}-seed.iso`)
|
|
700
|
+
destination: join4(this.cacheDirectory, `${request.name}-seed.iso`),
|
|
701
|
+
...request.userData === void 0 ? {} : { userData: request.userData }
|
|
674
702
|
});
|
|
675
703
|
await this.machines.attachDrives(id, [
|
|
676
704
|
{ source: disk },
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openstrap/utm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "OpenStrap UTM provider plugin",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/yardencom/openstrap-utm.git"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"exports": {
|
|
8
12
|
".": "./dist/index.js"
|
|
@@ -22,7 +26,7 @@
|
|
|
22
26
|
"prepublishOnly": "npm run typecheck && npm test && npm run build"
|
|
23
27
|
},
|
|
24
28
|
"devDependencies": {
|
|
25
|
-
"@openstrap/plugin-contract": "^0.
|
|
29
|
+
"@openstrap/plugin-contract": "^0.2.0",
|
|
26
30
|
"@types/node": "^24.10.1",
|
|
27
31
|
"esbuild": "0.28.1",
|
|
28
32
|
"tsx": "^4.23.1",
|