CA-145685: Fix KeyError exception when detaching device

Signed-off-by: Flavien Quesnel <flavien.quesnel@citrix.com>