@@ -82,9 +82,13 @@ sub scan_targets {
8282 # [licensekey all|<key>]
8383
8484 # Scan controllers
85- my (%targets );
85+ my (%targets , $target );
8686 my $fh = $this -> cmd(' controller status' );
8787 while (<$fh >) {
88+ chomp ;
89+ # skip empty lines and artificial comments (added by this project)
90+ next if / ^$ / or /^# /;
91+
8892 # Numeric slot
8993 if (my ($controller , $slot , $modes ) = /
9094 ^(\S.+)\sin \sSlot
@@ -94,8 +98,9 @@ sub scan_targets {
9498 )?$
9599 / x) {
96100
97- $targets {"slot=$slot "} = {
98- target => "slot=$slot ",
101+ $target = "slot=$slot ";
102+ $targets {$target } = {
103+ target => $target ,
99104 controller => $controller ,
100105 slot => $slot ,
101106 modes => split_controller_modes($modes || ''),
@@ -105,13 +110,21 @@ sub scan_targets {
105110 }
106111 # Named Entry
107112 if (my ($controller , $cn ) = /^(\S.+) in (.+)/) {
108- $targets {" chassisname=$cn " } = {
109- target => " chassisname=$cn " ,
113+ $target = " chassisname=$cn " ;
114+ $targets {$target } = {
115+ target => $target ,
110116 controller => $controller ,
111117 chassisname => $cn ,
112118 };
113119 next ;
114120 }
121+
122+ # Other statuses, try "key: value" pairs
123+ if (my ($key , $value ) = /^\s *(.+?):\s +(.+?)$/ ) {
124+ $targets {$target }{$key } = $value ;
125+ } else {
126+ warn " Unparsed: [$_ ]\n " ;
127+ }
115128 }
116129 close $fh ;
117130
0 commit comments