Skip to content

Commit e662ab9

Browse files
committed
trim trailing whitespaces in lxc-ls output (issue #378)
1 parent 902aa75 commit e662ab9

File tree

1 file changed

+3
-2
lines changed
  • lib/FusionInventory/Agent/Task/Inventory/Virtualization

1 file changed

+3
-2
lines changed

lib/FusionInventory/Agent/Task/Inventory/Virtualization/Lxc.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ sub _getVirtualMachines {
103103
my @machines;
104104

105105
while(my $name = <$handle>) {
106-
# lxc-ls -1 shows one entry by line, just skip line if empty as name can contain space
106+
# lxc-ls -1 shows one entry by line
107107
chomp $name;
108-
next unless length($name);
108+
$name =~ s/\s+$//; # trim trailing whitespace
109+
next unless length($name); # skip if empty as name can contain space
109110

110111
my $status = _getVirtualMachineState(
111112
command => "/usr/bin/lxc-info -n '$name'",

0 commit comments

Comments
 (0)