Project

General

Profile

Actions

Bug #12263

open

api 1.9 hostgroups update to :organization_names => ['local'] sets location, not organization when there are organizations and locations with the same name

Added by Dan Rosenbloom over 8 years ago. Updated over 8 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Organizations and Locations
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

When writing the provider / type for foreman_hostgroup (https://github.com/theforeman/puppet-foreman/pull/366), I discovered that calling an api create or update on a hostgroup, if there is an org and a location with the same name, setting organization_names sets the locations, not the organization.

[148] pry(main)> api.resource(:hostgroups).call(:show, id: 10)["locations"]
=> []
[149] pry(main)> api.resource(:hostgroups).call(:show, id: 10)["organizations"]
=> []
[150] pry(main)> api.resource(:hostgroups).call(:update, {:id => 10, :hostgroup => { :organization_names => ["local"] }})
=> {"ancestry"=>"5",
 "architecture_id"=>nil,
 "compute_profile_id"=>nil,
 "created_at"=>"2015-10-22T13:27:40Z",
 "domain_id"=>nil,
 "environment_id"=>1,
 "grub_pass"=>"",
 "id"=>10,
 "image_file"=>"",
 "medium_id"=>nil,
 "name"=>"test9",
 "operatingsystem_id"=>nil,
 "ptable_id"=>nil,
 "puppet_ca_proxy_id"=>1,
 "puppet_proxy_id"=>1,
 "realm_id"=>nil,
 "root_pass"=>nil,
 "subnet_id"=>nil,
 "title"=>"test4/test9",
 "updated_at"=>"2015-10-22T13:27:40Z",
 "use_image"=>nil,
 "vm_defaults"=>nil}
[151] pry(main)> api.resource(:hostgroups).call(:show, id: 10)["locations"]
=> [{"id"=>1, "name"=>"local", "title"=>"local"}]
[152] pry(main)> api.resource(:hostgroups).call(:show, id: 10)["organizations"]
=> []
Actions #1

Updated by Dominic Cleal over 8 years ago

  • Category set to Organizations and Locations
Actions

Also available in: Atom PDF