[opensuse-autoinstall] <match_type>regex</match_type> -- regex support?
I'm wondering *which* regex system is used here and what the constraints on its use are. Google: [ autoyast "<match_type>regex</match_type>" ] And there's precious few examples to work from. The only official example shows: <rule> <board_vendor> <match>ntel</match> <match_type>regex</match_type> </board_vendor> <result> <profile>classes/largeswap.xml</profile> <continue config:type="boolean">true</continue> <dont_merge config:type="list"> <element>partition</element> </dont_merge> </result> </rule> and the value in the <match> element doesn't even have any regex pattern, wildcard, classes, etc.
From this example, all i can infer is that a <match> element value is used as a non-anchored match string. ("match anywhere")
I have seen another example showing the use of the "^" begin-of-line anchor symbol e.g. "<match>^SUSE Linux Enterprise Server</match>". But what is the full-extent of what i can use here? for my needs right now, i'd like to use <product>PowerEdge [12]850</product> to match the Dell PE 1850 and PE 2850 systems. Will this work? (i imagine i may have to escape some patterns to fit XML specification, which i'm not very familiar with, but that's just a detail) thanks, --stephen -- Stephen Dowdy - Systems Administrator - NCAR/RAL 303.497.2869 - sdowdy@ucar.edu - http://www.ral.ucar.edu/~sdowdy/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
Stephen Dowdy wrote, On 01/21/2010 12:13 PM:
for my needs right now, i'd like to use
<product>PowerEdge [12]850</product> sorry, obviously, i mean:
<product> <match>PowerEdge [12]850</match> ... --stephen -- Stephen Dowdy - Systems Administrator - NCAR/RAL 303.497.2869 - sdowdy@ucar.edu - http://www.ral.ucar.edu/~sdowdy/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
on Thursday 21 January 2010 Stephen Dowdy wrote:
and the value in the <match> element doesn't even have any regex pattern, wildcard, classes, etc.
From this example, all i can infer is that a <match> element value is used as a non-anchored match string. ("match anywhere")
I have seen another example showing the use of the "^" begin-of-line anchor symbol
e.g. "<match>^SUSE Linux Enterprise Server</match>".
But what is the full-extent of what i can use here?
it's a simple bash "=~" if [[ "uwe gansert" =~ u.e\ g[abc]ns ]]; then echo jo; fi but while looking at the code a few minutes ago, I noticed a bug in it :( Currently only substring matching seems to work properly which is what I used for testing the code when I implemented it :-/ I have to test that but by looking at the code, it looks like a bug -- ciao, Uwe Gansert Uwe Gansert SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Business: http://www.suse.de/~ug -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
Uwe Gansert wrote, On 01/22/2010 01:31 AM:
on Thursday 21 January 2010 Stephen Dowdy wrote: ...
From this example, all i can infer is that a <match> element value is used as a non-anchored match string. ("match anywhere") ... But what is the full-extent of what i can use here?
it's a simple bash "=~" if [[ "uwe gansert" =~ u.e\ g[abc]ns ]]; then echo jo; fi
Ah, okay, great, that helps a lot. Indeed [..] character set matching works for "<product>\n<match>PowerEdge [12]850</match>" in my rules.xml file for this particular set of machines. I hope i'm not being pushy, but if you could update the AutoYast docs to reflect just what you said above, it'd be very helpful. (and possibly use a slightly more complex example than the "<match>ntel</match>" one you have.) ------------ 6.1.3. Match Types for rules .. regex can be used to match substrings like "ntel" will match "Intel","intel" and "intelligent". ------------
but while looking at the code a few minutes ago, I noticed a bug in it :( Currently only substring matching seems to work properly which is what I used for testing the code when I implemented it :-/ I have to test that but by looking at the code, it looks like a bug
Well, My Dell 8th Gen Profile got pulled in by this rule just now: <!-- Different Network Configuration for PE1850/PE2850s --> <rule> <product> <match>PowerEdge [12]850</match> <match_type>regex</match_type> </product> <result> <profile>ZORK-Dell8G.xml</profile> <continue config:type="boolean">true</continue> </result> </rule> so, character set matching is working, but i didn't anchor the match string at either end, if that's what you're saying doesn't work. But, consider *MY* issue solved here. thanks, --stephen -- Stephen Dowdy - Systems Administrator - NCAR/RAL 303.497.2869 - sdowdy@ucar.edu - http://www.ral.ucar.edu/~sdowdy/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
Ah, okay, great, that helps a lot. Indeed [..] character set matching works for "<product>\n<match>PowerEdge [12]850</match>" in my rules.xml file for this particular set of machines.
Just to confirm (now that i'm digging through my y2logs (y2debug=1)... [YCP] AutoInstallRules.ycp:375 shell: ( [[ "$product" =~ "PowerEdge [12]850" ]] ) ... [liby2] SymbolEntry.cc(setValue):107 SymbolEntry::setValue (ismatch@0x1951030 = 'true') ... [liby2] SymbolEntry.cc(setValue):107 SymbolEntry::setValue (ruledef@0x1953500 = '$["continue":true, "profile":"ZORK-Dell8G.xml"]')
<!-- Different Network Configuration for PE1850/PE2850s --> <rule> <product> <match>PowerEdge [12]850</match> <match_type>regex</match_type> </product> <result> <profile>ZORK-Dell8G.xml</profile> <continue config:type="boolean">true</continue> </result> </rule>
--stephen -- Stephen Dowdy - Systems Administrator - NCAR/RAL 303.497.2869 - sdowdy@ucar.edu - http://www.ral.ucar.edu/~sdowdy/ -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
on Saturday 23 January 2010 Stephen Dowdy wrote:
But what is the full-extent of what i can use here?
it's a simple bash "=~" if [[ "uwe gansert" =~ u.e\ g[abc]ns ]]; then echo jo; fi
Ah, okay, great, that helps a lot. Indeed [..] character set matching works for "<product>\n<match>PowerEdge [12]850</match>" in my rules.xml file for this particular set of machines.
really? That's unexpected because the quoting of the right side of the expression is actually wrong in the code. It really works for you? Which SUSE Linux version?
I hope i'm not being pushy, but if you could update the AutoYast docs to reflect just what you said above, it'd be very helpful. (and possibly use a slightly more complex example than the "<match>ntel</match>" one you have.)
okay, done. Thanks for reporting that bug :) -- ciao, Uwe Gansert Uwe Gansert SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) Business: http://www.suse.de/~ug -- To unsubscribe, e-mail: opensuse-autoinstall+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-autoinstall+help@opensuse.org
participants (2)
-
Stephen Dowdy
-
Uwe Gansert