git.delta.rocks / jrsonnet / refs/commits / 87c4900cde09

difftreelog

refactor prepare for decoupling fleet-cli from fleet-data-storage

Yaroslav Bolyukin2024-08-31parent: #213ad7d.patch.diff
in: trunk

26 files changed

modifiedCargo.lockdiffbeforeafterboth
214source = "registry+https://github.com/rust-lang/crates.io-index"214source = "registry+https://github.com/rust-lang/crates.io-index"
215checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"215checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
216
217[[package]]
218name = "async-stream"
219version = "0.3.5"
220source = "registry+https://github.com/rust-lang/crates.io-index"
221checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51"
222dependencies = [
223 "async-stream-impl",
224 "futures-core",
225 "pin-project-lite",
226]
227
228[[package]]
229name = "async-stream-impl"
230version = "0.3.5"
231source = "registry+https://github.com/rust-lang/crates.io-index"
232checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193"
233dependencies = [
234 "proc-macro2",
235 "quote",
236 "syn 2.0.76",
237]
216238
217[[package]]239[[package]]
218name = "async-trait"240name = "async-trait"
219version = "0.1.80"241version = "0.1.81"
220source = "registry+https://github.com/rust-lang/crates.io-index"242source = "registry+https://github.com/rust-lang/crates.io-index"
221checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca"243checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107"
222dependencies = [244dependencies = [
223 "proc-macro2",245 "proc-macro2",
224 "quote",246 "quote",
225 "syn 2.0.66",247 "syn 2.0.76",
226]248]
249
250[[package]]
251name = "atomic-waker"
252version = "1.1.2"
253source = "registry+https://github.com/rust-lang/crates.io-index"
254checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
227255
228[[package]]256[[package]]
229name = "autocfg"257name = "autocfg"
230version = "1.3.0"258version = "1.3.0"
231source = "registry+https://github.com/rust-lang/crates.io-index"259source = "registry+https://github.com/rust-lang/crates.io-index"
232checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"260checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
261
262[[package]]
263name = "axum"
264version = "0.7.5"
265source = "registry+https://github.com/rust-lang/crates.io-index"
266checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf"
267dependencies = [
268 "async-trait",
269 "axum-core",
270 "bytes",
271 "futures-util",
272 "http",
273 "http-body",
274 "http-body-util",
275 "itoa",
276 "matchit",
277 "memchr",
278 "mime",
279 "percent-encoding",
280 "pin-project-lite",
281 "rustversion",
282 "serde",
283 "sync_wrapper 1.0.1",
284 "tower",
285 "tower-layer",
286 "tower-service",
287]
288
289[[package]]
290name = "axum-core"
291version = "0.4.3"
292source = "registry+https://github.com/rust-lang/crates.io-index"
293checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3"
294dependencies = [
295 "async-trait",
296 "bytes",
297 "futures-util",
298 "http",
299 "http-body",
300 "http-body-util",
301 "mime",
302 "pin-project-lite",
303 "rustversion",
304 "sync_wrapper 0.1.2",
305 "tower-layer",
306 "tower-service",
307]
233308
234[[package]]309[[package]]
235name = "backtrace"310name = "backtrace"
482 "heck 0.5.0",557 "heck 0.5.0",
483 "proc-macro2",558 "proc-macro2",
484 "quote",559 "quote",
485 "syn 2.0.66",560 "syn 2.0.76",
486]561]
487562
488[[package]]563[[package]]
617dependencies = [692dependencies = [
618 "proc-macro2",693 "proc-macro2",
619 "quote",694 "quote",
620 "syn 2.0.66",695 "syn 2.0.76",
621]696]
622697
623[[package]]698[[package]]
673dependencies = [748dependencies = [
674 "proc-macro2",749 "proc-macro2",
675 "quote",750 "quote",
676 "syn 2.0.66",751 "syn 2.0.76",
677]752]
678753
679[[package]]754[[package]]
761 "toml 0.5.11",836 "toml 0.5.11",
762]837]
838
839[[package]]
840name = "fixedbitset"
841version = "0.4.2"
842source = "registry+https://github.com/rust-lang/crates.io-index"
843checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
763844
764[[package]]845[[package]]
765name = "fleet"846name = "fleet"
776 "clap",857 "clap",
777 "clap_complete",858 "clap_complete",
778 "crossterm",859 "crossterm",
860 "fleet-base",
779 "fleet-shared",861 "fleet-shared",
780 "futures",862 "futures",
781 "hostname",863 "hostname",
785 "nix-eval",867 "nix-eval",
786 "nixlike",868 "nixlike",
787 "nom",869 "nom",
788 "openssh",870 "openssh 0.10.4",
789 "owo-colors",871 "owo-colors",
790 "peg",872 "peg",
791 "regex",873 "regex",
802 "tracing-subscriber",884 "tracing-subscriber",
803]885]
886
887[[package]]
888name = "fleet-base"
889version = "0.1.0"
890dependencies = [
891 "age",
892 "anyhow",
893 "better-command",
894 "chrono",
895 "clap",
896 "fleet-shared",
897 "futures",
898 "hostname",
899 "itertools",
900 "nix-eval",
901 "nixlike",
902 "nom",
903 "openssh 0.11.0",
904 "serde",
905 "serde_json",
906 "tempfile",
907 "tokio",
908 "tokio-util",
909 "tracing",
910]
804911
805[[package]]912[[package]]
806name = "fleet-generator-helper"913name = "fleet-generator-helper"
949dependencies = [1056dependencies = [
950 "proc-macro2",1057 "proc-macro2",
951 "quote",1058 "quote",
952 "syn 2.0.66",1059 "syn 2.0.76",
953]1060]
9541061
955[[package]]1062[[package]]
1019source = "registry+https://github.com/rust-lang/crates.io-index"1126source = "registry+https://github.com/rust-lang/crates.io-index"
1020checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"1127checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
1128
1129[[package]]
1130name = "h2"
1131version = "0.4.6"
1132source = "registry+https://github.com/rust-lang/crates.io-index"
1133checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205"
1134dependencies = [
1135 "atomic-waker",
1136 "bytes",
1137 "fnv",
1138 "futures-core",
1139 "futures-sink",
1140 "http",
1141 "indexmap 2.2.6",
1142 "slab",
1143 "tokio",
1144 "tokio-util",
1145 "tracing",
1146]
10211147
1022[[package]]1148[[package]]
1023name = "hashbrown"1149name = "hashbrown"
1024version = "0.9.1"1150version = "0.9.1"
1025source = "registry+https://github.com/rust-lang/crates.io-index"1151source = "registry+https://github.com/rust-lang/crates.io-index"
1026checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"1152checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
1153
1154[[package]]
1155name = "hashbrown"
1156version = "0.12.3"
1157source = "registry+https://github.com/rust-lang/crates.io-index"
1158checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
10271159
1028[[package]]1160[[package]]
1029name = "hashbrown"1161name = "hashbrown"
1084 "windows",1216 "windows",
1085]1217]
1218
1219[[package]]
1220name = "http"
1221version = "1.1.0"
1222source = "registry+https://github.com/rust-lang/crates.io-index"
1223checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258"
1224dependencies = [
1225 "bytes",
1226 "fnv",
1227 "itoa",
1228]
1229
1230[[package]]
1231name = "http-body"
1232version = "1.0.1"
1233source = "registry+https://github.com/rust-lang/crates.io-index"
1234checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184"
1235dependencies = [
1236 "bytes",
1237 "http",
1238]
1239
1240[[package]]
1241name = "http-body-util"
1242version = "0.1.2"
1243source = "registry+https://github.com/rust-lang/crates.io-index"
1244checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f"
1245dependencies = [
1246 "bytes",
1247 "futures-util",
1248 "http",
1249 "http-body",
1250 "pin-project-lite",
1251]
1252
1253[[package]]
1254name = "httparse"
1255version = "1.9.4"
1256source = "registry+https://github.com/rust-lang/crates.io-index"
1257checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"
1258
1259[[package]]
1260name = "httpdate"
1261version = "1.0.3"
1262source = "registry+https://github.com/rust-lang/crates.io-index"
1263checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
10861264
1087[[package]]1265[[package]]
1088name = "human-repr"1266name = "human-repr"
1089version = "1.1.0"1267version = "1.1.0"
1090source = "registry+https://github.com/rust-lang/crates.io-index"1268source = "registry+https://github.com/rust-lang/crates.io-index"
1091checksum = "f58b778a5761513caf593693f8951c97a5b610841e754788400f32102eefdff1"1269checksum = "f58b778a5761513caf593693f8951c97a5b610841e754788400f32102eefdff1"
1270
1271[[package]]
1272name = "hyper"
1273version = "1.4.1"
1274source = "registry+https://github.com/rust-lang/crates.io-index"
1275checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05"
1276dependencies = [
1277 "bytes",
1278 "futures-channel",
1279 "futures-util",
1280 "h2",
1281 "http",
1282 "http-body",
1283 "httparse",
1284 "httpdate",
1285 "itoa",
1286 "pin-project-lite",
1287 "smallvec",
1288 "tokio",
1289 "want",
1290]
1291
1292[[package]]
1293name = "hyper-timeout"
1294version = "0.5.1"
1295source = "registry+https://github.com/rust-lang/crates.io-index"
1296checksum = "3203a961e5c83b6f5498933e78b6b263e208c197b63e9c6c53cc82ffd3f63793"
1297dependencies = [
1298 "hyper",
1299 "hyper-util",
1300 "pin-project-lite",
1301 "tokio",
1302 "tower-service",
1303]
1304
1305[[package]]
1306name = "hyper-util"
1307version = "0.1.7"
1308source = "registry+https://github.com/rust-lang/crates.io-index"
1309checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9"
1310dependencies = [
1311 "bytes",
1312 "futures-channel",
1313 "futures-util",
1314 "http",
1315 "http-body",
1316 "hyper",
1317 "pin-project-lite",
1318 "socket2",
1319 "tokio",
1320 "tower",
1321 "tower-service",
1322 "tracing",
1323]
10921324
1093[[package]]1325[[package]]
1094name = "i18n-config"1326name = "i18n-config"
1142 "proc-macro2",1374 "proc-macro2",
1143 "quote",1375 "quote",
1144 "strsim 0.10.0",1376 "strsim 0.10.0",
1145 "syn 2.0.66",1377 "syn 2.0.76",
1146 "unic-langid",1378 "unic-langid",
1147]1379]
11481380
1156 "i18n-config",1388 "i18n-config",
1157 "proc-macro2",1389 "proc-macro2",
1158 "quote",1390 "quote",
1159 "syn 2.0.66",1391 "syn 2.0.76",
1160]1392]
11611393
1162[[package]]1394[[package]]
1182 "cc",1414 "cc",
1183]1415]
1416
1417[[package]]
1418name = "indexmap"
1419version = "1.9.3"
1420source = "registry+https://github.com/rust-lang/crates.io-index"
1421checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
1422dependencies = [
1423 "autocfg",
1424 "hashbrown 0.12.3",
1425]
11841426
1185[[package]]1427[[package]]
1186name = "indexmap"1428name = "indexmap"
1303source = "registry+https://github.com/rust-lang/crates.io-index"1545source = "registry+https://github.com/rust-lang/crates.io-index"
1304checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"1546checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
1305dependencies = [1547dependencies = [
1306 "spin",1548 "spin 0.5.2",
1307]1549]
13081550
1309[[package]]1551[[package]]
1365 "regex-automata 0.1.10",1607 "regex-automata 0.1.10",
1366]1608]
1609
1610[[package]]
1611name = "matchit"
1612version = "0.7.3"
1613source = "registry+https://github.com/rust-lang/crates.io-index"
1614checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
13671615
1368[[package]]1616[[package]]
1369name = "memchr"1617name = "memchr"
1389 "libmimalloc-sys",1637 "libmimalloc-sys",
1390]1638]
1639
1640[[package]]
1641name = "mime"
1642version = "0.3.17"
1643source = "registry+https://github.com/rust-lang/crates.io-index"
1644checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
13911645
1392[[package]]1646[[package]]
1393name = "minimal-lexical"1647name = "minimal-lexical"
1416 "windows-sys 0.48.0",1670 "windows-sys 0.48.0",
1417]1671]
1672
1673[[package]]
1674name = "multimap"
1675version = "0.10.0"
1676source = "registry+https://github.com/rust-lang/crates.io-index"
1677checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03"
14181678
1419[[package]]1679[[package]]
1420name = "nix"1680name = "nix"
1587 "tokio-pipe",1847 "tokio-pipe",
1588]1848]
1849
1850[[package]]
1851name = "openssh"
1852version = "0.11.0"
1853source = "registry+https://github.com/rust-lang/crates.io-index"
1854checksum = "0f27389e5da64700a3efb7f925e442f824f6e3d4b1c27f75e115a92ad3aecbb1"
1855dependencies = [
1856 "libc",
1857 "once_cell",
1858 "shell-escape",
1859 "tempfile",
1860 "thiserror",
1861 "tokio",
1862]
15891863
1590[[package]]1864[[package]]
1591name = "overload"1865name = "overload"
1636 "windows-targets 0.52.5",1910 "windows-targets 0.52.5",
1637]1911]
1912
1913[[package]]
1914name = "paste"
1915version = "1.0.15"
1916source = "registry+https://github.com/rust-lang/crates.io-index"
1917checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"
16381918
1639[[package]]1919[[package]]
1640name = "pbkdf2"1920name = "pbkdf2"
1673source = "registry+https://github.com/rust-lang/crates.io-index"1953source = "registry+https://github.com/rust-lang/crates.io-index"
1674checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a"1954checksum = "e3aeb8f54c078314c2065ee649a7241f46b9d8e418e1a9581ba0546657d7aa3a"
1955
1956[[package]]
1957name = "pem"
1958version = "3.0.4"
1959source = "registry+https://github.com/rust-lang/crates.io-index"
1960checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae"
1961dependencies = [
1962 "base64 0.22.1",
1963 "serde",
1964]
1965
1966[[package]]
1967name = "percent-encoding"
1968version = "2.3.1"
1969source = "registry+https://github.com/rust-lang/crates.io-index"
1970checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"
1971
1972[[package]]
1973name = "petgraph"
1974version = "0.6.5"
1975source = "registry+https://github.com/rust-lang/crates.io-index"
1976checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db"
1977dependencies = [
1978 "fixedbitset",
1979 "indexmap 2.2.6",
1980]
16751981
1676[[package]]1982[[package]]
1677name = "pin-project"1983name = "pin-project"
1690dependencies = [1996dependencies = [
1691 "proc-macro2",1997 "proc-macro2",
1692 "quote",1998 "quote",
1693 "syn 2.0.66",1999 "syn 2.0.76",
1694]2000]
16952001
1696[[package]]2002[[package]]
1773source = "registry+https://github.com/rust-lang/crates.io-index"2079source = "registry+https://github.com/rust-lang/crates.io-index"
1774checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"2080checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
2081
2082[[package]]
2083name = "prettyplease"
2084version = "0.2.22"
2085source = "registry+https://github.com/rust-lang/crates.io-index"
2086checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba"
2087dependencies = [
2088 "proc-macro2",
2089 "syn 2.0.76",
2090]
17752091
1776[[package]]2092[[package]]
1777name = "proc-macro-error"2093name = "proc-macro-error"
1806 "unicode-ident",2122 "unicode-ident",
1807]2123]
2124
2125[[package]]
2126name = "prost"
2127version = "0.13.1"
2128source = "registry+https://github.com/rust-lang/crates.io-index"
2129checksum = "e13db3d3fde688c61e2446b4d843bc27a7e8af269a69440c0308021dc92333cc"
2130dependencies = [
2131 "bytes",
2132 "prost-derive",
2133]
2134
2135[[package]]
2136name = "prost-build"
2137version = "0.13.1"
2138source = "registry+https://github.com/rust-lang/crates.io-index"
2139checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1"
2140dependencies = [
2141 "bytes",
2142 "heck 0.5.0",
2143 "itertools",
2144 "log",
2145 "multimap",
2146 "once_cell",
2147 "petgraph",
2148 "prettyplease",
2149 "prost",
2150 "prost-types",
2151 "regex",
2152 "syn 2.0.76",
2153 "tempfile",
2154]
2155
2156[[package]]
2157name = "prost-derive"
2158version = "0.13.1"
2159source = "registry+https://github.com/rust-lang/crates.io-index"
2160checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca"
2161dependencies = [
2162 "anyhow",
2163 "itertools",
2164 "proc-macro2",
2165 "quote",
2166 "syn 2.0.76",
2167]
2168
2169[[package]]
2170name = "prost-types"
2171version = "0.13.1"
2172source = "registry+https://github.com/rust-lang/crates.io-index"
2173checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2"
2174dependencies = [
2175 "prost",
2176]
18082177
1809[[package]]2178[[package]]
1810name = "quote"2179name = "quote"
1856 "getrandom",2225 "getrandom",
1857]2226]
2227
2228[[package]]
2229name = "rcgen"
2230version = "0.13.1"
2231source = "registry+https://github.com/rust-lang/crates.io-index"
2232checksum = "54077e1872c46788540de1ea3d7f4ccb1983d12f9aa909b234468676c1a36779"
2233dependencies = [
2234 "pem",
2235 "ring",
2236 "rustls-pki-types",
2237 "time",
2238 "yasna",
2239]
18582240
1859[[package]]2241[[package]]
1860name = "redox_syscall"2242name = "redox_syscall"
1910checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"2292checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
19112293
1912[[package]]2294[[package]]
1913name = "remowt-fs"2295name = "ring"
1914version = "0.1.0"2296version = "0.17.8"
2297source = "registry+https://github.com/rust-lang/crates.io-index"
2298checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d"
2299dependencies = [
2300 "cc",
2301 "cfg-if",
2302 "getrandom",
2303 "libc",
2304 "spin 0.9.8",
2305 "untrusted",
2306 "windows-sys 0.52.0",
2307]
2308
2309[[package]]
2310name = "rmp"
2311version = "0.8.14"
2312source = "registry+https://github.com/rust-lang/crates.io-index"
2313checksum = "228ed7c16fa39782c3b3468e974aec2795e9089153cd08ee2e9aefb3613334c4"
2314dependencies = [
2315 "byteorder",
2316 "num-traits",
2317 "paste",
2318]
2319
2320[[package]]
2321name = "rmp-serde"
2322version = "1.3.0"
2323source = "registry+https://github.com/rust-lang/crates.io-index"
2324checksum = "52e599a477cf9840e92f2cde9a7189e67b42c57532749bf90aea6ec10facd4db"
2325dependencies = [
2326 "byteorder",
2327 "rmp",
2328 "serde",
2329]
19152330
1916[[package]]2331[[package]]
1917name = "rnix"2332name = "rnix"
1989 "proc-macro2",2404 "proc-macro2",
1990 "quote",2405 "quote",
1991 "rust-embed-utils",2406 "rust-embed-utils",
1992 "syn 2.0.66",2407 "syn 2.0.76",
1993 "walkdir",2408 "walkdir",
1994]2409]
19952410
2037 "windows-sys 0.52.0",2452 "windows-sys 0.52.0",
2038]2453]
2454
2455[[package]]
2456name = "rustls"
2457version = "0.23.12"
2458source = "registry+https://github.com/rust-lang/crates.io-index"
2459checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044"
2460dependencies = [
2461 "log",
2462 "once_cell",
2463 "ring",
2464 "rustls-pki-types",
2465 "rustls-webpki",
2466 "subtle",
2467 "zeroize",
2468]
2469
2470[[package]]
2471name = "rustls-pemfile"
2472version = "2.1.3"
2473source = "registry+https://github.com/rust-lang/crates.io-index"
2474checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425"
2475dependencies = [
2476 "base64 0.22.1",
2477 "rustls-pki-types",
2478]
2479
2480[[package]]
2481name = "rustls-pki-types"
2482version = "1.8.0"
2483source = "registry+https://github.com/rust-lang/crates.io-index"
2484checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"
2485
2486[[package]]
2487name = "rustls-webpki"
2488version = "0.102.7"
2489source = "registry+https://github.com/rust-lang/crates.io-index"
2490checksum = "84678086bd54edf2b415183ed7a94d0efb049f1b646a33e22a36f3794be6ae56"
2491dependencies = [
2492 "ring",
2493 "rustls-pki-types",
2494 "untrusted",
2495]
2496
2497[[package]]
2498name = "rustversion"
2499version = "1.0.17"
2500source = "registry+https://github.com/rust-lang/crates.io-index"
2501checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
20392502
2040[[package]]2503[[package]]
2041name = "ryu"2504name = "ryu"
2135 "serde",2598 "serde",
2136]2599]
2600
2601[[package]]
2602name = "serde_bytes"
2603version = "0.11.15"
2604source = "registry+https://github.com/rust-lang/crates.io-index"
2605checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a"
2606dependencies = [
2607 "serde",
2608]
21372609
2138[[package]]2610[[package]]
2139name = "serde_derive"2611name = "serde_derive"
2143dependencies = [2615dependencies = [
2144 "proc-macro2",2616 "proc-macro2",
2145 "quote",2617 "quote",
2146 "syn 2.0.66",2618 "syn 2.0.76",
2147]2619]
21482620
2149[[package]]2621[[package]]
2150name = "serde_json"2622name = "serde_json"
2151version = "1.0.117"2623version = "1.0.127"
2152source = "registry+https://github.com/rust-lang/crates.io-index"2624source = "registry+https://github.com/rust-lang/crates.io-index"
2153checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3"2625checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad"
2154dependencies = [2626dependencies = [
2155 "itoa",2627 "itoa",
2628 "memchr",
2156 "ryu",2629 "ryu",
2157 "serde",2630 "serde",
2158]2631]
2278source = "registry+https://github.com/rust-lang/crates.io-index"2751source = "registry+https://github.com/rust-lang/crates.io-index"
2279checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"2752checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
2753
2754[[package]]
2755name = "spin"
2756version = "0.9.8"
2757source = "registry+https://github.com/rust-lang/crates.io-index"
2758checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"
22802759
2281[[package]]2760[[package]]
2282name = "spki"2761name = "spki"
23292808
2330[[package]]2809[[package]]
2331name = "syn"2810name = "syn"
2332version = "2.0.66"2811version = "2.0.76"
2333source = "registry+https://github.com/rust-lang/crates.io-index"2812source = "registry+https://github.com/rust-lang/crates.io-index"
2334checksum = "c42f3f41a2de00b01c0aaad383c5a45241efc8b2d1eda5661812fda5f3cdcff5"2813checksum = "578e081a14e0cefc3279b0472138c513f37b41a08d5a3cca9b6e4e8ceb6cd525"
2335dependencies = [2814dependencies = [
2336 "proc-macro2",2815 "proc-macro2",
2337 "quote",2816 "quote",
2338 "unicode-ident",2817 "unicode-ident",
2339]2818]
2819
2820[[package]]
2821name = "sync_wrapper"
2822version = "0.1.2"
2823source = "registry+https://github.com/rust-lang/crates.io-index"
2824checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"
2825
2826[[package]]
2827name = "sync_wrapper"
2828version = "1.0.1"
2829source = "registry+https://github.com/rust-lang/crates.io-index"
2830checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"
23402831
2341[[package]]2832[[package]]
2342name = "tabled"2833name = "tabled"
2384 "windows-sys 0.48.0",2875 "windows-sys 0.48.0",
2385]2876]
2877
2878[[package]]
2879name = "terraform-provider-fleet"
2880version = "0.1.0"
2881dependencies = [
2882 "anyhow",
2883 "async-trait",
2884 "serde",
2885 "tf-provider",
2886 "tokio",
2887]
23862888
2387[[package]]2889[[package]]
2388name = "text-size"2890name = "text-size"
2389version = "1.1.1"2891version = "1.1.1"
2390source = "registry+https://github.com/rust-lang/crates.io-index"2892source = "registry+https://github.com/rust-lang/crates.io-index"
2391checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"2893checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233"
2894
2895[[package]]
2896name = "tf-provider"
2897version = "0.2.2"
2898source = "registry+https://github.com/rust-lang/crates.io-index"
2899checksum = "d80ea2e5f9f54717952d199888aab7e607dc99275ec5221f1259ce7a5f55f5a6"
2900dependencies = [
2901 "anyhow",
2902 "async-stream",
2903 "async-trait",
2904 "base64 0.22.1",
2905 "futures",
2906 "prost",
2907 "rcgen",
2908 "rmp-serde",
2909 "serde",
2910 "serde_bytes",
2911 "serde_json",
2912 "time",
2913 "tokio",
2914 "tokio-stream",
2915 "tokio-util",
2916 "tonic",
2917 "tonic-build",
2918 "tower-http",
2919 "tracing",
2920 "tracing-subscriber",
2921]
23922922
2393[[package]]2923[[package]]
2394name = "thiserror"2924name = "thiserror"
2407dependencies = [2937dependencies = [
2408 "proc-macro2",2938 "proc-macro2",
2409 "quote",2939 "quote",
2410 "syn 2.0.66",2940 "syn 2.0.76",
2411]2941]
24122942
2413[[package]]2943[[package]]
2485dependencies = [3015dependencies = [
2486 "proc-macro2",3016 "proc-macro2",
2487 "quote",3017 "quote",
2488 "syn 2.0.66",3018 "syn 2.0.76",
2489]3019]
24903020
2491[[package]]3021[[package]]
2498 "tokio",3028 "tokio",
2499]3029]
3030
3031[[package]]
3032name = "tokio-rustls"
3033version = "0.26.0"
3034source = "registry+https://github.com/rust-lang/crates.io-index"
3035checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4"
3036dependencies = [
3037 "rustls",
3038 "rustls-pki-types",
3039 "tokio",
3040]
3041
3042[[package]]
3043name = "tokio-stream"
3044version = "0.1.15"
3045source = "registry+https://github.com/rust-lang/crates.io-index"
3046checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"
3047dependencies = [
3048 "futures-core",
3049 "pin-project-lite",
3050 "tokio",
3051 "tokio-util",
3052]
25003053
2501[[package]]3054[[package]]
2502name = "tokio-util"3055name = "tokio-util"
2547source = "registry+https://github.com/rust-lang/crates.io-index"3100source = "registry+https://github.com/rust-lang/crates.io-index"
2548checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"3101checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c"
2549dependencies = [3102dependencies = [
2550 "indexmap",3103 "indexmap 2.2.6",
2551 "serde",3104 "serde",
2552 "serde_spanned",3105 "serde_spanned",
2553 "toml_datetime",3106 "toml_datetime",
2554 "winnow",3107 "winnow",
2555]3108]
3109
3110[[package]]
3111name = "tonic"
3112version = "0.12.2"
3113source = "registry+https://github.com/rust-lang/crates.io-index"
3114checksum = "c6f6ba989e4b2c58ae83d862d3a3e27690b6e3ae630d0deb59f3697f32aa88ad"
3115dependencies = [
3116 "async-stream",
3117 "async-trait",
3118 "axum",
3119 "base64 0.22.1",
3120 "bytes",
3121 "h2",
3122 "http",
3123 "http-body",
3124 "http-body-util",
3125 "hyper",
3126 "hyper-timeout",
3127 "hyper-util",
3128 "percent-encoding",
3129 "pin-project",
3130 "prost",
3131 "rustls-pemfile",
3132 "socket2",
3133 "tokio",
3134 "tokio-rustls",
3135 "tokio-stream",
3136 "tower",
3137 "tower-layer",
3138 "tower-service",
3139 "tracing",
3140]
3141
3142[[package]]
3143name = "tonic-build"
3144version = "0.12.2"
3145source = "registry+https://github.com/rust-lang/crates.io-index"
3146checksum = "fe4ee8877250136bd7e3d2331632810a4df4ea5e004656990d8d66d2f5ee8a67"
3147dependencies = [
3148 "prettyplease",
3149 "proc-macro2",
3150 "prost-build",
3151 "quote",
3152 "syn 2.0.76",
3153]
3154
3155[[package]]
3156name = "tower"
3157version = "0.4.13"
3158source = "registry+https://github.com/rust-lang/crates.io-index"
3159checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c"
3160dependencies = [
3161 "futures-core",
3162 "futures-util",
3163 "indexmap 1.9.3",
3164 "pin-project",
3165 "pin-project-lite",
3166 "rand",
3167 "slab",
3168 "tokio",
3169 "tokio-util",
3170 "tower-layer",
3171 "tower-service",
3172 "tracing",
3173]
3174
3175[[package]]
3176name = "tower-http"
3177version = "0.5.2"
3178source = "registry+https://github.com/rust-lang/crates.io-index"
3179checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5"
3180dependencies = [
3181 "bitflags",
3182 "bytes",
3183 "http",
3184 "http-body",
3185 "http-body-util",
3186 "pin-project-lite",
3187 "tower-layer",
3188 "tower-service",
3189 "tracing",
3190]
3191
3192[[package]]
3193name = "tower-layer"
3194version = "0.3.3"
3195source = "registry+https://github.com/rust-lang/crates.io-index"
3196checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"
3197
3198[[package]]
3199name = "tower-service"
3200version = "0.3.3"
3201source = "registry+https://github.com/rust-lang/crates.io-index"
3202checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"
25563203
2557[[package]]3204[[package]]
2558name = "tracing"3205name = "tracing"
2573dependencies = [3220dependencies = [
2574 "proc-macro2",3221 "proc-macro2",
2575 "quote",3222 "quote",
2576 "syn 2.0.66",3223 "syn 2.0.76",
2577]3224]
25783225
2579[[package]]3226[[package]]
2609 "tracing-core",3256 "tracing-core",
2610]3257]
3258
3259[[package]]
3260name = "tracing-serde"
3261version = "0.1.3"
3262source = "registry+https://github.com/rust-lang/crates.io-index"
3263checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1"
3264dependencies = [
3265 "serde",
3266 "tracing-core",
3267]
26113268
2612[[package]]3269[[package]]
2613name = "tracing-subscriber"3270name = "tracing-subscriber"
2619 "nu-ansi-term",3276 "nu-ansi-term",
2620 "once_cell",3277 "once_cell",
2621 "regex",3278 "regex",
3279 "serde",
3280 "serde_json",
2622 "sharded-slab",3281 "sharded-slab",
2623 "smallvec",3282 "smallvec",
2624 "thread_local",3283 "thread_local",
2625 "tracing",3284 "tracing",
2626 "tracing-core",3285 "tracing-core",
2627 "tracing-log",3286 "tracing-log",
3287 "tracing-serde",
2628]3288]
3289
3290[[package]]
3291name = "try-lock"
3292version = "0.2.5"
3293source = "registry+https://github.com/rust-lang/crates.io-index"
3294checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
26293295
2630[[package]]3296[[package]]
2631name = "type-map"3297name = "type-map"
2704 "subtle",3370 "subtle",
2705]3371]
3372
3373[[package]]
3374name = "untrusted"
3375version = "0.9.0"
3376source = "registry+https://github.com/rust-lang/crates.io-index"
3377checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"
27063378
2707[[package]]3379[[package]]
2708name = "utf8parse"3380name = "utf8parse"
2765 "winapi-util",3437 "winapi-util",
2766]3438]
3439
3440[[package]]
3441name = "want"
3442version = "0.3.1"
3443source = "registry+https://github.com/rust-lang/crates.io-index"
3444checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"
3445dependencies = [
3446 "try-lock",
3447]
27673448
2768[[package]]3449[[package]]
2769name = "wasi"3450name = "wasi"
2792 "once_cell",3473 "once_cell",
2793 "proc-macro2",3474 "proc-macro2",
2794 "quote",3475 "quote",
2795 "syn 2.0.66",3476 "syn 2.0.76",
2796 "wasm-bindgen-shared",3477 "wasm-bindgen-shared",
2797]3478]
27983479
2814dependencies = [3495dependencies = [
2815 "proc-macro2",3496 "proc-macro2",
2816 "quote",3497 "quote",
2817 "syn 2.0.66",3498 "syn 2.0.76",
2818 "wasm-bindgen-backend",3499 "wasm-bindgen-backend",
2819 "wasm-bindgen-shared",3500 "wasm-bindgen-shared",
2820]3501]
3035 "zeroize",3716 "zeroize",
3036]3717]
3718
3719[[package]]
3720name = "yasna"
3721version = "0.5.2"
3722source = "registry+https://github.com/rust-lang/crates.io-index"
3723checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"
3724dependencies = [
3725 "time",
3726]
30373727
3038[[package]]3728[[package]]
3039name = "z85"3729name = "z85"
3058dependencies = [3748dependencies = [
3059 "proc-macro2",3749 "proc-macro2",
3060 "quote",3750 "quote",
3061 "syn 2.0.66",3751 "syn 2.0.76",
3062]3752]
30633753
modifiedcmds/fleet/Cargo.tomldiffbeforeafterboth
45indicatif = { version = "0.17", optional = true }45indicatif = { version = "0.17", optional = true }
46nix-eval.workspace = true46nix-eval.workspace = true
47nom = "7.1.3"47nom = "7.1.3"
48fleet-base = { version = "0.1.0", path = "../../crates/fleet-base" }
4849
49[features]50[features]
50# Not quite stable51# Not quite stable
modifiedcmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth
22
3use anyhow::{anyhow, Result};3use anyhow::{anyhow, Result};
4use clap::{Parser, ValueEnum};4use clap::{Parser, ValueEnum};
5use fleet_base::{
6 host::{Config, ConfigHost},
7 opts::FleetOpts,
8};
5use itertools::Itertools as _;9use itertools::Itertools as _;
6use nix_eval::nix_go;10use nix_eval::nix_go;
7use tokio::{task::LocalSet, time::sleep};11use tokio::{task::LocalSet, time::sleep};
8use tracing::{error, field, info, info_span, warn, Instrument};12use tracing::{error, field, info, info_span, warn, Instrument};
9
10use crate::{
11 command::MyCommand,
12 host::{Config, ConfigHost},
13};
1413
15#[derive(Parser)]14#[derive(Parser)]
16pub struct Deploy {15pub struct Deploy {
253 info!("building");252 info!("building");
254 let host = config.host(&host).await?;253 let host = config.host(&host).await?;
255 // let action = Action::from(self.subcommand.clone());254 // let action = Action::from(self.subcommand.clone());
256 let fleet_config = &config.config_field;
257 let nixos = host.nixos_config().await?;255 let nixos = host.nixos_config().await?;
258 let drv = nix_go!(nixos.system.build[{ build_attr }]);256 let drv = nix_go!(nixos.system.build[{ build_attr }]);
259 let outputs = drv.build().await.inspect_err(|_| {257 let outputs = drv.build().await.inspect_err(|_| {
270}268}
271269
272impl BuildSystems {270impl BuildSystems {
273 pub async fn run(self, config: &Config) -> Result<()> {271 pub async fn run(self, config: &Config, opts: &FleetOpts) -> Result<()> {
274 let hosts = config.list_hosts().await?;272 let hosts = config.list_hosts().await?;
275 let set = LocalSet::new();273 let set = LocalSet::new();
276 let build_attr = self.build_attr.clone();274 let build_attr = self.build_attr.clone();
277 for host in hosts.into_iter() {275 for host in hosts.into_iter() {
278 if config.should_skip(&host).await? {276 if opts.should_skip(&host).await? {
279 continue;277 continue;
280 }278 }
281 let config = config.clone();279 let config = config.clone();
320}318}
321319
322impl Deploy {320impl Deploy {
323 pub async fn run(self, config: &Config) -> Result<()> {321 pub async fn run(self, config: &Config, opts: &FleetOpts) -> Result<()> {
324 let hosts = config.list_hosts().await?;322 let hosts = config.list_hosts().await?;
325 let set = LocalSet::new();323 let set = LocalSet::new();
326 for host in hosts.into_iter() {324 for host in hosts.into_iter() {
327 if config.should_skip(&host).await? {325 if opts.should_skip(&host).await? {
328 continue;326 continue;
329 }327 }
330 let config = config.clone();328 let config = config.clone();
331 let span = info_span!("deploy", host = field::display(&host.name));329 let span = info_span!("deploy", host = field::display(&host.name));
332 let hostname = host.name.clone();330 let hostname = host.name.clone();
333 let local_host = config.local_host();331 let local_host = config.local_host();
332 let opts = opts.clone();
334 // FIXME: Fix repl concurrency (see build-systems)333 // FIXME: Fix repl concurrency (see build-systems)
335 set.spawn_local(334 set.spawn_local(
336 (async move {335 (async move {
342 return;341 return;
343 }342 }
344 };343 };
345 if !config.is_local(&hostname) {344 if !opts.is_local(&hostname) {
346 info!("uploading system closure");345 info!("uploading system closure");
347 {346 {
348 // TODO: Move to remote_derivation method.347 // TODO: Move to remote_derivation method.
387 self.action,386 self.action,
388 &host,387 &host,
389 built,388 built,
390 if let Ok(v) = config.action_attr(&host, "specialisation").await {389 if let Ok(v) = opts.action_attr(&host, "specialisation").await {
391 v390 v
392 } else {391 } else {
393 error!("unreachable? failed to get specialization");392 error!("unreachable? failed to get specialization");
modifiedcmds/fleet/src/cmds/info.rsdiffbeforeafterboth
22
3use anyhow::{ensure, Result};3use anyhow::{ensure, Result};
4use clap::Parser;4use clap::Parser;
5use nix_eval::nix_go_json;5use fleet_base::host::Config;
6
7use crate::host::Config;6use nix_eval::nix_go_json;
87
9#[derive(Parser)]8#[derive(Parser)]
10pub struct Info {9pub struct Info {
modifiedcmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth
1use std::{1use std::{
2 collections::{BTreeMap, BTreeSet, HashSet},2 collections::{BTreeMap, BTreeSet, HashSet},
3 ffi::OsString,
4 io::{self, stdin, stdout, Read, Write},3 io::{self, stdin, stdout, Read, Write},
5 path::PathBuf,4 path::PathBuf,
6};5};
76
8use anyhow::{anyhow, bail, ensure, Context, Result};7use anyhow::{anyhow, bail, ensure, Context, Result};
9use chrono::{DateTime, Utc};8use chrono::{DateTime, Utc};
10use clap::Parser;9use clap::Parser;
11use crossterm::{terminal, tty::IsTty};10use fleet_base::{
11 fleetdata::{encrypt_secret_data, FleetSecret, FleetSecretPart, FleetSharedSecret},
12 host::Config,
13 opts::FleetOpts,
14};
12use fleet_shared::SecretData;15use fleet_shared::SecretData;
13use itertools::Itertools;
14use nix_eval::{nix_go, nix_go_json, Value};16use nix_eval::{nix_go, nix_go_json, Value};
15use owo_colors::OwoColorize;17use owo_colors::OwoColorize;
16use serde::Deserialize;18use serde::Deserialize;
17use tabled::{Table, Tabled};19use tabled::{Table, Tabled};
18use tokio::{fs::read, process::Command};20use tokio::fs::read;
19use tracing::{error, info, info_span, warn, Instrument};21use tracing::{error, info, info_span, warn, Instrument};
20
21use crate::{
22 fleetdata::{encrypt_secret_data, FleetSecret, FleetSecretPart, FleetSharedSecret},
23 host::Config,
24};
2522
26#[derive(Parser)]23#[derive(Parser)]
27pub enum Secret {24pub enum Secret {
432 Ok(target_machines)429 Ok(target_machines)
433}430}
434impl Secret {431impl Secret {
435 pub async fn run(self, config: &Config) -> Result<()> {432 pub async fn run(self, config: &Config, opts: &FleetOpts) -> Result<()> {
436 match self {433 match self {
437 Secret::ForceKeys => {434 Secret::ForceKeys => {
438 for host in config.list_hosts().await? {435 for host in config.list_hosts().await? {
439 if config.should_skip(&host).await? {436 if opts.should_skip(&host).await? {
440 continue;437 continue;
441 }438 }
442 config.key(&host.name).await?;439 config.key(&host.name).await?;
639 }636 }
640 }637 }
641 for host in config.list_hosts().await? {638 for host in config.list_hosts().await? {
642 if config.should_skip(&host).await? {639 if opts.should_skip(&host).await? {
643 continue;640 continue;
644 }641 }
645642
757 }754 }
758}755}
759756
757/*
760async fn edit_temp_file(758async fn edit_temp_file(
761 builder: tempfile::Builder<'_, '_>,759 builder: tempfile::Builder<'_, '_>,
762 r: Vec<u8>,760 r: Vec<u8>,
835833
836 // Ok((success, abs_path))834 // Ok((success, abs_path))
837}835}
836*/
838837
modifiedcmds/fleet/src/cmds/tf.rsdiffbeforeafterboth
1use std::{
2 collections::{BTreeMap, HashMap},
3 path::PathBuf,
4};
5
1use anyhow::Result;6use anyhow::{bail, Context, Result};
2use clap::Parser;7use clap::Parser;
3use nix_eval::nix_go_json;8use fleet_base::host::Config;
4use serde_json::Value;9use nix_eval::nix_go;
5use tokio::fs::write;10use serde::Deserialize;
6use tracing::info;11use serde_json::Value;
7
8use crate::host::Config;12use tokio::{fs::copy, process::Command};
13
14#[derive(Deserialize)]
15pub struct TfData {
16 // Dummy
17 #[allow(dead_code)]
18 managed: bool,
19 // Host => Data
20 #[serde(default)]
21 #[serde(skip_serializing_if = "BTreeMap::is_empty")]
22 pub hosts: BTreeMap<String, Value>,
23}
924
10#[derive(Parser)]25#[derive(Parser)]
11pub struct Tf;26pub enum Tf {
27 /// Generate fleet.tf.json file for running terraform.
28 Generate,
29 /// Fetch data from terraform to fleet.
30 Refresh,
31}
12impl Tf {32impl Tf {
13 pub async fn run(&self, config: &Config) -> Result<()> {33 pub async fn run(&self, config: &Config) -> Result<()> {
34 match self {
35 Tf::Generate => {
14 let system = &config.local_system;36 let system = &config.local_system;
15 let config = &config.config_field;37 let config = &config.config_field;
16 let data: Value = nix_go_json!(config.tf({ system }).config);38 let data: HashMap<String, PathBuf> = nix_go!(config.tf({ system })).build().await?;
17 let str = serde_json::to_string_pretty(&data)?;39 let data = &data["out"];
1840
19 write("fleet.tf.json", str.as_bytes()).await?;41 copy(data, "fleet.tf.json").await?;
42 }
43 Tf::Refresh => {
44 let cmd = Command::new("terraform").arg("refresh").status().await?;
45 if !cmd.success() {
46 bail!("terraform refresh failed")
47 }
48
49 let data = Command::new("terraform")
50 .arg("output")
51 .arg("-json")
52 .arg("fleet")
53 .output()
54 .await?;
55 let tf_data: TfData = serde_json::from_slice(&data.stdout)
56 .context("failed to parse terraform fleet output")?;
57
58 let mut data = config.data();
59 data.extra.insert(
60 "terraformHosts".to_owned(),
61 serde_json::to_value(tf_data.hosts).expect("should be valid extra"),
62 );
63 }
64 }
2065
21 Ok(())66 Ok(())
22 }67 }
deletedcmds/fleet/src/command.rsdiffbeforeafterboth

no changes

deletedcmds/fleet/src/fleetdata.rsdiffbeforeafterboth

no changes

deletedcmds/fleet/src/host.rsdiffbeforeafterboth

no changes

deletedcmds/fleet/src/keys.rsdiffbeforeafterboth

no changes

modifiedcmds/fleet/src/main.rsdiffbeforeafterboth
2#![feature(try_blocks)]2#![feature(try_blocks)]
33
4pub(crate) mod cmds;4pub(crate) mod cmds;
5pub(crate) mod command;5// pub(crate) mod command;
6pub(crate) mod host;
7pub(crate) mod keys;
8
9pub(crate) mod extra_args;6pub(crate) mod extra_args;
10
11mod fleetdata;
127
13use std::{ffi::OsString, process::ExitCode};8use std::{ffi::OsString, process::ExitCode};
149
21 secrets::Secret,16 secrets::Secret,
22 tf::Tf,17 tf::Tf,
23};18};
19use fleet_base::{host::Config, opts::FleetOpts};
24use futures::{future::LocalBoxFuture, stream::FuturesUnordered, TryStreamExt};20use futures::{future::LocalBoxFuture, stream::FuturesUnordered, TryStreamExt};
25use host::{Config, FleetOpts};21// use host::Config;
26#[cfg(feature = "indicatif")]22#[cfg(feature = "indicatif")]
27use human_repr::HumanCount;23use human_repr::HumanCount;
28#[cfg(feature = "indicatif")]24#[cfg(feature = "indicatif")]
32use tracing_indicatif::IndicatifLayer;28use tracing_indicatif::IndicatifLayer;
33use tracing_subscriber::{prelude::*, EnvFilter};29use tracing_subscriber::{prelude::*, EnvFilter};
34
35use crate::command::MyCommand;
3630
37#[derive(Parser)]31#[derive(Parser)]
38struct Prefetch {}32struct Prefetch {}
88 #[clap(hide(true))]82 #[clap(hide(true))]
89 Complete(Complete),83 Complete(Complete),
90 /// Compile and evaluate terranix configuration84 /// Compile and evaluate terranix configuration
85 #[clap(subcommand)]
91 Tf(Tf),86 Tf(Tf),
92}87}
9388
100 command: Opts,95 command: Opts,
101}96}
10297
103async fn run_command(config: &Config, command: Opts) -> Result<()> {98async fn run_command(config: &Config, opts: FleetOpts, command: Opts) -> Result<()> {
104 match command {99 match command {
105 Opts::BuildSystems(c) => c.run(config).await?,100 Opts::BuildSystems(c) => c.run(config, &opts).await?,
106 Opts::Deploy(d) => d.run(config).await?,101 Opts::Deploy(d) => d.run(config, &opts).await?,
107 Opts::Secret(s) => s.run(config).await?,102 Opts::Secret(s) => s.run(config, &opts).await?,
108 Opts::Info(i) => i.run(config).await?,103 Opts::Info(i) => i.run(config).await?,
109 Opts::Prefetch(p) => p.run(config).await?,104 Opts::Prefetch(p) => p.run(config).await?,
110 Opts::Tf(t) => t.run(config).await?,105 Opts::Tf(t) => t.run(config).await?,
211 .unwrap_or_default();206 .unwrap_or_default();
212 let config = opts.fleet_opts.build(nix_args).await?;207 let config = opts.fleet_opts.build(nix_args).await?;
213208
214 match run_command(&config, opts.command).await {209 match run_command(&config, opts.fleet_opts, opts.command).await {
215 Ok(()) => {210 Ok(()) => {
216 config.save()?;211 config.save()?;
217 Ok(())212 Ok(())
addedcrates/fleet-base/Cargo.tomldiffbeforeafterboth

no changes

addedcrates/fleet-base/src/command.rsdiffbeforeafterboth

no changes

addedcrates/fleet-base/src/fleetdata.rsdiffbeforeafterboth

no changes

addedcrates/fleet-base/src/host.rsdiffbeforeafterboth

no changes

addedcrates/fleet-base/src/keys.rsdiffbeforeafterboth

no changes

addedcrates/fleet-base/src/lib.rsdiffbeforeafterboth

no changes

addedcrates/fleet-base/src/opts.rsdiffbeforeafterboth

no changes

addedcrates/fleet-shared/src/encoding.rsdiffbeforeafterboth

no changes

modifiedcrates/fleet-shared/src/lib.rsdiffbeforeafterboth
1use std::{
2 fmt::{self, Display},
3 str::FromStr,
4};1mod encoding;
5
6use base64::engine::{general_purpose::STANDARD_NO_PAD, Engine};2pub use encoding::SecretData;
7use serde::{de::Error, Deserialize, Deserializer, Serialize};
8use unicode_categories::UnicodeCategories;
9
10#[derive(Debug, PartialEq, Clone)]
11pub struct SecretData {
12 pub data: Vec<u8>,
13 pub encrypted: bool,
14}
15
16const BASE64_ENCODED_PREFIX: &str = "<BASE64-ENCODED>\n";
17const Z85_ENCODED_PREFIX: &str = "<Z85-ENCODED>\n";
18// Multiline text in Nix can only end with \n, which is not cool for actual single-line strings.
19const PLAINTEXT_NEWLINE_PREFIX: &str = "<PLAINTEXT-NL>\n";
20const PLAINTEXT_PREFIX: &str = "<PLAINTEXT>";
21
22const SECRET_PREFIX: &str = "<ENCRYPTED>";
23
24impl<'de> Deserialize<'de> for SecretData {
25 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
26 where
27 D: Deserializer<'de>,
28 {
29 let string = String::deserialize(deserializer)?;
30 string.parse().map_err(D::Error::custom)
31 }
32}
33
34impl Serialize for SecretData {
35 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
36 where
37 S: serde::Serializer,
38 {
39 self.to_string().serialize(serializer)
40 }
41}
42
43impl FromStr for SecretData {
44 type Err = String;
45
46 fn from_str(string: &str) -> Result<Self, Self::Err> {
47 let (encrypted, string) = if let Some(unprefixed) = string.strip_prefix(SECRET_PREFIX) {
48 (true, unprefixed)
49 } else {
50 (false, string)
51 };
52 let data = if let Some(unprefixed) = string.strip_prefix(BASE64_ENCODED_PREFIX) {
53 STANDARD_NO_PAD
54 .decode(unprefixed.replace(|v| matches!(v, '\n' | '\t' | ' '), ""))
55 .map_err(|e| format!("base64-encoded failed: {e}"))?
56 } else if let Some(unprefixed) = string.strip_prefix(Z85_ENCODED_PREFIX) {
57 z85::decode(unprefixed.replace(|v| matches!(v, '\n' | '\t' | ' '), ""))
58 .map_err(|e| format!("z85-encoded failed: {e}"))?
59 } else if let Some(unprefixed) = string.strip_prefix(PLAINTEXT_NEWLINE_PREFIX) {
60 unprefixed.as_bytes().to_owned()
61 } else if let Some(unprefixed) = string.strip_prefix(PLAINTEXT_PREFIX) {
62 unprefixed.as_bytes().to_owned()
63 } else {
64 let secret_prefix = format!("{SECRET_PREFIX}{Z85_ENCODED_PREFIX}");
65 return Err(format!(
66 "unknown secret encoding. If you're migrating from old version of fleet, prefix public secret fields with {PLAINTEXT_PREFIX:?}, and encrypted data with {secret_prefix:?}: {string}"
67 ));
68 };
69 Ok(Self { data, encrypted })
70 }
71}
72
73impl Display for SecretData {
74 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
75 let mut readable = std::str::from_utf8(&self.data).ok();
76 if self.encrypted {
77 write!(f, "{SECRET_PREFIX}")?;
78 // Always base64-encode encrypted fields.
79 readable = None;
80 }
81 if Some(false) == readable.map(is_printable) {
82 readable = None
83 };
84 // TODO: Check if text is readable, and has no unprintable characters?..
85 if let Some(plaintext) = readable {
86 if plaintext.ends_with('\n') {
87 write!(f, "{PLAINTEXT_NEWLINE_PREFIX}")?;
88 } else {
89 write!(f, "{PLAINTEXT_PREFIX}")?;
90 }
91 write!(f, "{plaintext}")?;
92 } else {
93 write!(f, "{BASE64_ENCODED_PREFIX}")?;
94 let encoded = STANDARD_NO_PAD.encode(&self.data);
95 for ele in encoded.as_bytes().chunks(64) {
96 let chunk = std::str::from_utf8(ele).expect(
97 "any slice of base64-encoded text is utf-8 compatible, as it is ascii-based",
98 );
99 writeln!(f, "{chunk}")?;
100 }
101 };
102 Ok(())
103 }
104}
105
106fn is_printable(text: &str) -> bool {
107 text.chars().all(|c| {
108 c.is_letter()
109 || c.is_mark()
110 || c.is_number()
111 || c.is_punctuation()
112 || c.is_separator()
113 || c == '\n' || c == '\t'
114 // Complete base64 alphabet
115 || c == '/' || c == '+'
116 || c == '='
117 })
118}
119
120#[test]
121fn test() {
122 fn check_roundtrip(data: SecretData, expected: &str) {
123 let string = data.to_string();
124 assert_eq!(string, expected, "unexpected encoding");
125 let roundtrip: SecretData = string.parse().expect("roundtrip parse");
126 assert_eq!(data, roundtrip, "roundtrip didn't match");
127 }
128 check_roundtrip(
129 SecretData {
130 data: vec![1, 2, 3, 4, 5, 6],
131 encrypted: false,
132 },
133 "<BASE64-ENCODED>\nAQIDBAUG\n",
134 );
135 check_roundtrip(
136 SecretData {
137 data: vec![1, 2, 3, 4, 5, 6],
138 encrypted: true,
139 },
140 "<ENCRYPTED><BASE64-ENCODED>\nAQIDBAUG\n",
141 );
142 check_roundtrip(
143 SecretData {
144 data: "Привет, мир!\n".to_owned().into(),
145 encrypted: false,
146 },
147 "<PLAINTEXT-NL>\nПривет, мир!\n",
148 );
149 check_roundtrip(
150 SecretData {
151 data: "Привет, мир!".to_owned().into(),
152 encrypted: false,
153 },
154 "<PLAINTEXT>Привет, мир!",
155 );
156}
1573
modifiedcrates/nix-eval/src/session.rsdiffbeforeafterboth
12 sync::{mpsc, oneshot, Mutex},12 sync::{mpsc, oneshot, Mutex},
13};13};
14use tokio_util::codec::{FramedRead, LinesCodec};14use tokio_util::codec::{FramedRead, LinesCodec};
15use tracing::{debug, error, info, warn, Level};15use tracing::{debug, error, warn, Level};
1616
17#[derive(Error, Debug)]17#[derive(Error, Debug)]
18pub enum Error {18pub enum Error {
147 // s.split('\n').filter(|s| !s.trim().is_empty()).map(|v| v.)147 // s.split('\n').filter(|s| !s.trim().is_empty()).map(|v| v.)
148 // }148 // }
149 if !self.collected.is_empty() {149 if !self.collected.is_empty() {
150 return Err(Error::NixError(format!(150 return Err(Error::NixError(
151 "{}",
152 self.collected151 self.collected
153 .iter()152 .iter()
154 .map(|v| {153 .map(|v| {
155 if let Some(f) = v.strip_prefix("\u{1b}[31;1merror:\u{1b}[0m ") {154 if let Some(f) = v.strip_prefix("\u{1b}[31;1merror:\u{1b}[0m ") {
156 let v = unindent::unindent(f.trim_start());155 let v = unindent::unindent(f.trim_start());
157 v.trim().to_owned()156 v.trim().to_owned()
158 } else {157 } else {
159 v.to_owned()158 v.to_owned()
160 }159 }
161 })160 })
162 .join("\n"),161 .join("\n")
162 .to_string(),
163 )));163 ));
164 }164 }
165 Ok(())165 Ok(())
166 }166 }
316 }316 }
317 out.push_str(&line);317 out.push_str(&line);
318 }318 }
319 return Err(Error::MissingDelimiter);319 Err(Error::MissingDelimiter)
320 }320 }
321 pub(crate) async fn execute_expression_number(321 pub(crate) async fn execute_expression_number(
322 &mut self,322 &mut self,
347 let mut fexpr = b"builtins.toJSON (".to_vec();347 let mut fexpr = b"builtins.toJSON (".to_vec();
348 fexpr.extend_from_slice(expr.as_ref());348 fexpr.extend_from_slice(expr.as_ref());
349 fexpr.push(b')');349 fexpr.push(b')');
350 let s = String::from_utf8_lossy(expr.as_ref());350
351 Ok(serde_json::from_str(
351 let v = self.execute_expression_string(fexpr).await?;352 &self.execute_expression_string(fexpr).await?,
352 Ok(serde_json::from_str(&v)?)353 )?)
353 }354 }
354 async fn execute_expression_wrapping(355 async fn execute_expression_wrapping(
355 &mut self,356 &mut self,
deletedcrates/remowt-fs/Cargo.tomldiffbeforeafterboth

no changes

deletedcrates/remowt-fs/src/lib.rsdiffbeforeafterboth

no changes

modifiedflake.nixdiffbeforeafterboth
116 bacon116 bacon
117 nil117 nil
118 ];118 ];
119 env.PROTOC = "${pkgs.protobuf}/bin/protoc";
119 };120 };
120 };121 };
121 # fleet-install-secrets will not be built normally, because they are not ran directly by user most of the time.122 # fleet-install-secrets will not be built normally, because they are not ran directly by user most of the time.
modifiedmodules/extras/tf.nixdiffbeforeafterboth
1{1{
2 config,2 config,
3 lib,3 lib,
4 fleetLib,
4 inputs,5 inputs,
5 ...6 ...
6}: let7}: let
7 inherit (lib) mkOption;8 inherit (lib.options) mkOption;
8 inherit (lib.types) deferredModule;9 inherit (lib.types) deferredModule attrsOf unspecified;
10 inherit (fleetLib.options) mkDataOption;
9in {11in {
10 options.tf = mkOption {12 options = {
13 tf = mkOption {
11 type = deferredModule;14 type = deferredModule;
12 apply = module: system:15 apply = module: system:
13 inputs.terranix.lib.terranixConfigurationAst {16 inputs.terranix.lib.terranixConfiguration {
14 inherit system;17 inherit system;
15 pkgs = config.nixpkgs.buildUsing.legacyPackages.${system};18 pkgs = config.nixpkgs.buildUsing.legacyPackages.${system};
16 modules = [module];19 modules = [
20 module
21 ];
17 };22 };
18 };23 };
24 data = mkDataOption {
25 # host => hostData
26 options.extra.terraformHosts = mkOption {
27 default = {};
28 type = attrsOf (attrsOf unspecified);
29 description = "Hosts data provided by fleet tf";
30 };
31 };
32 };
33
19 config.tf.output.fleet = {34 config = {
35 tf.output.fleet = {
20 value = {36 value = {
21 managed = true;37 managed = true;
22 };38 };
23 # Just to avoid printing this attribute on every apply.39 # Just to avoid printing this attribute on every apply, the whole fleet attribute
40 # will be somehow processed by fleet tf.
24 sensitive = true;41 sensitive = true;
25 };42 };
43 hosts = config.data.extra.terraformHosts;
44 };
26}45}
2746
modifiedmodules/secrets-data.nixdiffbeforeafterboth
6}: let6}: let
7 inherit (fleetLib.options) mkDataOption;7 inherit (fleetLib.options) mkDataOption;
8 inherit (lib.options) mkOption;8 inherit (lib.options) mkOption;
9 inherit (lib.types) lazyAttrsOf nullOr listOf str attrsOf submodule bool;9 inherit (lib.types) nullOr listOf str attrsOf submodule bool;
10 inherit (lib.attrsets) mapAttrsToList mapAttrs catAttrs filterAttrs genAttrs;10 inherit (lib.attrsets) mapAttrsToList mapAttrs filterAttrs genAttrs;
11 inherit (lib.lists) sort unique concatLists;11 inherit (lib.lists) sort unique concatLists;
12 inherit (lib.strings) toJSON;12 inherit (lib.strings) toJSON;
1313