2
2
// Licensed under the MIT License.
3
3
4
4
use crate :: args:: OutputFormat ;
5
- use crate :: util:: { EXIT_DSC_ERROR , EXIT_INVALID_ARGS , EXIT_JSON_ERROR , add_type_name_to_json, write_output} ;
5
+ use crate :: util:: { EXIT_DSC_ERROR , EXIT_INVALID_ARGS , EXIT_JSON_ERROR , EXIT_DSC_RESOURCE_NOT_FOUND , add_type_name_to_json, write_output} ;
6
6
use dsc_lib:: configure:: config_doc:: { Configuration , ExecutionKind } ;
7
7
use dsc_lib:: configure:: add_resource_export_results_to_configuration;
8
8
use dsc_lib:: dscresources:: { resource_manifest:: Kind , invoke_result:: { GetResult , ResourceGetResponse } } ;
@@ -18,7 +18,7 @@ use std::process::exit;
18
18
pub fn get ( dsc : & DscManager , resource_type : & str , mut input : String , format : & Option < OutputFormat > ) {
19
19
let Some ( mut resource) = get_resource ( dsc, resource_type) else {
20
20
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
21
- return
21
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
22
22
} ;
23
23
24
24
debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -60,7 +60,7 @@ pub fn get_all(dsc: &DscManager, resource_type: &str, format: &Option<OutputForm
60
60
let mut input = String :: new ( ) ;
61
61
let Some ( mut resource) = get_resource ( dsc, resource_type) else {
62
62
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
63
- return
63
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
64
64
} ;
65
65
66
66
debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -112,7 +112,7 @@ pub fn set(dsc: &DscManager, resource_type: &str, mut input: String, format: &Op
112
112
113
113
let Some ( mut resource) = get_resource ( dsc, resource_type) else {
114
114
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
115
- return
115
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
116
116
} ;
117
117
118
118
debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -158,7 +158,7 @@ pub fn test(dsc: &DscManager, resource_type: &str, mut input: String, format: &O
158
158
159
159
let Some ( mut resource) = get_resource ( dsc, resource_type) else {
160
160
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
161
- return
161
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
162
162
} ;
163
163
164
164
debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -199,7 +199,7 @@ pub fn test(dsc: &DscManager, resource_type: &str, mut input: String, format: &O
199
199
pub fn delete ( dsc : & DscManager , resource_type : & str , mut input : String ) {
200
200
let Some ( mut resource) = get_resource ( dsc, resource_type) else {
201
201
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
202
- return
202
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
203
203
} ;
204
204
205
205
debug ! ( "resource.type_name - {} implemented_as - {:?}" , resource. type_name, resource. implemented_as) ;
@@ -230,7 +230,7 @@ pub fn delete(dsc: &DscManager, resource_type: &str, mut input: String) {
230
230
pub fn schema ( dsc : & DscManager , resource_type : & str , format : & Option < OutputFormat > ) {
231
231
let Some ( resource) = get_resource ( dsc, resource_type) else {
232
232
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
233
- return
233
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
234
234
} ;
235
235
if resource. kind == Kind :: Adapter {
236
236
error ! ( "Can not perform this operation on the adapter {} itself" , resource. type_name) ;
@@ -260,7 +260,7 @@ pub fn export(dsc: &mut DscManager, resource_type: &str, format: &Option<OutputF
260
260
let mut input = String :: new ( ) ;
261
261
let Some ( dsc_resource) = get_resource ( dsc, resource_type) else {
262
262
error ! ( "{}" , DscError :: ResourceNotFound ( resource_type. to_string( ) ) . to_string( ) ) ;
263
- return
263
+ exit ( EXIT_DSC_RESOURCE_NOT_FOUND ) ;
264
264
} ;
265
265
266
266
if dsc_resource. kind == Kind :: Adapter {
0 commit comments