[%
  # Returns the ngcp_type of the node calling this function.
  #
  # @return out		one of ['spce', 'sppro', 'carrier']
-%]
[% PERL -%]
use Dpkg;
use Dpkg::Index;
use Dpkg::Control::Types;

my $status = Dpkg::Index->new(type => CTRL_INFO_PKG);
$status->load("$Dpkg::ADMINDIR/status");

my $pkg = $status->get_by_key('ngcp-ngcp-ce');
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
	$stash->set(out => 'spce');
	return;
}
$pkg = $status->get_by_key('ngcp-ngcp-pro');
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
	$stash->set(out => 'sppro');
	return;
}
$pkg = $status->get_by_key('ngcp-ngcp-carrier');
if ($pkg->{Status} =~ m/\s+ok\s+installed$/) {
	$stash->set(out => 'carrier');
	return;
}
[% END -%]
