Create FQDN verify while createing a unmanaged node

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@14359 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
leiaibj 2012-11-19 09:03:03 +00:00
parent 5ed353a3ae
commit b61ff28739
2 changed files with 21 additions and 1 deletions

View File

@ -2211,6 +2211,26 @@ sub isValidHostname
return 0;
}
#-------------------------------------------------------------------------------
=head3 isValidFQDN
Description : Validate whether specified string is a valid FQDN.
Arguments : hostname - the string to be validated.
Returns : 1 - valid hostname FQDN.
0 - invalid hostname FQDN.
=cut
#-------------------------------------------------------------------------------
sub isValidFQDN
{
my ($class, $hostname) = @_;
if ($hostname =~ /^[\-\.a-zA-Z0-9]+$/){
return 1;
}
return 0;
}
#-------------------------------------------------------------------------------
=head3 ip_to_int

View File

@ -603,7 +603,7 @@ Usage:
setrsp_errormsg("Specified hostname $args_dict{'hostname'} conflicts with records in database");
return;
}
if (! xCAT::NetworkUtils->isValidHostname($args_dict{'hostname'})){
if (! xCAT::NetworkUtils->isValidFQDN($args_dict{'hostname'})){
setrsp_errormsg("Specified hostname: $args_dict{'hostname'} is invalid");
return;
}