Project

General

Profile

Revision f92e695a

Added by David Davis over 4 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.

View differences:

test/csv_test_helper.rb
130 130
  end
131 131
end
132 132

  
133
def content_view_filter_delete(org, cv, name)
134
  id = nil
135
  stdout,stderr = capture {
136
    hammer.run(%W(content-view filter list --search name=#{name} --content-view #{cv} --organization #{org}))
137
  }
138
  lines = stdout.split("\n")
139
  if lines.length == 5
140
    id = lines[3].split(" ")[0]
141
  end
142

  
143
  if id
144
    stdout,stderr = capture {
145
      hammer.run(%W(content-view filter delete --id #{id}))
146
    }
147
  end
148
end
149

  
133 150
require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
134 151
require File.join(File.dirname(__FILE__), 'helpers/command')
135 152
require File.join(File.dirname(__FILE__), 'helpers/resource_disabled')

Also available in: Unified diff