@@ -265,6 +265,14 @@ pub struct DeployData<'a> {
265
265
pub merged_settings : settings:: GenericSettings ,
266
266
}
267
267
268
+ #[ derive( Error , Debug ) ]
269
+ pub enum DeployDataError {
270
+ #[ error( "Neither `user` nor `sshUser` are set for profile {0} of node {1}" ) ]
271
+ NoProfileUser ( String , String ) ,
272
+ #[ error( "Value `hostname` is not define for profile {0} of node {1}" ) ]
273
+ NoProfileHost ( String , String ) ,
274
+ }
275
+
268
276
#[ derive( Clap , Debug , Clone ) ]
269
277
pub struct Flags {
270
278
/// Check signatures when using `nix copy`
@@ -310,14 +318,6 @@ pub struct DeployDefs {
310
318
pub sudo : Option < String > ,
311
319
}
312
320
313
- #[ derive( Error , Debug ) ]
314
- pub enum DeployDataDefsError {
315
- #[ error( "Neither `user` nor `sshUser` are set for profile {0} of node {1}" ) ]
316
- NoProfileUser ( String , String ) ,
317
- #[ error( "Value `hostname` is not define for profile {0} of node {1}" ) ]
318
- NoProfileHost ( String , String ) ,
319
- }
320
-
321
321
impl < ' a > DeployData < ' a > {
322
322
323
323
fn new (
@@ -352,7 +352,7 @@ impl<'a> DeployData<'a> {
352
352
}
353
353
}
354
354
355
- pub fn defs ( & ' a self ) -> Result < DeployDefs , DeployDataDefsError > {
355
+ pub fn defs ( & ' a self ) -> Result < DeployDefs , DeployDataError > {
356
356
let ssh_user = match self . merged_settings . ssh_user {
357
357
Some ( ref u) => u. clone ( ) ,
358
358
None => whoami:: username ( ) ,
@@ -375,7 +375,7 @@ impl<'a> DeployData<'a> {
375
375
} )
376
376
}
377
377
378
- pub fn ssh_uri ( & ' a self ) -> Result < String , DeployDataDefsError > {
378
+ pub fn ssh_uri ( & ' a self ) -> Result < String , DeployDataError > {
379
379
380
380
let hostname = match self . hostname {
381
381
Some ( x) => x,
@@ -390,7 +390,7 @@ impl<'a> DeployData<'a> {
390
390
}
391
391
392
392
// can be dropped once ssh fully supports ipv6 uris
393
- pub fn ssh_non_uri ( & ' a self ) -> Result < String , DeployDataDefsError > {
393
+ pub fn ssh_non_uri ( & ' a self ) -> Result < String , DeployDataError > {
394
394
395
395
let hostname = match self . hostname {
396
396
Some ( x) => x,
@@ -408,7 +408,7 @@ impl<'a> DeployData<'a> {
408
408
self . merged_settings . ssh_opts . iter ( )
409
409
}
410
410
411
- pub fn get_profile_path ( & ' a self ) -> Result < String , DeployDataDefsError > {
411
+ pub fn get_profile_path ( & ' a self ) -> Result < String , DeployDataError > {
412
412
let profile_user = self . get_profile_user ( ) ?;
413
413
let profile_path = match self . profile . profile_settings . profile_path {
414
414
None => match & profile_user[ ..] {
@@ -423,13 +423,13 @@ impl<'a> DeployData<'a> {
423
423
Ok ( profile_path)
424
424
}
425
425
426
- pub fn get_profile_user ( & ' a self ) -> Result < String , DeployDataDefsError > {
426
+ pub fn get_profile_user ( & ' a self ) -> Result < String , DeployDataError > {
427
427
let profile_user = match self . merged_settings . user {
428
428
Some ( ref x) => x. clone ( ) ,
429
429
None => match self . merged_settings . ssh_user {
430
430
Some ( ref x) => x. clone ( ) ,
431
431
None => {
432
- return Err ( DeployDataDefsError :: NoProfileUser (
432
+ return Err ( DeployDataError :: NoProfileUser (
433
433
self . profile_name . to_owned ( ) ,
434
434
self . node_name . to_owned ( ) ,
435
435
) )
0 commit comments