From: Ian Jackson Date: Mon, 9 Mar 2015 17:37:19 +0000 (+0000) Subject: convert-cabinet-layout: generalise setprop (nfc) X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=1de2ef58c7e55c1ee27a88d806ff9aa57eb13ff9;p=people%2Fiwj%2Fcolo-for-testing.git convert-cabinet-layout: generalise setprop (nfc) --- diff --git a/convert-cabinet-layout b/convert-cabinet-layout index 978cc40..0546e01 100755 --- a/convert-cabinet-layout +++ b/convert-cabinet-layout @@ -59,6 +59,12 @@ sub outfor ($$) { $outfor{$dest} .= $s; } +sub setprop ($$) { + my ($prop,$value) = @_; + outfor 'mg-hosts setprops $prop', + "./mg-hosts setprops $machine -- $prop '$value'\n"; +} + while (my $row = $csv->getline_hr($fh)) { print DEBUG Dumper($row); @@ -88,9 +94,7 @@ while (my $row = $csv->getline_hr($fh)) { my ($pdu,$port); if ($pdu1) { $pdu='pdu1'; $port=$pdu1; } if ($pdu2) { $pdu='pdu2'; $port=$pdu2; } - outfor 'mg-hosts setprops PowerMethod', - sprintf "./mg-hosts setprops %s -- PowerMethod 'msw --apc6 %s %d'\n", - $machine, $pdu, $port; + setprop 'PowerMethod', "msw --apc6 $pdu $port"; } }