File tree Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Expand file tree Collapse file tree 4 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -66,14 +66,15 @@ func (c *LoadConfig) validate() error {
66
66
return err
67
67
}
68
68
69
- func (c * LoadConfig ) getConf (yamlFile * bytes.Buffer ) * LoadConfig {
69
+ func (c * LoadConfig ) getConf (yamlFile * bytes.Buffer ) ( * LoadConfig , error ) {
70
70
71
71
err := yaml .Unmarshal (yamlFile .Bytes (), c )
72
72
if err != nil {
73
- log .Fatalf ("Unmarshal: %v" , err )
73
+ log .Errorf ("Unmarshal: %v" , err )
74
+ return c , err
74
75
}
75
76
76
- return c
77
+ return c , err
77
78
}
78
79
79
80
func (c * LoadConfig ) print () {
Original file line number Diff line number Diff line change @@ -68,7 +68,12 @@ func Load(request *msgs.LoadRequest) msgs.LoadResponse {
68
68
LoadConfigTemplate := loadJobTemplateFields {}
69
69
70
70
var LoadCfg LoadConfig
71
- LoadCfg .getConf (bytes .NewBufferString (request .LoadConfig ))
71
+ _ , err = LoadCfg .getConf (bytes .NewBufferString (request .LoadConfig ))
72
+ if err != nil {
73
+ resp .Status .Code = msgs .Error
74
+ resp .Status .Msg = err .Error ()
75
+ return resp
76
+ }
72
77
73
78
err = LoadCfg .validate ()
74
79
if err != nil {
Original file line number Diff line number Diff line change 1
1
COImagePrefix : crunchydata
2
- COImageTag : rhel7 -3.5.0-rc5
2
+ COImageTag : centos7 -3.5.0-rc8
3
3
DbDatabase : userdb
4
4
DbUser : postgres
5
5
DbPort : 5432
Original file line number Diff line number Diff line change @@ -77,6 +77,11 @@ func createLoad(args []string) {
77
77
}
78
78
79
79
buf , err := ioutil .ReadFile (LoadConfig )
80
+ if err != nil {
81
+ fmt .Println ("Error: " + err .Error ())
82
+ os .Exit (2 )
83
+ }
84
+
80
85
request := msgs.LoadRequest {}
81
86
request .LoadConfig = string (buf )
82
87
request .Selector = Selector
You can’t perform that action at this time.
0 commit comments