difftreelog
refactor prepare for decoupling fleet-cli from fleet-data-storage
in: trunk
26 files changed
Cargo.lockdiffbeforeafterboth214source = "registry+https://github.com/rust-lang/crates.io-index"214source = "registry+https://github.com/rust-lang/crates.io-index"215checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"215checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"216217[[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]227228[[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]216238217[[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]249250[[package]]251name = "atomic-waker"252version = "1.1.2"253source = "registry+https://github.com/rust-lang/crates.io-index"254checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"227255228[[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"261262[[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]288289[[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]233308234[[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]487562488[[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]622697623[[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]678753679[[package]]754[[package]]761 "toml 0.5.11",836 "toml 0.5.11",762]837]838839[[package]]840name = "fixedbitset"841version = "0.4.2"842source = "registry+https://github.com/rust-lang/crates.io-index"843checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"763844764[[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]886887[[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]804911805[[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]9541061955[[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"11281129[[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]102111471022[[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"11531154[[package]]1155name = "hashbrown"1156version = "0.12.3"1157source = "registry+https://github.com/rust-lang/crates.io-index"1158checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"102711591028[[package]]1160[[package]]1029name = "hashbrown"1161name = "hashbrown"1084 "windows",1216 "windows",1085]1217]12181219[[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]12291230[[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]12391240[[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]12521253[[package]]1254name = "httparse"1255version = "1.9.4"1256source = "registry+https://github.com/rust-lang/crates.io-index"1257checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9"12581259[[package]]1260name = "httpdate"1261version = "1.0.3"1262source = "registry+https://github.com/rust-lang/crates.io-index"1263checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"108612641087[[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"12701271[[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]12911292[[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]13041305[[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]109213241093[[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]114813801156 "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]116113931162[[package]]1394[[package]]1182 "cc",1414 "cc",1183]1415]14161417[[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]118414261185[[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]130815501309[[package]]1551[[package]]1365 "regex-automata 0.1.10",1607 "regex-automata 0.1.10",1366]1608]16091610[[package]]1611name = "matchit"1612version = "0.7.3"1613source = "registry+https://github.com/rust-lang/crates.io-index"1614checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"136716151368[[package]]1616[[package]]1369name = "memchr"1617name = "memchr"1389 "libmimalloc-sys",1637 "libmimalloc-sys",1390]1638]16391640[[package]]1641name = "mime"1642version = "0.3.17"1643source = "registry+https://github.com/rust-lang/crates.io-index"1644checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"139116451392[[package]]1646[[package]]1393name = "minimal-lexical"1647name = "minimal-lexical"1416 "windows-sys 0.48.0",1670 "windows-sys 0.48.0",1417]1671]16721673[[package]]1674name = "multimap"1675version = "0.10.0"1676source = "registry+https://github.com/rust-lang/crates.io-index"1677checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03"141816781419[[package]]1679[[package]]1420name = "nix"1680name = "nix"1587 "tokio-pipe",1847 "tokio-pipe",1588]1848]18491850[[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]158918631590[[package]]1864[[package]]1591name = "overload"1865name = "overload"1636 "windows-targets 0.52.5",1910 "windows-targets 0.52.5",1637]1911]19121913[[package]]1914name = "paste"1915version = "1.0.15"1916source = "registry+https://github.com/rust-lang/crates.io-index"1917checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a"163819181639[[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"19551956[[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]19651966[[package]]1967name = "percent-encoding"1968version = "2.3.1"1969source = "registry+https://github.com/rust-lang/crates.io-index"1970checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e"19711972[[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]167519811676[[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]169520011696[[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"20812082[[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]177520911776[[package]]2092[[package]]1777name = "proc-macro-error"2093name = "proc-macro-error"1806 "unicode-ident",2122 "unicode-ident",1807]2123]21242125[[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]21342135[[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]21552156[[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]21682169[[package]]2170name = "prost-types"2171version = "0.13.1"2172source = "registry+https://github.com/rust-lang/crates.io-index"2173checksum = "cee5168b05f49d4b0ca581206eb14a7b22fafd963efe729ac48eb03266e25cc2"2174dependencies = [2175 "prost",2176]180821771809[[package]]2178[[package]]1810name = "quote"2179name = "quote"1856 "getrandom",2225 "getrandom",1857]2226]22272228[[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]185822401859[[package]]2241[[package]]1860name = "redox_syscall"2242name = "redox_syscall"1910checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"2292checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"191122931912[[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]23082309[[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]23192320[[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]191523301916[[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]199524102037 "windows-sys 0.52.0",2452 "windows-sys 0.52.0",2038]2453]24542455[[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]24692470[[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]24792480[[package]]2481name = "rustls-pki-types"2482version = "1.8.0"2483source = "registry+https://github.com/rust-lang/crates.io-index"2484checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0"24852486[[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]24962497[[package]]2498name = "rustversion"2499version = "1.0.17"2500source = "registry+https://github.com/rust-lang/crates.io-index"2501checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"203925022040[[package]]2503[[package]]2041name = "ryu"2504name = "ryu"2135 "serde",2598 "serde",2136]2599]26002601[[package]]2602name = "serde_bytes"2603version = "0.11.15"2604source = "registry+https://github.com/rust-lang/crates.io-index"2605checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a"2606dependencies = [2607 "serde",2608]213726092138[[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]214826202149[[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"27532754[[package]]2755name = "spin"2756version = "0.9.8"2757source = "registry+https://github.com/rust-lang/crates.io-index"2758checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"228027592281[[package]]2760[[package]]2282name = "spki"2761name = "spki"232928082330[[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]28192820[[package]]2821name = "sync_wrapper"2822version = "0.1.2"2823source = "registry+https://github.com/rust-lang/crates.io-index"2824checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160"28252826[[package]]2827name = "sync_wrapper"2828version = "1.0.1"2829source = "registry+https://github.com/rust-lang/crates.io-index"2830checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394"234028312341[[package]]2832[[package]]2342name = "tabled"2833name = "tabled"2384 "windows-sys 0.48.0",2875 "windows-sys 0.48.0",2385]2876]28772878[[package]]2879name = "terraform-provider-fleet"2880version = "0.1.0"2881dependencies = [2882 "anyhow",2883 "async-trait",2884 "serde",2885 "tf-provider",2886 "tokio",2887]238628882387[[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"28942895[[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]239229222393[[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]241229422413[[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]249030202491[[package]]3021[[package]]2498 "tokio",3028 "tokio",2499]3029]30303031[[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]30413042[[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]250030532501[[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]31093110[[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]31413142[[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]31543155[[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]31743175[[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]31913192[[package]]3193name = "tower-layer"3194version = "0.3.3"3195source = "registry+https://github.com/rust-lang/crates.io-index"3196checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e"31973198[[package]]3199name = "tower-service"3200version = "0.3.3"3201source = "registry+https://github.com/rust-lang/crates.io-index"3202checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3"255632032557[[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]257832252579[[package]]3226[[package]]2609 "tracing-core",3256 "tracing-core",2610]3257]32583259[[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]261132682612[[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]32893290[[package]]3291name = "try-lock"3292version = "0.2.5"3293source = "registry+https://github.com/rust-lang/crates.io-index"3294checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"262932952630[[package]]3296[[package]]2631name = "type-map"3297name = "type-map"2704 "subtle",3370 "subtle",2705]3371]33723373[[package]]3374name = "untrusted"3375version = "0.9.0"3376source = "registry+https://github.com/rust-lang/crates.io-index"3377checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1"270633782707[[package]]3379[[package]]2708name = "utf8parse"3380name = "utf8parse"2765 "winapi-util",3437 "winapi-util",2766]3438]34393440[[package]]3441name = "want"3442version = "0.3.1"3443source = "registry+https://github.com/rust-lang/crates.io-index"3444checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e"3445dependencies = [3446 "try-lock",3447]276734482768[[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]279834792814dependencies = [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]37183719[[package]]3720name = "yasna"3721version = "0.5.2"3722source = "registry+https://github.com/rust-lang/crates.io-index"3723checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd"3724dependencies = [3725 "time",3726]303737273038[[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]30633753cmds/fleet/Cargo.tomldiffbeforeafterboth45indicatif = { version = "0.17", optional = true }45indicatif = { version = "0.17", optional = true }46nix-eval.workspace = true46nix-eval.workspace = true47nom = "7.1.3"47nom = "7.1.3"48fleet-base = { version = "0.1.0", path = "../../crates/fleet-base" }484949[features]50[features]50# Not quite stable51# Not quite stablecmds/fleet/src/cmds/build_systems.rsdiffbeforeafterboth223use 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};910use crate::{11 command::MyCommand,12 host::{Config, ConfigHost},13};141315#[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}271269272impl 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}321319322impl 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 v392 } else {391 } else {393 error!("unreachable? failed to get specialization");392 error!("unreachable? failed to get specialization");cmds/fleet/src/cmds/info.rsdiffbeforeafterboth223use anyhow::{ensure, Result};3use anyhow::{ensure, Result};4use clap::Parser;4use clap::Parser;5use nix_eval::nix_go_json;5use fleet_base::host::Config;67use crate::host::Config;6use nix_eval::nix_go_json;879#[derive(Parser)]8#[derive(Parser)]10pub struct Info {9pub struct Info {cmds/fleet/src/cmds/secrets/mod.rsdiffbeforeafterboth1use 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};768use 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};2021use crate::{22 fleetdata::{encrypt_secret_data, FleetSecret, FleetSecretPart, FleetSharedSecret},23 host::Config,24};252226#[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 }645642757 }754 }758}755}759756757/*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>,835833836 // Ok((success, abs_path))834 // Ok((success, abs_path))837}835}836*/838837cmds/fleet/src/cmds/tf.rsdiffbeforeafterboth1use std::{2 collections::{BTreeMap, HashMap},3 path::PathBuf,4};51use 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;78use crate::host::Config;12use tokio::{fs::copy, process::Command};1314#[derive(Deserialize)]15pub struct TfData {16 // Dummy17 #[allow(dead_code)]18 managed: bool,19 // Host => Data20 #[serde(default)]21 #[serde(skip_serializing_if = "BTreeMap::is_empty")]22 pub hosts: BTreeMap<String, Value>,23}92410#[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"];184019 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 }4849 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")?;5758 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 }206521 Ok(())66 Ok(())22 }67 }cmds/fleet/src/command.rsdiffbeforeafterbothno changes
cmds/fleet/src/fleetdata.rsdiffbeforeafterbothno changes
cmds/fleet/src/host.rsdiffbeforeafterbothno changes
cmds/fleet/src/keys.rsdiffbeforeafterbothno changes
cmds/fleet/src/main.rsdiffbeforeafterboth2#![feature(try_blocks)]2#![feature(try_blocks)]334pub(crate) mod cmds;4pub(crate) mod cmds;5pub(crate) mod command;5// pub(crate) mod command;6pub(crate) mod host;7pub(crate) mod keys;89pub(crate) mod extra_args;6pub(crate) mod extra_args;1011mod fleetdata;12713use std::{ffi::OsString, process::ExitCode};8use std::{ffi::OsString, process::ExitCode};14921 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};3435use crate::command::MyCommand;363037#[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 configuration85 #[clap(subcommand)]91 Tf(Tf),86 Tf(Tf),92}87}9388100 command: Opts,95 command: Opts,101}96}10297103async 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?;213208214 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(())crates/fleet-base/Cargo.tomldiffbeforeafterbothno changes
crates/fleet-base/src/command.rsdiffbeforeafterbothno changes
crates/fleet-base/src/fleetdata.rsdiffbeforeafterbothno changes
crates/fleet-base/src/host.rsdiffbeforeafterbothno changes
crates/fleet-base/src/keys.rsdiffbeforeafterbothno changes
crates/fleet-base/src/lib.rsdiffbeforeafterbothno changes
crates/fleet-base/src/opts.rsdiffbeforeafterbothno changes
crates/fleet-shared/src/encoding.rsdiffbeforeafterbothno changes
crates/fleet-shared/src/lib.rsdiffbeforeafterboth1use std::{2 fmt::{self, Display},3 str::FromStr,4};1mod encoding;56use base64::engine::{general_purpose::STANDARD_NO_PAD, Engine};2pub use encoding::SecretData;7use serde::{de::Error, Deserialize, Deserializer, Serialize};8use unicode_categories::UnicodeCategories;910#[derive(Debug, PartialEq, Clone)]11pub struct SecretData {12 pub data: Vec<u8>,13 pub encrypted: bool,14}1516const 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>";2122const SECRET_PREFIX: &str = "<ENCRYPTED>";2324impl<'de> Deserialize<'de> for SecretData {25 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>26 where27 D: Deserializer<'de>,28 {29 let string = String::deserialize(deserializer)?;30 string.parse().map_err(D::Error::custom)31 }32}3334impl Serialize for SecretData {35 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>36 where37 S: serde::Serializer,38 {39 self.to_string().serialize(serializer)40 }41}4243impl FromStr for SecretData {44 type Err = String;4546 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_PAD54 .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}7273impl 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 = None83 };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}105106fn 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 alphabet115 || c == '/' || c == '+'116 || c == '='117 })118}119120#[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}1573crates/nix-eval/src/session.rsdiffbeforeafterboth12 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};161617#[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.collected153 .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());350351 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,crates/remowt-fs/Cargo.tomldiffbeforeafterbothno changes
crates/remowt-fs/src/lib.rsdiffbeforeafterbothno changes
flake.nixdiffbeforeafterboth116 bacon116 bacon117 nil117 nil118 ];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.modules/extras/tf.nixdiffbeforeafterboth1{1{2 config,2 config,3 lib,3 lib,4 fleetLib,4 inputs,5 inputs,5 ...6 ...6}: let7}: let7 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 module21 ];17 };22 };18 };23 };24 data = mkDataOption {25 # host => hostData26 options.extra.terraformHosts = mkOption {27 default = {};28 type = attrsOf (attrsOf unspecified);29 description = "Hosts data provided by fleet tf";30 };31 };32 };3319 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 attribute40 # will be somehow processed by fleet tf.24 sensitive = true;41 sensitive = true;25 };42 };43 hosts = config.data.extra.terraformHosts;44 };26}45}2746modules/secrets-data.nixdiffbeforeafterboth6}: let6}: let7 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