# $Id: //depot/prod/test/nacldev/lib/NACL/CS/_Mixins/SystemNodeServiceProcessor.pm#1 $ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary Mix-in for common functionality for SystemNodeServiceProcessor ## @author anupamap@netapp.com,dl-nacl-dev@netapp.com ## @status shared ## @pod here package NACL::CS::_Mixins::SystemNodeServiceProcessor; use strict; use warnings; use NACL::Exceptions::InvalidChoice; use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); BEGIN { use Exporter qw(import); our @EXPORT_OK = qw(_fetch_zapi_check ); our %EXPORT_TAGS = ( 'all' => \@EXPORT_OK ); } sub _fetch_zapi_check { $Log->enter() if $may_enter; my ( $pkg_or_obj, %opts ) = @_; my %copy_filter = %{ $opts{filter} }; my $reason = undef; if ( !defined( $opts{filter}->{node} ) ) { $reason .= "\n ZAPI needs name of the node to fetch the service processor information" . ', but node is not specified in the filter'; } my $deleted_filter = $pkg_or_obj->_remove_relational_regex_filters( filter => \%copy_filter ); if ( %$deleted_filter) { $reason .= "\nIt doesn't support special characters in the filter"; } if ($reason) { $Log->exit() if $may_exit; NACL::Exceptions::InvalidChoice->throw( 'Could not use ZAPI because ' . $reason ); } $Log->exit() if $may_exit; } 1;