From c1a25ac668a17ba0d357af0aa01b613d5b8b040b Mon Sep 17 00:00:00 2001 From: jbjohnso Date: Wed, 3 Apr 2013 20:34:15 +0000 Subject: [PATCH] Support per-node product keys, defaulting to 'os key' if nothing specified git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@15817 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/perl/xCAT/Template.pm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 268640ff6..350fe2e6c 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -471,7 +471,18 @@ sub get_win_prodkey { my $keytab = xCAT::Table->new("prodkey",-create=>0); my $keyent; if ($keytab) { - $keyent = $keytab->getAttribs({product=>$osvariant},"key"); + my @keyents = $keytab->getNodeAttribs($node,[qw/product key/]); + foreach my $tkey (@keyents) { + if ($tkey->{product} eq $osvariant) { + $keyent = $tkey; + last; + } elsif (not $tkey->{product}) { + $keyent = $tkey; + } + } + unless ($keyent) { + $keyent = $keytab->getAttribs({product=>$osvariant},"key"); + } } if ($keyent) { return "OnError".$keyent->{key}."";