Partially revert "No need to do hostname resolution during reimage"

This reverts commit e4972dbfb5d82f5810f16bcac4350c1d68c4b23e,
and exits if hostname is not resolved

Change-Id: I9ed92b4d8846754586c0a6df27b89028c27fefcf