#---------- power cycling ----------
-sub power_cycle_host_setup ($) {
- my ($ho) = @_;
+sub power_cycle_parse_method ($$) {
+ my ($ho, $spec) = @_;
my $methobjs = [ ];
- foreach my $meth (split /\;\s*/, ($ho->{Power} // 'unsupported')) {
+ foreach my $meth (split /\;\s*/, $spec) {
if ($meth eq 'nest') {
push @$methobjs, $meth;
} elsif ($meth =~ m{^(\d+)(?:/(\d+))$}) {
push @$methobjs, get_host_method_object($ho,'PDU',$meth);
}
}
- $ho->{PowerMethobjs} = $methobjs;
+ return $methobjs;
+}
+
+sub power_cycle_host_setup ($) {
+ my ($ho) = @_;
+ $spec = ($ho->{Power} // 'unsupported');
+ $ho->{PowerMethobjs} = power_cycle_parse_method($ho,$spec);
}
sub power_cycle_sleep ($) {