Project

General

Profile

Actions

Bug #4382

closed

Spoof by hostname does not work if there is a host without an IP address

Added by Lukas Zapletal over 10 years ago. Updated over 10 years ago.

Status:
Duplicate
Priority:
Normal
Category:
Unattended installations
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

If there is at least one host that has no IP address set, hostname spoofing cannot work:

  def find_host_by_spoof
    ip, name = params.delete('spoof'), params.delete('hostname')
    return nil if ip.blank? && name.blank?
    @spoof = true
    Host.find_by_ip(ip) || Host.find_by_name(name)
  end

Beacause this query always succeeds:

Host::Managed Load (0.2ms)  SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."ip" IS NULL LIMIT 1

and returns "random" host according to the order in index or memory or whatever (SQL database magic).

Tiny little nasty bug that made me scratching my head for a LOOONG time today when I was working on puppet-unattended. I think I will fix this as this blocks my dev setup right now. So many undeletable hosts :-)


Related issues 1 (0 open1 closed)

Is duplicate of Foreman - Bug #4268: Spoof by hostname still searches by an empty IP and returns the wrong hostClosedDominic Cleal02/05/2014Actions
Actions #1

Updated by Dominic Cleal over 10 years ago

  • Is duplicate of Bug #4268: Spoof by hostname still searches by an empty IP and returns the wrong host added
Actions #2

Updated by Dominic Cleal over 10 years ago

  • Status changed from Assigned to Duplicate
  • Target version deleted (1.9.1)

git rebase develop :)

Actions

Also available in: Atom PDF