@@ -12,7 +12,6 @@ use tracing_subscriber::{
1212 util:: SubscriberInitExt ,
1313 EnvFilter ,
1414} ;
15- use types:: DeviceType ;
1615
1716mod api;
1817mod cli;
@@ -29,7 +28,7 @@ use crate::legacy::{LegacyConfig, ProxyConfig, ProxyState};
2928use crate :: remote:: {
3029 provision, ProvisioningConfig , ProvisioningError , RemoteConfig , RequestConfig ,
3130} ;
32- use crate :: types:: Uuid ;
31+ use crate :: types:: { OperatingSystem , Uuid } ;
3332
3433fn initialize_tracing ( ) {
3534 // Initialize tracing subscriber for human-readable logs
@@ -43,6 +42,7 @@ fn initialize_tracing() {
4342 . add_directive ( "mahler::planner=warn" . parse ( ) . unwrap ( ) )
4443 . add_directive ( "mahler::worker=debug" . parse ( ) . unwrap ( ) )
4544 . add_directive ( "hyper=error" . parse ( ) . unwrap ( ) )
45+ . add_directive ( "reqwest=debug" . parse ( ) . unwrap ( ) )
4646 . add_directive ( "bollard=error" . parse ( ) . unwrap ( ) ) ,
4747 ) ,
4848 )
@@ -82,17 +82,18 @@ async fn main() -> Result<(), Box<dyn Error>> {
8282 . expect ( "not nil because legacy_api_endpoint isn't nil" ) ,
8383 } ) ;
8484
85- let ( uuid, remote_config, device_type) = maybe_provision ( & cli) . await ?;
85+ let ( uuid, remote_config) = maybe_provision ( & cli) . await ?;
86+ let os = cli. os . clone ( ) ;
8687
87- start_supervisor ( uuid, device_type , api_config, remote_config, legacy_config) . await ?;
88+ start_supervisor ( uuid, os , api_config, remote_config, legacy_config) . await ?;
8889
8990 Ok ( ( ) )
9091}
9192
9293#[ instrument( name = "helios" , skip_all, err) ]
9394async fn start_supervisor (
9495 uuid : Uuid ,
95- device_type : Option < DeviceType > ,
96+ os : Option < OperatingSystem > ,
9697 api_config : Option < ApiConfig > ,
9798 remote_config : Option < RemoteConfig > ,
9899 legacy_config : Option < LegacyConfig > ,
@@ -107,7 +108,7 @@ async fn start_supervisor(
107108
108109 // Load the initial state
109110 let docker = Docker :: connect_with_defaults ( ) ?;
110- let initial_state = state:: read ( & docker, uuid. clone ( ) , device_type ) . await ?;
111+ let initial_state = state:: read ( & docker, uuid. clone ( ) , os ) . await ?;
111112
112113 let registry_auth = remote_config. clone ( ) . map ( RegistryAuthClient :: new) ;
113114
@@ -227,9 +228,7 @@ where
227228/// If `remote_config` is not nil, then we are registered with a remote.
228229/// If `remote_config` is nil, then we aren't registered and need to provision.
229230/// If `remote_config` is still nil after provisioning, then we'll run in "unmanaged" mode.
230- async fn maybe_provision (
231- cli : & Cli ,
232- ) -> Result < ( Uuid , Option < RemoteConfig > , Option < DeviceType > ) , ProvisioningError > {
231+ async fn maybe_provision ( cli : & Cli ) -> Result < ( Uuid , Option < RemoteConfig > ) , ProvisioningError > {
233232 // Load our provisioning config, if one exists
234233 let provisioning_config = config:: get :: < ProvisioningConfig > ( ) ?;
235234
@@ -266,7 +265,7 @@ async fn maybe_provision(
266265 ) ;
267266 }
268267
269- Ok ( ( uuid. clone ( ) , Some ( remote) , None ) )
268+ Ok ( ( uuid. clone ( ) , Some ( remote) ) )
270269 }
271270 // Otherwise use an existing provisioning config, if available
272271 else if let Some ( ref provisioning_config) = & provisioning_config {
@@ -291,7 +290,6 @@ async fn maybe_provision(
291290 }
292291
293292 let uuid = & provisioning_config. uuid ;
294- let device_type = provisioning_config. device_type . clone ( ) ;
295293 let request_defaults = & provisioning_config. remote . request ;
296294 let remote = RemoteConfig {
297295 request : RequestConfig {
@@ -311,7 +309,7 @@ async fn maybe_provision(
311309 ..provisioning_config. remote . clone ( )
312310 } ;
313311
314- Ok ( ( uuid. clone ( ) , Some ( remote) , Some ( device_type ) ) )
312+ Ok ( ( uuid. clone ( ) , Some ( remote) ) )
315313 }
316314 // We have a provisioning key
317315 else if let Some ( provisioning_key) = & cli. provisioning_key {
@@ -355,13 +353,13 @@ async fn maybe_provision(
355353 } ,
356354 } ;
357355
358- let ( uuid, remote, device_type ) = provision ( provisioning_key, & provisioning_config) . await ?;
356+ let ( uuid, remote, _ ) = provision ( provisioning_key, & provisioning_config) . await ?;
359357
360- Ok ( ( uuid, Some ( remote) , Some ( device_type ) ) )
358+ Ok ( ( uuid, Some ( remote) ) )
361359 }
362360 // We don't have a remote at all; run in "unmanaged" mode
363361 else {
364362 // Generate a UUID if none provided
365- Ok ( ( cli. uuid . clone ( ) . unwrap_or_default ( ) , None , None ) )
363+ Ok ( ( cli. uuid . clone ( ) . unwrap_or_default ( ) , None ) )
366364 }
367365}
0 commit comments