Project

General

Profile

Actions

Bug #24059

closed

Discovery API update call is always set with build flag

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

Status:
Closed
Priority:
Normal
Category:
Discovery plugin
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

Description of problem:

There is a regression introduced in foremand_discovery by this commit 044cd42ffcb96819af0bd3d88bb348f2f9dc8ea9.

Sending a put request to /api/v2/discovered_hosts/id with build=0 used to work in 6.2 but now host.build is always set 1 by this API in Satellite 6.3.

Version-Release number of selected component (if applicable):

6.3.1

How reproducible:

Easy

Steps to Reproduce:

Sending a put request to /api/v2/discovered_hosts/id with the data like this

{
"discovered_host": {
"name": "$hostname",
"mac": "$mac",
"ip": "$ip",
"hostgroup_name": "$hostgroup_name",
"root_pass": "$root_pass",
"build": 0,
}

Actual results:

The discovered host went directly into provisioning and host.build = 1

Expected results:

The discovered host shouldn't go directly into provisioning and host.build = 0

Additional info:

Comparing this two lines in foreman_discovery/app/controllers/api/v2/discovered_hosts_controller.rb

6.2:

@host = ::ForemanDiscovery::HostConverter.to_managed(@discovered_host)

6.3:

@host = ::ForemanDiscovery::HostConverter.to_managed(@discovered_host, true, true, managed_host_params)

Then take a look foreman_discovery/app/services/foreman_discovery/host_converter.rb +37 in 6.3

host.build = true

This just ignores the build parameter from the API request which is not right.

https://bugzilla.redhat.com/show_bug.cgi?id=1593576

Actions

Also available in: Atom PDF