Project

General

Profile

Actions

Bug #35732

open

new locations force hostgroups and provisioning templates to be in the ignore_types list breaking user workflows

Added by Evgeni Golov about 2 years ago. Updated 4 months ago.

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

Description

Ohai,

while working on https://github.com/theforeman/foreman-ansible-modules/pull/1509 with Manisha, we realized there is an interesting behaviour in Katello that is not intuitive to users.

When you create a new location, katello forces the "ignore_types" attribute to include hostgroups and provisioning templates: https://github.com/Katello/katello/blob/c6488ec90d08569368137c4a365b1a384824a34b/app/models/katello/concerns/location_extensions.rb#L13-L16
This was added back in 2014: https://github.com/Katello/katello/pull/4399

This has two effects, both of which are IMHO undesired:
  1. When one creates a location via the API and explicitly set ignore_types: [] or ignore_types: ["Subnet"], one still gets the parameter set to ["Subnet", "Hostgroup", "ProvisioningTemplate"] (and if the API client is Ansible, the next execution of the playbook will correct that to be ["Subnet"] while one would expect no-change)
  2. When the location is created and all Hostgroups/Templates are added to it, the user needs to first remove HG/PT from the ignore_types list, and then remove all HGs/PTs they did not want to be assigned in the first place.

At least for the API case the solution is probably easy: if the user has provided ignore_types (either as an empty list or a list with explicit values) don't amend their selection at all.

No idea how to "fix" that in the UI given the creation workflow is totally different there.

Actions #1

Updated by William Clark about 2 years ago

  • Status changed from New to Need more information

So, we call set_default_overrides when the new record is created, due to https://github.com/Katello/katello/blob/c6488ec90d08569368137c4a365b1a384824a34b/app/models/katello/concerns/location_extensions.rb#L7

It is not called when the record is updated, and doing so would mean that users wanting to opt-in to Location scoped HGs or PTs would be unable to remove those ignored_types

Removing these defaults entirely, making HGs and PTs Location scoped by default, however, seems like kind of an annoyance for users / would undo this feature, https://projects.theforeman.org/issues/5619

It is not pretty but, for an ansible modules user who wants to create a Location without HGs or PTs in ignored_types, could we add documentation suggesting that their playbook should have this task twice, first to create the Location, and again to update it? That way they do reach the desired state after the 1st time their playbook runs.

Actions #2

Updated by Evgeni Golov about 2 years ago

  • Status changed from Need more information to New

No, that would not help, as (quoting above):

When the location is created and all Hostgroups/Templates are added to it, the user needs to first remove HG/PT from the ignore_types list, and then remove all HGs/PTs they did not want to be assigned in the first place.

This is a) tedious, b) not solved by executing the same ansible task twice.

I am not asking you to revert that change from 2014 (even tho I wouldn't be opposed to that solution), just make it smarter that if the user provided a choice, the choice is honored.

Actions #3

Updated by Samir Jha about 2 years ago

  • Target version set to Katello 4.8.0
  • Triaged changed from No to Yes
Actions #4

Updated by Lucy Fu almost 2 years ago

  • Target version changed from Katello 4.8.0 to Katello 4.9.0
Actions #5

Updated by Lucy Fu over 1 year ago

  • Target version changed from Katello 4.9.0 to Katello 4.10.0
Actions #6

Updated by Chris Roberts about 1 year ago

  • Target version changed from Katello 4.10.0 to Katello 4.11.0
Actions #7

Updated by Ian Ballou 12 months ago

  • Target version changed from Katello 4.11.0 to Katello 4.12.0
Actions #8

Updated by Quinn James 9 months ago

  • Target version changed from Katello 4.12.0 to Katello 4.13.0

Bumping to 4.13

Actions #9

Updated by Partha Aji 6 months ago

  • Target version changed from Katello 4.13.0 to Katello 4.14.0
Actions #10

Updated by Chris Roberts 4 months ago

  • Target version changed from Katello 4.14.0 to Katello 4.16.0
Actions

Also available in: Atom PDF