Project

General

Profile

Bug #19927

Hammer csv import package rules doesn't handle rules with the same name

Added by David Davis over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
content-view-filters
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Steps to reproduce:

1. Create a content view with a package filter
2. Create two rules on this filter with the same name (e.g. exclude vim version > 3.0 and vim version = 3.0)
3. Export your filters
4. Remove the filters
5. Do an import

Expected results:

Your filter should have two rules (e.g. exclude vim version > 3.0 and vim version = 3.0)

Actual result:

Your filter only has one rule, the second one (e.g. vim version = 3.0).

The problem is that name isn’t unique across filter rules but hammer csv assumes it is:

https://git.io/vHVBG
https://git.io/vHVBE


Related issues

Blocks Hammer CLI CSV - Bug #19724: Support importing/exporting erratum filtersNew2017-05-31

Associated revisions

Revision f92e695a (diff)
Added by David Davis over 2 years ago

Fixes #19927 - Drop and readd rules when importing filters

This is a change to the way we handle filter rules. Basically, there is
no way to ensure uniqueness among filter rules so updating rules isn't
possible. The package filter rule has a unique check but it simply
checks ALL fields to see if the rule exists already. This doesn't really
allow for matching though since any field change would constitute a new
rule. Since we're importing/updating filters and not rules, I think
dropping the rules and recreating them is the best way to handle
updates.

History

#1 Updated by David Davis over 2 years ago

  • Blocks Bug #19724: Support importing/exporting erratum filters added

#2 Updated by David Davis over 2 years ago

  • Subject changed from Hammer package filter rules doesn't handle rules with the same name to Hammer csv import package rules doesn't handle rules with the same name

#3 Updated by David Davis over 2 years ago

  • Bugzilla link set to 1458843

#4 Updated by Thomas McKay over 2 years ago

Just an FYI... Note that many/all of the csv files expect that names are unique and don't use labels typically. Perhaps an additional column should be added for label and then use that first, falling back to name column.

#5 Updated by David Davis over 2 years ago

Your idea is good but not really applicable. Content view rules don't have labels. This makes updating them hard.

#6 Updated by David Davis over 2 years ago

Talking this over with @jsherrill, I think when importing (or updating) existing filters, it might make sense to drop all its rules and then re-add the ones from the csv.

#7 Updated by The Foreman Bot over 2 years ago

  • Pull request https://github.com/Katello/hammer-cli-csv/pull/157 added

#8 Updated by Andrew Kofink over 2 years ago

  • Status changed from New to Closed

Also available in: Atom PDF