You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/03/01 22:37:36 UTC

[1/2] incubator-trafficcontrol git commit: reject to delete cdn if server or ds associated

Repository: incubator-trafficcontrol
Updated Branches:
  refs/heads/master ad9754043 -> ff950d4ec


reject to delete cdn if server or ds associated


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/9c11c5e4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/9c11c5e4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/9c11c5e4

Branch: refs/heads/master
Commit: 9c11c5e4ebc8cea5a42d716adee871452dd4cfaf
Parents: ad97540
Author: Zhilin Huang <zh...@cisco.com>
Authored: Mon Feb 27 14:45:37 2017 +0800
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Wed Mar 1 15:36:14 2017 -0700

----------------------------------------------------------------------
 traffic_ops/app/lib/UI/Cdn.pm | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/9c11c5e4/traffic_ops/app/lib/UI/Cdn.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/UI/Cdn.pm b/traffic_ops/app/lib/UI/Cdn.pm
index d9f9d80..c27c9a7 100644
--- a/traffic_ops/app/lib/UI/Cdn.pm
+++ b/traffic_ops/app/lib/UI/Cdn.pm
@@ -160,6 +160,16 @@ sub delete {
         $self->flash( alertmsg => "You must be an ADMIN to perform this operation!" );
     }
     else {
+        my $server_count = $self->db->resultset('Server')->search( { cdn_id => $id } )->count();
+        if ($server_count > 0) {
+            $self->flash( alertmsg => "Failed to delete cdn id = $id has servers." );
+            return $self->redirect_to('/close_fancybox.html');
+        }
+        my $ds_count = $self->db->resultset('Deliveryservice')->search( { cdn_id => $id } )->count();
+        if ($ds_count > 0) {
+            $self->flash( alertmsg => "Failed to delete cdn id = $id has delivery services." );
+            return $self->redirect_to('/close_fancybox.html');
+        }
         my $p_name = $self->db->resultset('Cdn')->search( { id => $id } )->get_column('name')->single();
         my $delete = $self->db->resultset('Cdn')->search( { id => $id } );
         $delete->delete();


[2/2] incubator-trafficcontrol git commit: This closes #314

Posted by mi...@apache.org.
This closes #314


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/ff950d4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/ff950d4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/ff950d4e

Branch: refs/heads/master
Commit: ff950d4ec1f5eac1fb9d8d9c4d728e1f57d1d287
Parents: 9c11c5e
Author: Jeremy Mitchell <mi...@gmail.com>
Authored: Wed Mar 1 15:37:26 2017 -0700
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Wed Mar 1 15:37:26 2017 -0700

----------------------------------------------------------------------

----------------------------------------------------------------------