mirror of
https://github.com/kairos-io/kairos-agent.git
synced 2025-10-22 03:49:31 +00:00
fix: dont try to unmarshal into JSON if data is empty (#996)
This commit is contained in:
@@ -35,8 +35,10 @@ func runCustomizationPlugins() ([]YAMLPrompt, error) {
|
|||||||
var r []YAMLPrompt
|
var r []YAMLPrompt
|
||||||
|
|
||||||
bus.Manager.Response(sdk.EventInteractiveInstall, func(p *pluggable.Plugin, resp *pluggable.EventResponse) {
|
bus.Manager.Response(sdk.EventInteractiveInstall, func(p *pluggable.Plugin, resp *pluggable.EventResponse) {
|
||||||
err := json.Unmarshal([]byte(resp.Data), &r)
|
if resp.Data == "" {
|
||||||
if err != nil {
|
return
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal([]byte(resp.Data), &r); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@@ -96,6 +96,9 @@ func Install(sourceImgURL string, dir ...string) error {
|
|||||||
})
|
})
|
||||||
|
|
||||||
bus.Manager.Response(events.EventInstall, func(p *pluggable.Plugin, resp *pluggable.EventResponse) {
|
bus.Manager.Response(events.EventInstall, func(p *pluggable.Plugin, resp *pluggable.EventResponse) {
|
||||||
|
if resp.Data == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
err := json.Unmarshal([]byte(resp.Data), &r)
|
err := json.Unmarshal([]byte(resp.Data), &r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
@@ -139,6 +139,9 @@ func sharedReset(reboot, unattended, resetOem bool, dir ...string) (c *config.Co
|
|||||||
// This gets the options from an event that can be sent by anyone.
|
// This gets the options from an event that can be sent by anyone.
|
||||||
// This should override the default config as it's much more dynamic
|
// This should override the default config as it's much more dynamic
|
||||||
bus.Manager.Response(sdk.EventBeforeReset, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
|
bus.Manager.Response(sdk.EventBeforeReset, func(p *pluggable.Plugin, r *pluggable.EventResponse) {
|
||||||
|
if r.Data == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
err := json.Unmarshal([]byte(r.Data), &optionsFromEvent)
|
err := json.Unmarshal([]byte(r.Data), &optionsFromEvent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
|
Reference in New Issue
Block a user