mirror of https://github.com/sipwise/ngcpcfg.git
Stop inferring from the metapackage presence and instead use the variable general.ngcp_type from the constants.yml file which should now always be present. Change-Id: I68e97f6894094fe6a1589fa73b048b061eae4a7bchanges/34/13834/4
parent
e597d2b342
commit
efcf7e0eea
@ -1,29 +1,9 @@
|
||||
[%
|
||||
# Returns the ngcp_type of the node calling this function.
|
||||
#
|
||||
# This function is obsolete and for backwards compatibility only, as it
|
||||
# can be replaced by directly getting the general.ngcp_type variable.
|
||||
#
|
||||
# @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 -%]
|
||||
[% out = general.ngcp_type -%]
|
||||
|
||||
Loading…
Reference in new issue