Project

General

Profile

Actions

Bug #2550

closed

Puppetclass search_by_host doesn't return all classes for an unknown host

Added by Daniel Lobato Garcia over 11 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Normal
Category:
Search
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Puppetclass.search_for shows up in puppetclasses_controller and its respective method of the API. It uses scoped_search to look for all puppetclasses that a host contains. Unfortunately, in the event of a lookup of a host that either belongs to no hostgroup or a host that doesn't exist, this will return all puppetclasses.

This fix checks for this conditions and avoids returning all puppetclasses.

curl -v -k -H d"Content-Type:application/json" https://foreman/api/hosts/nonexistenthost/puppetclasses returns
Puppetclass.all without this fix,
after this fix it returns {} (no puppet classes, which is correct)

Actions

Also available in: Atom PDF