Fix undefined variable references in server code

- detected by Sonar, relying on Sonar to verify fix
- latent defects also indicate test coverage gaps
- not addressing the lack of test coverage yet

Cherry picked from 0.15 to 0.14.2 to resolve:

Bug: 999733

Conflicts:
	Server/bkr/server/kickstart.py

Change-Id: I77c6c4756ace2ab73bce84b8a77e22447f3b3bd3