added futher logic to protect puppet agents when no role is set.