Adjust ngcp-ossbss-clients-perl scripts to use new cmd auth data

80% of https://bugtracker.sipwise.com/view.php?id=1835 done

From: Michael Prokop <mprokop@sipwise.com>
changes/49/3949/1
Michael Prokop 14 years ago committed by Kirill Solomko
parent e0b81419d1
commit fadbd2d9b0

@ -3,11 +3,26 @@ use strict;
use Getopt::Std;
use Sipwise::Provisioning::Billing;
use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $inputfile = '/etc/ngcp-config/constants.yml';
my $password;
my $user = 'cmd';
$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read";
unless (my ($user) = grep { $_->{user} eq $user && defined $_->{pass} } @{$yaml->[0]->{ossbss}->{provisioning}->{acl}}) {
die "Error: No password set for user cmd in $inputfile\n";
} else {
$password = $user->{pass};
}
my %CONFIG = (
admin => 'administrator',
password => 'administrator',
admin => 'cmd',
password => $password,
);
my %BILLING = (
billing_profile => 'default',
# not needed, but may be set if desired
@ -72,7 +87,7 @@ sub call_prov {
$result = $bprov->handle_request( $function,
{
authentication => {
type => 'admin',
type => 'system',
username => $CONFIG{admin},
password => $CONFIG{password},
},

@ -3,10 +3,24 @@ use strict;
use Getopt::Std;
use Sipwise::Provisioning::Billing;
use YAML::Tiny;
my $yaml = YAML::Tiny->new;
my $inputfile = '/etc/ngcp-config/constants.yml';
my $password;
my $user = 'cmd';
$yaml = YAML::Tiny->read($inputfile) or die "File $inputfile could not be read";
unless (my ($user) = grep { $_->{user} eq $user && defined $_->{pass} } @{$yaml->[0]->{ossbss}->{provisioning}->{acl}}) {
die "Error: No password set for user cmd in $inputfile\n";
} else {
$password = $user->{pass};
}
my %CONFIG = (
admin => 'administrator',
password => 'administrator',
admin => 'cmd',
password => $password,
);
sub main;
@ -54,7 +68,7 @@ sub call_prov {
$result = $bprov->handle_request( $function,
{
authentication => {
type => 'admin',
type => 'system',
username => $CONFIG{admin},
password => $CONFIG{password},
},

Loading…
Cancel
Save