@@ -17,20 +17,17 @@ pub enum Error {
17
17
#[ snafu( display( "failed to read resolv.conf" ) ) ]
18
18
ReadResolvConfFile { source : std:: io:: Error } ,
19
19
20
- #[ snafu( display( "failed to parse {cluster_domain:?} as cluster domain" ) ) ]
20
+ #[ snafu( display( "failed to parse {cluster_domain:?} as domain name " ) ) ]
21
21
ParseDomainName {
22
22
source : crate :: validation:: Errors ,
23
23
cluster_domain : String ,
24
24
} ,
25
25
26
- #[ snafu( display( "No 'search' entries found in " ) ) ]
27
- SearchEntryNotFound ,
26
+ #[ snafu( display( "unable to find \" search \" entry " ) ) ]
27
+ NoSearchEntry ,
28
28
29
- #[ snafu( display( "Could not trim search entry in '{search_entry_line}'." ) ) ]
30
- TrimSearchEntryFailed { search_entry_line : String } ,
31
-
32
- #[ snafu( display( "Could not find any cluster domain entry in search line." ) ) ]
33
- LookupClusterDomainEntryFailed ,
29
+ #[ snafu( display( "unable to find unambiguous domain in \" search\" entry" ) ) ]
30
+ AmbiguousDomainEntries ,
34
31
}
35
32
36
33
/// This is the primary entry point to retrieve the Kubernetes cluster domain.
@@ -115,12 +112,12 @@ where
115
112
. filter ( |l| l. starts_with ( "search" ) )
116
113
. map ( |l| l. trim_start_matches ( "search" ) )
117
114
. last ( )
118
- . context ( SearchEntryNotFoundSnafu ) ?;
115
+ . context ( NoSearchEntrySnafu ) ?;
119
116
120
117
let shortest_entry = last
121
118
. split_ascii_whitespace ( )
122
119
. min_by_key ( |item| item. len ( ) )
123
- . context ( LookupClusterDomainEntryFailedSnafu ) ?;
120
+ . context ( AmbiguousDomainEntriesSnafu ) ?;
124
121
125
122
// NOTE (@Techassi): This is really sad and bothers me more than I would like to admit
126
123
Ok ( shortest_entry. to_owned ( ) )
0 commit comments