agent: handle malformed metadata better

Change-Id: Ie5d2ad055cbea13490d04ec3589c32a3c08a5119
Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1158925
Signed-off-by: Jiri Moskovcak <jmoskovc@redhat.com>