@@ -29,6 +29,7 @@ pub(crate) async fn ssh(sub: &ArgMatches, cluster: ClusterHandle) -> Result<()>
2929 let mut args: Vec < String > = sub. get_many ( "args" ) . unwrap_or_default ( ) . cloned ( ) . collect ( ) ;
3030 let job: Vec < String > = sub. get_many ( "job" ) . unwrap_or_default ( ) . cloned ( ) . collect ( ) ;
3131 let delay = Duration :: from_secs ( * sub. get_one :: < u64 > ( "delay" ) . unwrap_or ( & 0 ) ) ;
32+ let node_class = sub. get_one :: < String > ( "class" ) . cloned ( ) ;
3233
3334 let namespace = sub
3435 . get_one :: < String > ( "namespace" )
@@ -41,7 +42,7 @@ pub(crate) async fn ssh(sub: &ArgMatches, cluster: ClusterHandle) -> Result<()>
4142
4243 if sub. is_present ( "all" ) {
4344 let nodes = if sub. is_present ( "clients" ) {
44- cluster. nodes . find_clients ( )
45+ cluster. nodes . find_clients ( node_class )
4546 } else {
4647 cluster. nodes
4748 } ;
@@ -58,7 +59,7 @@ pub(crate) async fn ssh(sub: &ArgMatches, cluster: ClusterHandle) -> Result<()>
5859 return Ok ( ( ) ) ;
5960 } else if sub. is_present ( "parallel" ) {
6061 let nodes = if sub. is_present ( "clients" ) {
61- cluster. nodes . find_clients ( )
62+ cluster. nodes . find_clients ( node_class )
6263 } else {
6364 cluster. nodes
6465 } ;
@@ -143,11 +144,12 @@ async fn init_ssh(ip: IpAddr, args: Vec<String>, cluster: String) -> Result<()>
143144pub ( crate ) async fn deploy ( sub : & ArgMatches , cluster : ClusterHandle ) -> Result < ( ) > {
144145 let opts = <subs:: Deploy as FromArgMatches >:: from_arg_matches ( sub) . unwrap_or_default ( ) ;
145146 let cluster = cluster. await ??;
147+ let node_class = sub. get_one :: < String > ( "class" ) . cloned ( ) ;
146148
147149 info ! ( "node needles: {:?}" , opts. nodes) ;
148150
149151 let instances = if opts. clients {
150- cluster. nodes . find_clients ( )
152+ cluster. nodes . find_clients ( node_class )
151153 } else {
152154 cluster
153155 . nodes
@@ -219,7 +221,6 @@ async fn info_print(cluster: ClusterHandle, json: bool) -> Result<()> {
219221 if json {
220222 let stdout = io:: stdout ( ) ;
221223 let handle = stdout. lock ( ) ;
222- env:: set_var ( "BITTE_INFO_NO_ALLOCS" , "" ) ;
223224 serde_json:: to_writer_pretty ( handle, & cluster) ?;
224225 } else {
225226 let mut core_nodes_table = Table :: new ( ) ;
@@ -234,23 +235,14 @@ async fn info_print(cluster: ClusterHandle, json: bool) -> Result<()> {
234235
235236 for node in nodes. into_iter ( ) {
236237 match node. asg {
237- Some ( asg) => {
238- let name: String = asg. to_string ( ) ;
239- // TODO extract true client group
238+ Some ( _) => {
240239 let group: String = {
241- let suffix = name. split ( '-' ) . last ( ) . unwrap_or_default ( ) . to_owned ( ) ;
242- let i_type = node
243- . node_type
244- . clone ( )
245- . unwrap_or_default ( )
246- . split ( '.' )
247- . last ( )
248- . unwrap_or_default ( )
249- . to_owned ( ) ;
250- if suffix == i_type {
251- "" . to_string ( )
252- } else {
253- format ! ( " ({})" , suffix)
240+ match node. nomad_client {
241+ Some ( client) => match client. node_class {
242+ Some ( class) => format ! ( " ({})" , class) ,
243+ None => "" . to_string ( ) ,
244+ } ,
245+ None => "" . to_string ( ) ,
254246 }
255247 } ;
256248
0 commit comments