Repository: incubator-trafficcontrol Updated Branches: refs/heads/master 02f926719 -> f23f2c3ed
Clear tenants - to operate well when the root tenant does not exists Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/520c841d Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/520c841d Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/520c841d Branch: refs/heads/master Commit: 520c841d0d7f0237fbc0e96f32c0e1dae8c10dac Parents: 02f9267 Author: nir-sopher <n...@qwilt.com> Authored: Fri Aug 4 01:07:22 2017 +0300 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Fri Aug 4 09:08:21 2017 -0600 ---------------------------------------------------------------------- traffic_ops/app/lib/Test/IntegrationTestHelper.pm | 2 +- traffic_ops/app/lib/Test/TestHelper.pm | 2 +- traffic_ops/app/lib/Utils/Tenant.pm | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/520c841d/traffic_ops/app/lib/Test/IntegrationTestHelper.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/Test/IntegrationTestHelper.pm b/traffic_ops/app/lib/Test/IntegrationTestHelper.pm index fb47009..c66d62e 100644 --- a/traffic_ops/app/lib/Test/IntegrationTestHelper.pm +++ b/traffic_ops/app/lib/Test/IntegrationTestHelper.pm @@ -107,7 +107,7 @@ sub teardown { if ($table_name eq 'Tenant') { my $tenant_utils = Utils::Tenant->new(undef, 10**9, $schema); my $tenants_data = $tenant_utils->create_tenants_data_from_db(); - $tenant_utils->cascade_delete_tenants_tree($tenants_data, 10**9); + $tenant_utils->cascade_delete_tenants_tree($tenants_data); } else { $schema->resultset($table_name)->delete_all; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/520c841d/traffic_ops/app/lib/Test/TestHelper.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/Test/TestHelper.pm b/traffic_ops/app/lib/Test/TestHelper.pm index 65b31d0..d5ce836 100644 --- a/traffic_ops/app/lib/Test/TestHelper.pm +++ b/traffic_ops/app/lib/Test/TestHelper.pm @@ -183,7 +183,7 @@ sub teardown { if ($table_name eq 'Tenant') { my $tenant_utils = Utils::Tenant->new(undef, 10**9, $schema); my $tenants_data = $tenant_utils->create_tenants_data_from_db(); - $tenant_utils->cascade_delete_tenants_tree($tenants_data, 10**9); + $tenant_utils->cascade_delete_tenants_tree($tenants_data); } else { $schema->resultset($table_name)->delete_all; http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/520c841d/traffic_ops/app/lib/Utils/Tenant.pm ---------------------------------------------------------------------- diff --git a/traffic_ops/app/lib/Utils/Tenant.pm b/traffic_ops/app/lib/Utils/Tenant.pm index 731fc0d..4ee9b12 100644 --- a/traffic_ops/app/lib/Utils/Tenant.pm +++ b/traffic_ops/app/lib/Utils/Tenant.pm @@ -166,7 +166,9 @@ sub get_hierarchic_tenants_list { #First - adding to the stack the root nodes under which we want to get the tenats my @stack = (); if ( defined($tree_root) ) { - push( @stack, $tree_root ); + if (exists($tenants_data->{tenants_dict}->{$tree_root})){ + push( @stack, $tree_root ); + } } else { # root is not set, putting all roots, using "reverse" as we push it into a stack