11use std:: process:: Stdio ;
22
3+ use indicatif:: ProgressStyle ;
34use snafu:: { OptionExt , ResultExt , Snafu , ensure} ;
45use tokio:: { io:: AsyncWriteExt , process:: Command } ;
5- use tracing:: { debug, info, instrument} ;
6+ use tracing:: { Span , debug, info, instrument} ;
7+ use tracing_indicatif:: span_ext:: IndicatifSpanExt ;
68
79use crate :: {
810 engine:: {
@@ -67,6 +69,7 @@ impl Cluster {
6769 #[ instrument( skip_all) ]
6870 pub async fn create ( & self ) -> Result < ( ) > {
6971 info ! ( "Creating local cluster using kind" ) ;
72+ Span :: current ( ) . pb_set_style ( & ProgressStyle :: with_template ( "" ) . unwrap ( ) ) ;
7073
7174 // Check if required binaries are present
7275 if let Some ( binary) = binaries_present_with_name ( & [ "docker" , "kind" ] ) {
@@ -112,6 +115,7 @@ impl Cluster {
112115 #[ instrument( skip_all) ]
113116 pub async fn create_if_not_exists ( & self ) -> Result < ( ) > {
114117 info ! ( "Creating cluster if it doesn't exist using kind" ) ;
118+ Span :: current ( ) . pb_set_style ( & ProgressStyle :: with_template ( "" ) . unwrap ( ) ) ;
115119
116120 if Self :: check_if_cluster_exists ( & self . name ) . await ? {
117121 return Ok ( ( ) ) ;
@@ -134,16 +138,20 @@ impl Cluster {
134138 #[ instrument( skip_all) ]
135139 async fn check_if_cluster_exists ( cluster_name : & str ) -> Result < bool > {
136140 debug ! ( "Checking if kind cluster exists" ) ;
141+ Span :: current ( ) . pb_set_style ( & ProgressStyle :: with_template ( "" ) . unwrap ( ) ) ;
137142
138143 let output = Command :: new ( "kind" )
139144 . args ( [ "get" , "clusters" ] )
140145 . output ( )
141146 . await
142147 . context ( CommandFailedToRunSnafu ) ?;
143148
144- ensure ! ( output. status. success( ) , CommandErroredOutSnafu {
145- error: String :: from_utf8_lossy( & output. stderr)
146- } ) ;
149+ ensure ! (
150+ output. status. success( ) ,
151+ CommandErroredOutSnafu {
152+ error: String :: from_utf8_lossy( & output. stderr)
153+ }
154+ ) ;
147155
148156 let output = String :: from_utf8_lossy ( & output. stdout ) ;
149157 Ok ( output. lines ( ) . any ( |name| name == cluster_name) )
0 commit comments