add isMemberofGroup routine

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@7961 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2010-10-28 19:08:56 +00:00
parent 82795eb88f
commit 64890f419d

View File

@ -705,7 +705,7 @@ sub list_all_node_groups
#-----------------------------------------------------------------------
=head3
list_nodes_in_nodegroup
list_nodes_in_nodegroups
Arguments: nodegroup
@ -717,7 +717,7 @@ sub list_all_node_groups
Error:
undef
Example:
@nodes=xCAT::Utils->list_nodes_in_nodegroup($group);
@nodes=xCAT::Utils->list_nodes_in_nodegroups($group);
Comments:
none
@ -735,6 +735,42 @@ sub list_nodes_in_nodegroups
#-----------------------------------------------------------------------
=head3
isMemberofGroup
Arguments: node,group
Returns:
1 = is a member
0 = not a member
Globals:
none
Error:
undef
Example:
$ismember=xCAT::Utils->isMemberofGroup($node,$group);
Comments:
none
=cut
#------------------------------------------------------------------------
sub isMemberofGroup
{
my ($class, $node,$group ) = @_;
my $ismember;
my @nodes=xCAT::Utils->list_nodes_in_nodegroups($group);
if (grep(/$node/, @nodes)) {
$ismember =1;
} else {
$ismember =0;
}
return $ismember;
}
#-----------------------------------------------------------------------
=head3
get_site_attribute