diff --git a/xCAT-server/lib/perl/xCAT/BladeUtils.pm b/xCAT-server/lib/perl/xCAT/BladeUtils.pm index fd2fef6f2..66588b216 100644 --- a/xCAT-server/lib/perl/xCAT/BladeUtils.pm +++ b/xCAT-server/lib/perl/xCAT/BladeUtils.pm @@ -3,6 +3,8 @@ package xCAT::BladeUtils; use strict; use warnings; +use xCAT::StringUtils qw(trim); + sub blade_nodes_from_mp { my @entries = @_; my %hwtype; @@ -12,7 +14,7 @@ sub blade_nodes_from_mp { next unless ref $entry eq 'HASH' and defined $entry->{node}; $hwtype{ $entry->{node} } = defined $entry->{nodetype} ? lc( $entry->{nodetype} ) : q{}; - $hwtype{ $entry->{node} } =~ s/^\s+|\s+$//gx; + $hwtype{ $entry->{node} } = trim($hwtype{ $entry->{node} }); $ownmpa{ $entry->{node} } = $entry->{mpa} if defined $entry->{mpa}; } diff --git a/xCAT-server/lib/xcat/plugins/credentials.pm b/xCAT-server/lib/xcat/plugins/credentials.pm index 785dc843e..9a69047dd 100644 --- a/xCAT-server/lib/xcat/plugins/credentials.pm +++ b/xCAT-server/lib/xcat/plugins/credentials.pm @@ -38,6 +38,7 @@ use xCAT::Utils; use xCAT::NetworkUtils; use xCAT::PasswordUtils; use xCAT::TableUtils; +use xCAT::StringUtils qw(trim); use xCAT::MsgUtils; use Getopt::Long; @@ -410,7 +411,7 @@ sub _delegated_signer_allowed { sub _endpoint_identities { my $endpoint = shift; return unless defined($endpoint); - $endpoint =~ s/^\s+|\s+$//g; + $endpoint = trim($endpoint); return unless length($endpoint); my %identities;