Fix exception that is not properly raised

This commit fixes an exception that was not properly raised, and
also makes the exception more relevant.

This also fixes an outstanding bug where, if the agent
was not associated with a node, get_node_uuid() would fail in an
unexpected manner.

Change-Id: Ifca474a73dd50b5fd2242e5b7e938a5db04f27a8