Adding logic to use either hostname or fqdn fact

I've added some simple logic to determine whether the remote host is specified as a hostname or fqdn. This makes the PuppetDB lookup a bit more flexible and robust, so it works in Vagrant environments as well.