From 79923a939b734a35e5196f47a6aad8869600023f Mon Sep 17 00:00:00 2001 From: James Shubin Date: Sat, 25 Feb 2017 21:28:35 -0500 Subject: [PATCH] resources: virt: Catch bad calls to CheckApply If the engine cheats, we'll know! --- resources/virt.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resources/virt.go b/resources/virt.go index 5be842b8..59082353 100644 --- a/resources/virt.go +++ b/resources/virt.go @@ -728,6 +728,9 @@ func (obj *VirtRes) domainShutdownSync(apply bool, dom *libvirt.Domain) (bool, e // CheckApply checks the resource state and applies the resource if the bool // input is true. It returns error info and if the state check passed or not. func (obj *VirtRes) CheckApply(apply bool) (bool, error) { + if obj.conn == nil { + panic("virt: CheckApply is being called with nil connection") + } // if we do the restart, we must flip the flag back to false as evidence var restart bool // do we need to do a restart? if obj.RestartOnRefresh && obj.Refresh() { // a refresh is a restart ask