Revision 44dac2f9
Added by Marek Hulán over 8 years ago
app/services/fact_parser.rb | ||
---|---|---|
delegate :logger, :to => :Rails
|
||
VIRTUAL = /\A([a-z0-9]+)_(\d+)\Z/
|
||
BRIDGES = /\A(vir)?br\d+(_nic)?\Z/
|
||
BONDS = /\A(bond\d+)|(lagg\d+)\Z/
|
||
BONDS = /\A(bond\d+)\Z|\A(lagg\d+)\Z/
|
||
VIRTUAL_NAMES = /#{VIRTUAL}|#{BRIDGES}|#{BONDS}/
|
||
|
||
def self.parser_for(type)
|
test/unit/fact_parser_test.rb | ||
---|---|---|
@parser = get_parser
|
||
end
|
||
|
||
test "bond regexp matches only bonds" do
|
||
assert_match FactParser::BONDS, 'bond0'
|
||
assert_match FactParser::BONDS, 'lagg0'
|
||
refute_match FactParser::BONDS, 'bond0.0'
|
||
refute_match FactParser::BONDS, 'bond0:0'
|
||
end
|
||
|
||
test "default parsers" do
|
||
assert_includes FactParser.parsers.keys, 'puppet'
|
||
assert_equal PuppetFactParser, FactParser.parser_for(:puppet)
|
Also available in: Unified diff
Fixes #10805 - match vlans attached to bonds correctly