Generating DNSSEC keys for a brand new CDN thru the API creates DNSSEC keys for potentially the wrong delivery services and then results in a 500 internal server error #1219
Labels
bug
something isn't working as intended
high impact
impacts the basic function, deployment, or operation of a CDN
Milestone
The following API results in a 500 ISE when you try to generate DNSSEC keys for a brand-spanking new CDN:
$r->post("/api/$version/cdns/dnsseckeys/generate
Here is the error:
[2017-09-21 15:50:00,413] [ERROR] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st execute failed: ERROR: null value in column "profile" violates not-null constraint
DETAIL: Failing row contains (null, 3399, 2017-09-21 15:50:00.391382-06). [for Statement "INSERT INTO profile_parameter ( parameter, profile) VALUES ( ?, ? ) RETURNING profile" with ParamValues: 1='3399', 2=undef] at /code/src/github.com/apache/incubator-trafficcontrol/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm line 165
This is because on this line:
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm#L91
If $profile_id is undef (which it will be because I have setup no traffic router servers for this CDN yet and therefore there is no profile to fetch), it will cause the following problems:
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm#L95
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm#L165
TLDR;
There is a problem when profile can't be found on this line:
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm#L91
https://github.com/apache/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DnssecKeys.pm#L94
Each DS has a CDN so why not figure out the DS's like this
my @ds_rs = $self->db->resultset('Deliveryservice')->search( { cdn_id => cdn.id } , { prefetch => [ { 'cdn' => undef }]});
The text was updated successfully, but these errors were encountered: