1
+ /*
2
+ Copyright 2018 Kubernetes Authors
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
1
16
package main
2
17
3
18
import (
@@ -16,11 +31,11 @@ func main() {
16
31
endpoint := os .Getenv ("CSI_ENDPOINT" )
17
32
if len (endpoint ) == 0 {
18
33
fmt .Println ("CSI_ENDPOINT must be defined and must be a path" )
19
- return
34
+ os . Exit ( 1 )
20
35
}
21
36
if strings .Contains (endpoint , ":" ) {
22
37
fmt .Println ("CSI_ENDPOINT must be a unix path" )
23
- return
38
+ os . Exit ( 1 )
24
39
}
25
40
26
41
// Create mock driver
@@ -39,14 +54,15 @@ func main() {
39
54
fmt .Printf ("Error: Unable to listen on %s socket: %v\n " ,
40
55
endpoint ,
41
56
err )
42
- return
57
+ os . Exit ( 1 )
43
58
}
44
59
defer os .Remove (endpoint )
45
60
46
61
// Start server
47
62
if err := d .Start (l ); err != nil {
48
63
fmt .Printf ("Error: Unable to start mock CSI server: %v\n " ,
49
64
err )
65
+ os .Exit (1 )
50
66
}
51
67
fmt .Println ("mock driver started" )
52
68
0 commit comments