adjust the way we evaluate the parameter.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/c879717a Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/c879717a Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/c879717a Branch: refs/heads/master Commit: c879717a8fb1cd613a485fd38080f4c8fc04460d Parents: dd1cdc0 Author: Derek Gelinas <mrdgeli...@gmail.com> Authored: Wed Mar 15 21:11:55 2017 +0000 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Thu Mar 16 15:08:24 2017 -0600 ---------------------------------------------------------------------- traffic_ops/app/lib/MojoPlugins/Job.pm | 2 +- traffic_ops/app/lib/UI/Server.pm | 68 +++++++---------------------- 2 files changed, 16 insertions(+), 54 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c879717a/traffic_ops/app/lib/MojoPlugins/Job.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/MojoPlugins/Job.pm b/traffic_ops/app/lib/MojoPlugins/Job.pm index f69e926..1ec0ed0 100755 --- a/traffic_ops/app/lib/MojoPlugins/Job.pm +++ b/traffic_ops/app/lib/MojoPlugins/Job.pm @@ -72,7 +72,7 @@ sub register { my $use_reval_pending = $self->db->resultset('Parameter')->search( { -and => [ 'name' => 'use_reval_pending', 'config_file' => 'global' ] } )->get_column('value')->single; - if ( defined($use_reval_pending) && $use_reval_pending == 1 ) { + if ( defined($use_reval_pending) && $use_reval_pending ne '0' ) { my $result = $update_server_bit_rs->update( { reval_pending => 1 } ); &log( $self, "Set reval_pending = 1 for all applicable caches", "OPER" ); } http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/c879717a/traffic_ops/app/lib/UI/Server.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/UI/Server.pm b/traffic_ops/app/lib/UI/Server.pm index de4bbeb..987c698 100644 --- a/traffic_ops/app/lib/UI/Server.pm +++ b/traffic_ops/app/lib/UI/Server.pm @@ -927,58 +927,19 @@ sub readupdate { } while ( my $row = $rs_servers->next ) { - if ( $parent_pending{ $row->host_name } && $parent_reval_pending{ $row->host_name } ) { - push( - @data, { - host_name => $row->host_name, - upd_pending => \$row->upd_pending, - reval_pending => \$row->reval_pending, - host_id => $row->id, - status => $row->status->name, - parent_pending => \1, - parent_reval_pending => \1 - } - ); - } - elsif ( $parent_reval_pending{ $row->host_name } ) { - push( - @data, { - host_name => $row->host_name, - upd_pending => \$row->upd_pending, - reval_pending => \$row->reval_pending, - host_id => $row->id, - status => $row->status->name, - parent_pending => \0, - parent_reval_pending => \1 - } - ); - } - elsif ( $parent_pending{ $row->host_name } ) { - push( - @data, { - host_name => $row->host_name, - upd_pending => \$row->upd_pending, - reval_pending => \$row->reval_pending, - host_id => $row->id, - status => $row->status->name, - parent_pending => \1, - parent_reval_pending => \0 - } - ); - } - else { - push( - @data, { - host_name => $row->host_name, - upd_pending => \$row->upd_pending, - reval_pending => \$row->reval_pending, - host_id => $row->id, - status => $row->status->name, - parent_pending => \0, - parent_reval_pending => \0 - } - ); - } + my $parent_pending_flag = $parent_pending{ $row->host_name } ? 1 : 0; + my $parent_reval_pending_flag = $parent_reval_pending{ $row->host_name } ? 1 : 0; + push( + @data, { + host_name => $row->host_name, + upd_pending => \$row->upd_pending, + reval_pending => \$row->reval_pending, + host_id => $row->id, + status => $row->status->name, + parent_pending => \$parent_pending_flag, + parent_reval_pending => \$parent_reval_pending_flag + } + ); } $self->render( json => \@data ); @@ -1021,7 +982,8 @@ sub postupdate { my $use_reval_pending = $self->db->resultset('Parameter')->search( { -and => [ 'name' => 'use_reval_pending', 'config_file' => 'global' ] } )->get_column('value')->single; - if ( defined($use_reval_pending) && $use_reval_pending == 1 ) { + #Parameters don't have boolean options at this time, so we're going to compare against the default string value of 0. + if ( defined($use_reval_pending) && $use_reval_pending ne '0' ) { $update_server->update( { upd_pending => $updated } ); $update_server->update( { reval_pending => $reval_updated } ); }