[GitHub] incubator-trafficcontrol pull request #247: [TC-124] - adds POST api/cdns/:i...

2017-02-01 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/247

[TC-124] - adds POST api/cdns/:id/queue_update route and tries to stay 
consisten…

…t with the implementation of the other queue_update routes (server and 
cachegroup)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-124

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/247.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #247


commit af84a8a1fc713af18cd3bdd75d166b54d08b5f2d
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-02T04:47:55Z

adds POST api/cdns/:id/queue_update route and tries to stay consistent with 
the implementation of the other queue_update routes (server and cachegroup)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #259: [TC-139] - adds necessary prefet...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/259

[TC-139] - adds necessary prefetching to /api/servers so no n+1 queries



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-139

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/259.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #259


commit bfe1da84bb44e334a75239f40d85374cc6c369a8
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-07T02:33:23Z

adds necessary prefetching so no n+1 queries




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #260: [TC-64] - To exp ui - adds stati...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/260

[TC-64] - To exp ui - adds static dns entries and changes cta buttons



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol to-exp-ui

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/260.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #260


commit d5973d6dcbdd530985598f96a57041d32ad0d3a6
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-31T17:25:16Z

fixes form buttons

commit d44cee0d8c650bcde8a0379755514d908b282496
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-01T04:06:04Z

adds static dns entries for each type

commit f29d1030cfdadc853fd2901fc874beba3f71acf9
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-01T04:47:22Z

adds static dns entries for cachegroups and deliveryservices

commit d7a6de738cacfe81613f6af175131e42879cbcfe
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-03T04:10:17Z

moves buttons around basically




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #257: [TC-137] - adds dbix prefetch fo...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/257

[TC-137] - adds dbix prefetch for api/version/cachegroupparameters



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-137

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/257.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #257


commit c44f6a061bb9373a47136b8b54fdb871dc4771a3
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-06T22:25:23Z

adds prefetch




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #243: [TC-125] Lowercase FQDNs generat...

2017-02-02 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/243#discussion_r99145205
  
--- Diff: traffic_ops/app/lib/UI/DeliveryService.pm ---
@@ -78,7 +78,8 @@ sub get_cdn_domain {
distinct => 1
}
)->get_column('value')->single();
-   return $cdn_domain;
+   # Always return a lowercase FQDN.
+   return lc($cdn_domain);
--- End diff --

does it make sense to lowercase the response from these methods too?


https://github.com/elsloo/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DeliveryService.pm#L213


https://github.com/elsloo/incubator-trafficcontrol/blob/master/traffic_ops/app/lib/MojoPlugins/DeliveryService.pm#L230


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #253: [TC-134] - gets rid of sequentia...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/253

[TC-134] - gets rid of sequential queries caused by running a query inside 
a loo…

…p. uses dbix prefetch instead to join 2 tables and retrieve the 
necessary information (xml_id).

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-134

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/253.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #253


commit 4873be92ea68361967921969da95755945c5f098
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-06T19:39:33Z

gets rid of sequential queries caused by running a query inside a loop. 
uses prefetch instead to join 2 tables and retrieve the necessary information.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #252: [TC-133] - uses dbix prefetch to...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/252

[TC-133] - uses dbix prefetch to eliminate n+1 queries and removes example 
urls …

…intended for a single deliveryservice

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-133

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/252.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #252


commit 29d589297f236715612ad774302f7cbbb12fd01b
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-06T17:37:25Z

uses dbix prefetch to eliminate n+1 queries and removes example urls 
intented for a single deliveryservice




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #254: [TC-135] - joins ds_server on ds...

2017-02-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/254

[TC-135] - joins ds_server on ds table to avoid n+1 queries and improve 
route pe…

…rformance 10x at least

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-135

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/254.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #254


commit 85bbf7baa339b5dd996f60d63e5709e3812f7629
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-06T21:30:18Z

joins ds_server on ds table to avoid n+1 queries and improve route 
performance 10x at least




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #263: [TC-141] - adds more prefetches ...

2017-02-07 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/263

[TC-141] - adds more prefetches to api endpoints



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-141

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/263.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #263


commit e8fa60f70cc5808cbf8ceaf23ba42e6019210086
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-08T03:10:56Z

adds more prefetches to api endpoints




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #244: [TC-126] - adds seed data lost w...

2017-02-01 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/244

[TC-126] - adds seed data lost when migration files were removed



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-126

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/244.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #244


commit a5c619e0ae5ce7b54fb4248bc9783f4548abc059
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-01T19:29:24Z

adds seed data lost when migration files were removed




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #240: [TC-99] api/{version}/cdns/:cdn_...

2017-01-31 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/240#discussion_r98784396
  
--- Diff: traffic_ops/app/lib/MojoPlugins/Health.pm ---
@@ -159,6 +159,9 @@ sub register {
cachegroups  => [],
};
 
+   $self->app->log->debug("get_cache_health() - " . 
--- End diff --

can you remove this? we don't typically leave debug statements in the code. 
thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #141: Old - do not merge, will delete

2017-01-23 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/141
  
@dg4prez - you want to just close this since you have opened this?

https://github.com/apache/incubator-trafficcontrol/pull/199


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #200: [TC-68] - to support an HA TO, regex_re...

2017-01-23 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/200
  
@dewrich or @dangogh - can either of you review / merge? this needs to get 
into 2.0 so the path to HA TO is clear. thanks!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #208: Fix TC-110 - parameterize ip_all...

2017-01-23 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/208#discussion_r97332624
  
--- Diff: traffic_ops/app/lib/UI/ConfigFiles.pm ---
@@ -533,9 +550,8 @@ sub ip_allow_data {
}
 
# compact, coalesce and compact combined list again
-   # if more than 5 servers are in a /24, list that /24 - TODO 
JvD: parameterize
my @compacted_list = NetAddr::IP::Compact(@allowed_netaddrips);
-   my $coalesced_list = NetAddr::IP::Coalesce( 24, 5, 
@allowed_netaddrips );
+   my $coalesced_list = NetAddr::IP::Coalesce( 
$coalesce_masklen_v4 , $coalesce_masklen_v4, @allowed_netaddrips );
--- End diff --

I think you meant

my $coalesced_list = NetAddr::IP::Coalesce( $coalesce_masklen_v4 , 
$coalesce_number_v4, @allowed_netaddrips );


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #214: [TC-94] - adds deliveryservice_r...

2017-01-23 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/214

[TC-94] - adds deliveryservice_regex crud capabilities



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
regex-crud

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/214.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #214


commit 6f01ad0235fdb1ef8e937736bb071ae7b004055a
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-13T17:53:10Z

adds deliveryservice_regex crud




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #216: adds license details for experim...

2017-01-24 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/216

adds license details for experimental TO ui theme and loading bar use…

…d in traffic portal and experimental TO UI

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol license

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/216.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #216


commit 7a3fc26b5fd2d58547ef19ad5bfb9ba8776b9b2c
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-24T18:15:41Z

adds license details for experimental TO ui theme and loading bar used in 
traffic portal and experimental TO UI




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #219: removes self-signed certs provid...

2017-01-24 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/219

removes self-signed certs provided for convenience from TO UI experim…

…ental

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
remove-certs-from-exp-ui

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/219.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #219


commit e45195eb8a4d182817756a094723bdeaf51467b6
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-24T20:31:57Z

removes self-signed certs provided for convenience from TO UI experimental




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #217: updates main TC license file

2017-01-24 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/217

updates main TC license file



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
license-overview

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/217.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #217


commit af88b6738379b392023b935b49042b24753c3b97
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-24T18:52:52Z

updates main TC license file




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #239: [TC-64] - hooks up experimental ...

2017-01-30 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/239

[TC-64] - hooks up experimental TO UI to ds regex crud api



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
ui-exp-regex-crud

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/239.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #239


commit 5881037cf927276c42542eca8fec8fc0883bf707
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-25T15:30:33Z

hooks up exp TO UI to ds regex crud api




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #230: Allowing variables in traffic-server's ...

2017-01-25 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/230
  
@nir-sopher - if you rename this PR "[TC-121] Allowing variables in 
traffic-server's profile derived parameters" I think it will link it to the 
jira issue...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #231: [TC-103] - casts 0|1 to bools in...

2017-01-25 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/231

[TC-103] - casts 0|1 to bools in GET /update/:host_name route



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-103

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/231.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #231


commit 3bed680e6b08ba8ce57843a062d5f574bfab7f77
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-25T17:11:01Z

casts 0|1 to bools (tc-103)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #295: [TC-158] daemonize() leaves parent proc...

2017-02-20 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/295
  
@elsloo or @dneuman64 - maybe one of you guys feel qualified to review / 
test this PR. I, unfortunately, do not.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #278: New Overview Page

2017-02-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/278#discussion_r101674626
  
--- Diff: docs/source/overview/introduction.rst ---
@@ -15,14 +15,34 @@
 
 Introduction
 
-Traffic Control is a control plane for a CDN, which includes all of the 
components mentioned in the CDN Basics section, except for the Log File 
Analysis System. The caching software chosen for Traffic Control is `Apache 
Traffic Server <http://trafficserver.apache.org/>`_ (ATS). Although the current 
release only supports ATS as a cache, this may change with future releases. 
+Traffic Control is a caching server control plane application which is 
used to aggregate caching servers into a Content Delivery Network (CDN). The 
CDN caching software chosen for Traffic Control is `Apache Traffic Server 
<http://trafficserver.apache.org/>`_ (ATS). Although the current release only 
supports ATS as a cache, this may change with future releases. 
 
 Traffic Control was first developed at Comcast for internal use and 
released to Open Source in April of 2015. Traffic Control moved into the Apache 
Incubator in August of 2016.
 
-Traffic Control implements the blue boxes in the architecture diagram 
below. 
+Traffic Control implements the elements illustrated in green in the 
diagram  below. 
 
 
-.. image:: traffic_control_overview_3.png
+.. image:: CDN-Traffic-Control.png
:align: center
 
+
+**Traffic Ops**
+  * `Traffic Ops 
<http://trafficcontrol.apache.org/docs/latest/overview/traffic_ops.html/>`_ is 
used to configure caching  servers and CDN delivery services. It also contains 
APIs used to access CDN data.
+
+**Traffic Router**
+  * `Traffic Router 
<http://trafficcontrol.apache.org/docs/latest/overview/traffic_ops.html/>`_ is 
used to route clients requests to the closest healthy cache by analyzing the 
health, capacity, and state of the caching servers and relative distance from 
each cache group to the location of the client.
--- End diff --

i can merge this PR but it looks like this copy/paste error is still there


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #307: [tc-164] - $self needs to be pas...

2017-02-24 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/307

[tc-164] - $self needs to be passed to these methods for dbix



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-164

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/307.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #307


commit f1a912f1ae4296eabf8b966fb852b2f76f91979e
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-24T18:24:27Z

$self needs to be passed to these methods for dbix




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #309: [TC-164-Backport] - $self needs ...

2017-02-24 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/309

[TC-164-Backport] - $self needs to be passed to these methods for dbix

(cherry picked from commit f1a912f1ae4296eabf8b966fb852b2f76f91979e)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 2.0.x

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/309.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #309


commit c120b80f84c269da70c723544d427a6038660399
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-24T18:24:27Z

$self needs to be passed to these methods for dbix

(cherry picked from commit f1a912f1ae4296eabf8b966fb852b2f76f91979e)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #284: [TC-147] - $self was being used ...

2017-02-14 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/284

[TC-147] - $self was being used incorrectly limiting reuse of 
create_dnssec_keys() method



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-147

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/284.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #284


commit fc317e12fb961395bc3b0fafeb60aec9745fb380
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-14T16:39:35Z

updates version

commit 09643f5cf7398272e1eacd006b75282cbd4aefd8
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-14T17:11:15Z

Merge branch 'master' of github.com:apache/incubator-trafficcontrol

commit 105f26df262a9ce2a969e2ddfd59f39c0444de1f
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-14T18:55:56Z

no need to call $self on methods defined locally




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #278: New Overview Page

2017-02-13 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/278#discussion_r100897910
  
--- Diff: docs/source/overview/introduction.rst ---
@@ -15,14 +15,34 @@
 
 Introduction
 
-Traffic Control is a control plane for a CDN, which includes all of the 
components mentioned in the CDN Basics section, except for the Log File 
Analysis System. The caching software chosen for Traffic Control is `Apache 
Traffic Server <http://trafficserver.apache.org/>`_ (ATS). Although the current 
release only supports ATS as a cache, this may change with future releases. 
+Traffic Control is a caching server control plane application which is 
used to aggregate caching servers into a Content Delivery Network (CDN). The 
CDN caching software chosen for Traffic Control is `Apache Traffic Server 
<http://trafficserver.apache.org/>`_ (ATS). Although the current release only 
supports ATS as a cache, this may change with future releases. 
 
 Traffic Control was first developed at Comcast for internal use and 
released to Open Source in April of 2015. Traffic Control moved into the Apache 
Incubator in August of 2016.
 
-Traffic Control implements the blue boxes in the architecture diagram 
below. 
+Traffic Control implements the elements illustrated in green in the 
diagram  below. 
 
 
-.. image:: traffic_control_overview_3.png
+.. image:: CDN-Traffic-Control.png
:align: center
 
+
+**Traffic Ops**
+  * `Traffic Ops 
<http://trafficcontrol.apache.org/docs/latest/overview/traffic_ops.html/>`_ is 
used to configure caching  servers and CDN delivery services. It also contains 
APIs used to access CDN data.
+
+**Traffic Router**
+  * `Traffic Router 
<http://trafficcontrol.apache.org/docs/latest/overview/traffic_ops.html/>`_ is 
used to route clients requests to the closest healthy cache by analyzing the 
health, capacity, and state of the caching servers and relative distance from 
each cache group to the location of the client.
--- End diff --

copy / paste error on the link?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #280: [TC-146] - adds osversions.cfg t...

2017-02-13 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/280

[TC-146] - adds osversions.cfg to traffic ops RPM post install which is 
needed f…

…or /geniso route

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-146

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/280.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #280


commit bf8324899055f7c952323a00867d6ddb715ecf1e
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-13T22:13:10Z

adds osversions.cfg to traffic ops RPM post install which is needed for 
/geniso route




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #276: [TC-141] - need to clarify ambig...

2017-02-13 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/276

[TC-141] - need to clarify ambiguous id when adding query prefetches (joins)



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-141-2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/276.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #276


commit 6eea50b79b57beca1dc108d25d02e78454dac45f
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-13T17:14:42Z

need to clarify ambiguous id




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #277: [TC-144] - need to clarify ambig...

2017-02-13 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/277

[TC-144] - need to clarify ambiguous id when adding prefetches (joins)



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-144-2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/277.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #277


commit dc79931cf1c9464169484ee92ea37e4e3105694f
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-02-13T17:23:33Z

need to clarify ambiguous id




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #213: [TC-117] - creates a default del...

2017-01-23 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/213

[TC-117] - creates a default deliveryservice_regex when a new ds is created

at set_number=0 in the format .\*\.xml-id\..\*

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-117

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/213.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #213


commit c05a2b0a31deca0059342b99d922ccacf3c0fd15
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-23T18:36:53Z

creates a default deliveryservice_regex when a new ds is created




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #199: [TC-32] Addition of ATS Config A...

2017-01-23 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/199#discussion_r97381236
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1941 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+use constant {
+   HTTP=> 0,
+   HTTPS   => 1,
+   HTTP_AND_HTTPS  => 2,
+   HTTP_TO_HTTPS   => 3,
+   CONSISTENT_HASH => 0,
+   PRIMARY_BACKUP  => 1,
+   STRICT_ROUND_ROBIN  => 2,
+   IP_ROUND_ROBIN  => 3,
+   LATCH_ON_FAILOVER   => 4,
+   RRH_DONT_CACHE  => 0,
+   RRH_BACKGROUND_FETCH=> 1,
+   RRH_CACHE_RANGE_REQUEST => 2,
+};
+
+#Sub to generate config metadata
+sub get_config_metadata {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_server = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $server = $rs_server->next;
+   if ($server) {
+   my $cdn_name = $server->cdn->name;
+
+   $data_obj->{'profile'}->{'name'}   = $server->profile->name;
+   $data_obj->{'profile'}->{'id'} = $server->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_param = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $param = $rs_param->next ) {
+   if ( $param->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$param->config_file }->{'location'} = $param->value;
+   }
+   }
+   }
+
+   foreach my $config_file ( keys $data_obj->{'config_files'} ) {
+   if ( !defined( 
$data_obj->{'config_files'}->{$config_file}->{'scope'} ) ) {
+   $data_obj->{'config_files'}->{$config_file}->{'scope'} 
= $self->get_scope($config_file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##check the scope - is this the correct route?
+   if ( $scope ne 'server' ) {
+   return $self->alert( "Error - incorrect file scope for route 
used.  Please use the " . $scope . " route." );
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);

[GitHub] incubator-trafficcontrol pull request #181: [TC-96] - adds group_by to dbix ...

2017-01-17 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/181#discussion_r96448937
  
--- Diff: traffic_ops/app/lib/API/Cdn.pm ---
@@ -264,7 +264,8 @@ sub get_traffic_monitor_config {
{ 'cdn.name' => $cdn_name },
{   prefetch => ['cdn', 'profile', 'type'],
select   => 'me.profile',
-   distinct => 1
+   distinct => 1,
--- End diff --

talk to @elsloo :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #191: [TC-95] - ports some functionali...

2017-01-17 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/191

[TC-95] - ports some functionality over from ui namespace. specifically 
creatin…

…g location params (if don't exist) for header rewrites, regex_remap and 
cacheurl plus creates dsnseckey if cdn is dnssecenabled.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-95

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/191.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #191






---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #181: [TC-96] - adds group_by to dbix ...

2017-01-17 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/181#discussion_r96442726
  
--- Diff: traffic_ops/app/lib/API/Cdn.pm ---
@@ -264,7 +264,8 @@ sub get_traffic_monitor_config {
{ 'cdn.name' => $cdn_name },
{   prefetch => ['cdn', 'profile', 'type'],
select   => 'me.profile',
-   distinct => 1
+   distinct => 1,
--- End diff --

didn't add the distinct. i just added a comma :) i think


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #197: [TC-25] - removes ort routes tha...

2017-01-18 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/197

[TC-25] - removes ort routes that appear to have been broken...

...since 10/5/15

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-25

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/197.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #197


commit 2a0ad5baf17dd6917c715cba30edba0a583861e0
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-18T21:09:58Z

removes ort routes that appear to have been broken since 10/5/15




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #309: [TC-164-Backport] - $self needs to be p...

2017-02-28 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/309
  
@knutsel - yes, I agree jan...but...$self is not what it appears to be in 
this case as the parent method is being called from the UI namespace AND the 
API namespace.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #322: Adding tenancy to the database

2017-02-28 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/322#discussion_r103570488
  
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -0,0 +1,225 @@
+package API::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+use UI::Utils;
+
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+use JSON;
+use MojoPlugins::Response;
+
+my $finfo = __FILE__ . ":";
+
+sub getTenantName {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return defined($tenant_id) ? $self->db->resultset('Tenant')->search( { 
id => $tenant_id } )->get_column('name')->single() : "n/a";
+}
+
+sub isRootTenant {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return !defined($self->db->resultset('Tenant')->search( { id => 
$tenant_id } )->get_column('parent_id')->single());
+}
+
+sub index {
+   my $self= shift;
+
+   my @data;
+   my $orderby = $self->param('orderby') || "name";
+   my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by 
=> 'me.' . $orderby } );
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => $row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+
+sub show {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   my $rs_data = $self->db->resultset("Tenant")->search( { 'me.id' => $id 
});
+   my @data = ();
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => $row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+sub update {
+   my $self   = shift;
+   my $id = $self->param('id');
+   my $params = $self->req->json;
+
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   my $tenant = $self->db->resultset('Tenant')->find( { id => $id } );
+   if ( !defined($tenant) ) {
+   return $self->not_found();
+   }
+
+   if ( !defined($params) ) {
+   return $self->alert("Parameters must be in JSON format.");
+   }
+
+   if ( !defined( $params->{name} ) ) {
+   return $self->alert("Tenant name is required.");
+   }
+   
+   if ( $params->{name} ne $self->getTenantName($id) ) {
+   my $name = $params->{name};
+   my $existing = $self->db->resultset('Tenant')->search( { name 
=> $name } )->get_column('name')->single();
+   if ($existing) {
+   return $self->alert("A tenant with name \"$name\" 
already exists.");
+   }   
+   }   
+
+   if ( !defined( $params->{parentId}) && !$self->isRootTenant($id) ) {
+   return $self->alert("Parent Id is required.");
+   }
+   
+   my $is_active = $params->{active};
+   
+   if ( !$params->{active} && $self->isRootTenant($id)) {
+   return $self->alert("Root user cannot be in-active.");
+   }
+   
+
+   if ( !defined($params->{parentId}) && !isRootTenant($id) ) {
+   return $self->alert("Only the \"root\" tenant can have no 
parent.");
+   }
+   
+   my

[GitHub] incubator-trafficcontrol pull request #127: [TC-52] Integration Tests for Tr...

2016-12-08 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/127#discussion_r91540680
  
--- Diff: traffic_ops/app/lib/API/Deliveryservice.pm ---
@@ -295,7 +295,7 @@ sub update {
my @response;
push(
@response, {
-   "active"   => \$rs->active,
+   "active"   => $rs->active,
--- End diff --

@dangogh - do you have any idea why this would be occurring? why the 2 
different behaviors? in some cases we have to "cast" a boolean using \ to get 
true|false and in other instances the "cast" (or whatever it is called) returns 
values like `"active":"REF(0x7fae227c0e70)"`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #129: [EXP] adds placeholder functiona...

2016-12-07 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/129

[EXP] adds placeholder functionality for experimental TO UI



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
experimental-ui

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/129.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #129






---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #127: [TC-52] Integration Tests for Tr...

2016-12-07 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/127#discussion_r91391206
  
--- Diff: traffic_ops/app/lib/API/Deliveryservice.pm ---
@@ -295,7 +295,7 @@ sub update {
my @response;
push(
@response, {
-   "active"   => \$rs->active,
+   "active"   => $rs->active,
--- End diff --

by removing the \ the api will return 0|1 for bools instead of true|false. 
we want to pass true|false to and from the api. now, it seems that since the 
values are stored in postgres the \ would not be needed and true|false would 
flow thru but that does not appear to be the case.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #131: [TC-66] - Stores, diffs and fetches CRC...

2016-12-13 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/131
  
files were merged but asfgit didn't feel like closing this PR so I will do 
so manually.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #131: [TC-66] - Stores, diffs and fetc...

2016-12-13 Thread mitchell852
Github user mitchell852 closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/131


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #131: [TC-66] - Stores, diffs and fetc...

2016-12-12 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/131#discussion_r92041791
  
--- Diff: 
traffic_ops/app/db/migrations/2016120800_alter_cdn_name_not_null.sql ---
@@ -0,0 +1,23 @@
+/*
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 
implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+-- +goose Up
+-- SQL in section 'Up' is executed when this migration is applied
+ALTER TABLE CDN ALTER COLUMN NAME SET NOT NULL;
+
+-- +goose Down
+-- SQL section 'Down' is executed when this migration is rolled back
+ALTER TABLE CDN ALTER COLUMN NAME SET NULL;
--- End diff --

oh, are you specifically talking about the "goose down" part? yes, we can 
apply (via goose up) or rollback (via goose down) ddl changes and that's how 
most of our migration have always been.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #131: [TC-66] - Stores, diffs and fetc...

2016-12-09 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/131

[TC-66] - Stores, diffs and fetches CRConfig.json from the db instead of 
the file system

This is one step toward making TO HA capable (highly-available)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
crconfig-from-the-db

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/131.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #131


commit 9f49b4c08a9863fa5f32ba1d6c752bcc4562ffb5
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-08T19:51:17Z

removes dead routes

commit 2be8891959a533b79af0e3c9abe6c69be374aa36
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-09T16:09:20Z

makes cdn name not null

commit 6722368cb2f3c38b81753035242b9f97db8a0843
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-09T19:06:14Z

stores, diffs and fetches CRConfig.json from the db instead of the file 
system

commit 503823b562e76bfee9a15d3ad7a426ab7b371d8b
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-09T19:37:08Z

ensures only ops or admin role can snapshot crconfig




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #131: [TC-66] - Stores, diffs and fetc...

2016-12-09 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/131#discussion_r91789262
  
--- Diff: traffic_ops/app/lib/UI/Topology.pm ---
@@ -554,52 +554,30 @@ sub gen_crconfig_json {
 return ($data_obj);
 }
 
-sub read_crconfig_json {
--- End diff --

line 578 is basically all that is needed to "read" now - 
https://github.com/apache/incubator-trafficcontrol/pull/131/files#diff-42a47b5d7e269e8d875ab706652b0f70R578


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #183: fix any_map bug introduced in 1.8

2017-01-11 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/183
  
just want to make sure removing this code (&& $ds_type ne 'ANY_MAP') 
doesn't reintroduce a previous bug...


https://github.com/apache/incubator-trafficcontrol/commit/1cd8026c3f1198f81266e3fecfa7f80d7e6d7c60

^^ I'm guessing that was added to fix something but I can't tell what.






---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #175: updates repo url in traffic port...

2017-01-10 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/175

updates repo url in traffic portal build instructions



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/175.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #175


commit 57de470bf3f4212502712aa08a5b71fc49d3eadf
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-11T04:28:03Z

updates repo url




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #181: [TC-96] - adds group_by to dbix ...

2017-01-11 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/181

[TC-96] - adds group_by to dbix query to satisfy postgres



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-96

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/181.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #181


commit bb6d23644e5944a5572e781c739e811714edae46
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-11T23:22:54Z

adds group_by to dbix query




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #160: [TC-64] - Adds more views to exp...

2017-01-05 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/160

[TC-64] - Adds more views to experimental TO UI



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
experimental-ui

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/160.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #160


commit 0eebd7fe4c6e8a7a3eb3a99f4bd77d4e0df52012
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-11-30T22:47:52Z

expands the use of a settings flag. i.e. changes it from showDelete = true 
to isNew = false. also adds 'queue server update' btn to server, cachegroup and 
cdn forms.

commit 0a4b058f88e97d6f8577fb8e4647b4c2a0c1bce0
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-11-30T23:16:40Z

adds cg params and profile params page

commit 5e7b4fc22295d2b157415c9653830aabac1a8e08
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-11-30T23:25:38Z

gets rid of the /edit for views where editing an entity

commit bc5fae9404f8362df227dd3edd6bc57567f44004
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-07T19:37:08Z

adds placeholder functionality for experimental TO UI

commit a23fb2e1e67bce779d1f0bde8a8105da72225771
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-13T21:42:59Z

Merge branch 'master' into experimental-ui

commit d409b95bf7597608556828e232e81c3535e37991
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-13T22:04:47Z

adds table for phys location servers

commit e2a34107d040a42e525606aa5f5f8a8894a457f8
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-14T23:51:58Z

adds more relational tables. i.e. cdns/4/servers and 
cdns/4/delivery-services

commit 0414021ab28c48d67b1609d0d1def4d2062df4cc
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-27T15:37:27Z

adds some styling to login page

commit 7dc0a099f026524aed483a37bbc490fbd96a
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-05T18:04:01Z

adds more views to TO experimental UI

commit e3b2cc7e47d0c0027435dd80661d751b11d39eb9
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-05T18:04:13Z

Merge branch 'master' into experimental-ui

commit 51e5567ffa81696d77c5a4b0d1fde586d3191526
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-05T18:24:06Z

need to pass in serverid




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #161: [TC-64] - More views for experim...

2017-01-05 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/161

[TC-64] - More views for experimental UI



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
tc-64-exp-ui

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/161.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #161


commit 52239f168b3de25dc8c5faa8cc11e53562abb5c2
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-11-30T23:16:40Z

adds cg params and profile params page

commit 99090cd496d9813c8f570bf40f4e24316f90e8a5
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-07T19:37:08Z

adds placeholder functionality for experimental TO UI

commit b54f9db84441489c8ef8ce5ddd19cf85e862e9f9
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-13T22:04:47Z

adds table for phys location servers

commit e993c1eeea520be1ed5e6b454adacefbdbc9be2d
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-14T23:51:58Z

adds more relational tables. i.e. cdns/4/servers and 
cdns/4/delivery-services

commit ffe958434e62ad1bdaf607bf9482eead6cda081b
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-27T15:37:27Z

adds some styling to login page

commit 4025f51218ecb0050cd8d3d608190f375c15af74
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-05T18:04:01Z

adds more views to TO experimental UI

commit c4fe4a53bdfa7beaeec3afd55344a585c4948ef6
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-05T19:08:25Z

need to pass in serverid




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #165: [TC-88] - checks for ip and ip6 ...

2017-01-06 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/165

[TC-88] - checks for ip and ip6 / profile uniqueness on server create /  
update

this is a constraint in the database. checking it in the api layer.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-88

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/165.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #165


commit f330bc88f26f5b714890c019448366c72ecea0aa
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-01-06T21:25:41Z

checks for ip and ip6 / profile uniqueness on server create /  update




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #140: [TC-75] - adds cdn and cachegrou...

2016-12-19 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/140

[TC-75] - adds cdn and cachegroup filters to api/1.2/servers



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-75

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/140.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #140


commit ae399abeaa51e1a10df247deb508656487fb87f0
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-19T15:59:51Z

adds filters for cdn and cachegroup

commit 5fcfe48383fe33dd6e7b52d68dc1fc1543561adb
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-19T16:40:47Z

runs perltidy




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #142: [PSQL] - removes expensive disti...

2016-12-20 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/142

[PSQL] - removes expensive distinct from query



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol postgres

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/142.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #142


commit f02e78393d8add6b4c17c4264a23fde59db5e8ea
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-20T23:53:18Z

removes expensive DISTINCT




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-21 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93525547
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1959 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+#Sub to generate ORT json
+sub ort {
+   my $self = shift;
+   my $id   = $self->param('id');
+   my $filename = 'ort';
+   my $scope= 'server';
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_profile = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $row = $rs_profile->next;
+   if ($row) {
+   my $cdn_name = defined( $row->cdn_id ) ? $row->cdn->name : "";
+
+   $data_obj->{'profile'}->{'name'}   = $row->profile->name;
+   $data_obj->{'profile'}->{'id'} = $row->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_config = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $row = $rs_config->next ) {
+   if ( $row->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'location'} = $row->value;
+   }
+   elsif ( $row->name eq 'scope' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'scope'} = $row->value;
+   }
+   }
+   }
+
+   foreach my $file ( keys %$data_obj->{'config_files'} ) {
+   if ( !defined( $data_obj->{'config_files'}->{$file}->{'scope'} 
) ) {
+   $data_obj->{'config_files'}->{$file}->{'scope'} = 
$self->get_scope($file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
--- End diff --

i thought scope was derived from the parameter table. it doesn't look like 
it is here which I actually like better. imo get rid of all the scope 
params/profile_params...unless i'm missing something...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-23 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93779696
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1959 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+#Sub to generate ORT json
+sub ort {
+   my $self = shift;
+   my $id   = $self->param('id');
+   my $filename = 'ort';
+   my $scope= 'server';
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_profile = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $row = $rs_profile->next;
+   if ($row) {
+   my $cdn_name = defined( $row->cdn_id ) ? $row->cdn->name : "";
+
+   $data_obj->{'profile'}->{'name'}   = $row->profile->name;
+   $data_obj->{'profile'}->{'id'} = $row->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_config = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $row = $rs_config->next ) {
+   if ( $row->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'location'} = $row->value;
+   }
+   elsif ( $row->name eq 'scope' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'scope'} = $row->value;
+   }
+   }
+   }
+
+   foreach my $file ( keys %$data_obj->{'config_files'} ) {
+   if ( !defined( $data_obj->{'config_files'}->{$file}->{'scope'} 
) ) {
+   $data_obj->{'config_files'}->{$file}->{'scope'} = 
$self->get_scope($file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##check the scope - is this the correct route?
+   if ( $scope ne 'server' ) {
+   return $self->alert( "Error - incorrect file scope for route 
used.  Please use the " . $scope . " route." );
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   #generate the config file using the appropriate function
+   my $file_contents;
+   if ( $filename eq "12M_facts" ) { $file_contents = $self->facts( 
$server_obj, $filename, $scope ); }
+   elsif ( $filename =~ /to_ext_.*\.config/ ) { $file_contents = 

[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-23 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93786024
  
--- Diff: traffic_ops/app/lib/UI/ConfigFiles.pm ---
@@ -312,6 +312,9 @@ sub param_data {
if ( $row->parameter->name eq "location" ) {
--- End diff --

yes, it feels like the get_scope function should suffice and then it gets 
rid of the need to create scope parameters... and figure out which profiles to 
attach them to... and attach them to profiles... and create new scope params 
when delivery services are updatedand whatever else is needed...

i know it's not quite as "flexible" but man, really seems to simplify 
things...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #146: [TC-80] - adds cachegroup filter...

2016-12-28 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/146

[TC-80] - adds cachegroup filter to parameters and asns



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol tc-80

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/146.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #146


commit 680a1b72c20286e27b91eff63080e5b80e333662
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-28T19:39:44Z

adds cachegroup parameters route

commit c9e1282f6e93a844374b773b18370b09e5c10d1b
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-28T21:13:04Z

adds documentation for new server api filters

commit 9059556ac85cb4f538f0442b3112c4d4337a1c1b
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2016-12-28T21:14:09Z

provides the ability to filter asns by cachegroup id




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-21 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93565394
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1959 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+#Sub to generate ORT json
+sub ort {
+   my $self = shift;
+   my $id   = $self->param('id');
+   my $filename = 'ort';
+   my $scope= 'server';
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_profile = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $row = $rs_profile->next;
+   if ($row) {
+   my $cdn_name = defined( $row->cdn_id ) ? $row->cdn->name : "";
+
+   $data_obj->{'profile'}->{'name'}   = $row->profile->name;
+   $data_obj->{'profile'}->{'id'} = $row->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_config = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $row = $rs_config->next ) {
+   if ( $row->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'location'} = $row->value;
+   }
+   elsif ( $row->name eq 'scope' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'scope'} = $row->value;
+   }
+   }
+   }
+
+   foreach my $file ( keys %$data_obj->{'config_files'} ) {
+   if ( !defined( $data_obj->{'config_files'}->{$file}->{'scope'} 
) ) {
+   $data_obj->{'config_files'}->{$file}->{'scope'} = 
$self->get_scope($file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##check the scope - is this the correct route?
+   if ( $scope ne 'server' ) {
+   return $self->alert( "Error - incorrect file scope for route 
used.  Please use the " . $scope . " route." );
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   #generate the config file using the appropriate function
+   my $file_contents;
+   if ( $filename eq "12M_facts" ) { $file_contents = $self->facts( 
$server_obj, $filename, $scope ); }
+   elsif ( $filename =~ /to_ext_.*\.config/ ) { $file_contents = 

[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-22 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93647261
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1959 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+#Sub to generate ORT json
+sub ort {
+   my $self = shift;
+   my $id   = $self->param('id');
+   my $filename = 'ort';
+   my $scope= 'server';
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_profile = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $row = $rs_profile->next;
+   if ($row) {
+   my $cdn_name = defined( $row->cdn_id ) ? $row->cdn->name : "";
+
+   $data_obj->{'profile'}->{'name'}   = $row->profile->name;
+   $data_obj->{'profile'}->{'id'} = $row->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_config = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $row = $rs_config->next ) {
+   if ( $row->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'location'} = $row->value;
+   }
+   elsif ( $row->name eq 'scope' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'scope'} = $row->value;
+   }
+   }
+   }
+
+   foreach my $file ( keys %$data_obj->{'config_files'} ) {
+   if ( !defined( $data_obj->{'config_files'}->{$file}->{'scope'} 
) ) {
+   $data_obj->{'config_files'}->{$file}->{'scope'} = 
$self->get_scope($file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##check the scope - is this the correct route?
+   if ( $scope ne 'server' ) {
+   return $self->alert( "Error - incorrect file scope for route 
used.  Please use the " . $scope . " route." );
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   #generate the config file using the appropriate function
+   my $file_contents;
+   if ( $filename eq "12M_facts" ) { $file_contents = $self->facts( 
$server_obj, $filename, $scope ); }
+   elsif ( $filename =~ /to_ext_.*\.config/ ) { $file_contents = 

[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-22 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93649730
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -0,0 +1,1959 @@
+package API::Configs::ApacheTrafficServer;
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+use UI::Utils;
+use Mojo::Base 'Mojolicious::Controller';
+use Date::Manip;
+use NetAddr::IP;
+use Data::Dumper;
+use UI::DeliveryService;
+use JSON;
+use API::DeliveryService::KeysUrlSig qw(URL_SIG_KEYS_BUCKET);
+use URI;
+use File::Basename;
+use File::Path;
+
+#Sub to generate ORT json
+sub ort {
+   my $self = shift;
+   my $id   = $self->param('id');
+   my $filename = 'ort';
+   my $scope= 'server';
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   my $data_obj;
+   my $host_name = $server_obj->host_name;
+
+   my %condition = ( 'me.host_name' => $host_name );
+   my $rs_profile = $self->db->resultset('Server')->search( \%condition, { 
prefetch => [ 'cdn', 'profile' ] } );
+
+   my $row = $rs_profile->next;
+   if ($row) {
+   my $cdn_name = defined( $row->cdn_id ) ? $row->cdn->name : "";
+
+   $data_obj->{'profile'}->{'name'}   = $row->profile->name;
+   $data_obj->{'profile'}->{'id'} = $row->profile->id;
+   $data_obj->{'other'}->{'CDN_name'} = $cdn_name;
+
+   %condition = (
+   'profile_parameters.profile' => 
$data_obj->{'profile'}->{'id'},
+   -or  => [ 'name' => 'location', 
'name' => 'scope' ]
+   );
+   my $rs_config = $self->db->resultset('Parameter')->search( 
\%condition, { join => 'profile_parameters' } );
+   while ( my $row = $rs_config->next ) {
+   if ( $row->name eq 'location' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'location'} = $row->value;
+   }
+   elsif ( $row->name eq 'scope' ) {
+   $data_obj->{'config_files'}->{ 
$row->config_file }->{'scope'} = $row->value;
+   }
+   }
+   }
+
+   foreach my $file ( keys %$data_obj->{'config_files'} ) {
+   if ( !defined( $data_obj->{'config_files'}->{$file}->{'scope'} 
) ) {
+   $data_obj->{'config_files'}->{$file}->{'scope'} = 
$self->get_scope($file);
+   }
+   }
+
+   my $file_contents = encode_json($data_obj);
+
+   return $self->render( text => $file_contents, format => 'txt' );
+}
+
+#entry point for server scope api route.
+sub get_server_config {
+   my $self = shift;
+   my $filename = $self->param("filename");
+   my $id   = $self->param('id');
+   my $scope= $self->get_scope($filename);
+
+   ##check user access
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   ##check the scope - is this the correct route?
+   if ( $scope ne 'server' ) {
+   return $self->alert( "Error - incorrect file scope for route 
used.  Please use the " . $scope . " route." );
+   }
+
+   ##verify that a valid server ID has been used
+   my $server_obj = $self->server_data($id);
+   if ( !defined($server_obj) ) {
+   return $self->not_found();
+   }
+
+   #generate the config file using the appropriate function
+   my $file_contents;
+   if ( $filename eq "12M_facts" ) { $file_contents = $self->facts( 
$server_obj, $filename, $scope ); }
+   elsif ( $filename =~ /to_ext_.*\.config/ ) { $file_contents = 

[GitHub] incubator-trafficcontrol pull request #141: [Please Review] [TC-32] Addition...

2016-12-22 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/141#discussion_r93661807
  
--- Diff: 
traffic_ops/app/lib/Schema/Result/DeliveryServiceInfoForCdnList.pm ---
@@ -0,0 +1,101 @@
+
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+package Schema::Result::DeliveryServiceInfoForCdnList;
+
+# this view returns the regexp set for a delivery services, ordered by 
type, set_number.
+# to use, do
+#
+# $rs = $self->db->resultset('DeliveryServiceInfoForCdnList')->search({}, 
{ bind => [ $id ]});
+#
+# where $id is the CDN id.
+
+use strict;
+use warnings;
+use utf8;
+use base 'DBIx::Class::Core';
+
+__PACKAGE__->table_class('DBIx::Class::ResultSource::View');
+
+__PACKAGE__->table("DeliveryServiceInfoForCdnList:");
+
+__PACKAGE__->result_source_instance->is_virtual(1);
+
+__PACKAGE__->result_source_instance->view_definition( "
+SELECT DISTINCT
--- End diff --

I'm a bit confused why there is a DeliveryServiceInfoForCdnList.pm and a 
DeliveryServiceInfoForDomainList.pm. the 2nd one already exists. based on their 
names, they sound the same to me


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #400: tenant api - fixes boolean active flag ...

2017-03-23 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/400
  
so check it out. you have to "cast" the booleans in index and show methods 
but not in create / update...

I don't know why to be honest...




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #389: TO UI - lower edge heath table r...

2017-03-21 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/389

TO UI - lower edge heath table refresh rate from 10s to 30s



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
lower-refresh-edge-health

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/389.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #389


commit bf0dd963432db330eb61f31484a7dfc1abcf093d
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-21T19:25:40Z

lower refresh rate from 10s to 30s




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #385: [TC-184] - adds parent tenant name

2017-03-22 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/385
  
@nir-sopher - you ok with this? parentName is just a convenience added to 
the API. It's not a table on the tenant table.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #395: [BACKPORT] - Change TO monitorin...

2017-03-22 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/395

[BACKPORT] - Change TO monitoring.json to raw SQL

This is 3-10x faster, and this endpoint is one of the slowest.

(cherry picked from commit 8942ce09e78e0b4e89e02075537ae65434189fc5)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 2.0.x

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/395.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #395






---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #395: [BACKPORT] - Change TO monitorin...

2017-03-22 Thread mitchell852
Github user mitchell852 closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/395


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #399: [TC-205] - fixes null pointer wh...

2017-03-22 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/399

[TC-205] - fixes null pointer when user logged in as ldap plus copy/paste 
errors…

… plus  moved up invalid check

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol TC-205

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/399.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #399


commit cbd9d239e9927c9fff6242103e832a73bfb5e909
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-23T02:07:53Z

fixes null pointer when user logged in as ldap plus copy/paste errors plus  
moved up invalid check




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #400: tenant api - fixes boolean activ...

2017-03-22 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/400

tenant api - fixes boolean active flag on update and create



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
fix-tenant-active

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/400.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #400


commit 48c4fcf3e7f8716ca1bee844b7467c36a5be1169
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-23T03:12:53Z

no boolean casting needed in this scenario. don't really know why.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #401: [TC-206] - adds the ability in t...

2017-03-22 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/401

[TC-206] - adds the ability in the API to filter profiles by cdn



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol TC-206

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/401.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #401


commit 4fd1c808984fc399d013bf931e95cf708d9bc851
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-23T03:30:59Z

adds the ability to filter profiles by cdn




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #419: updates docs for ds apis

2017-03-31 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/419

updates docs for ds apis



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
ds-docs-update

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/419.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #419


commit b5dfea5480168a61be906e9b904c7dfa56597780
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-31T18:49:14Z

updates docs for ds apis




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #420: fixes datatypes on ds api docs

2017-03-31 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/420

fixes datatypes on ds api docs



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
ds-docs-update

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/420.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #420


commit 9ae38abe1e60716e9800aa1eb96c3b553e0b7625
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-31T20:28:43Z

fixes datatypes on ds api docs




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #374: [BACKPORT] - adds back exampleur...

2017-03-16 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/374

[BACKPORT] - adds back exampleurls to deliveryservice in 
/api/version/deliveryserv…

…ices

(cherry picked from commit dddb3a67095b2c07df46e3cd166fdb1843614c67)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 2.0.x

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/374.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #374


commit 93bc61608f2ef04de7c0ba751f88ef8b59d3decb
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-16T17:20:06Z

adds back exampleurls to deliveryservice in /api/version/deliveryservices

(cherry picked from commit dddb3a67095b2c07df46e3cd166fdb1843614c67)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #373: adds back exampleurls to deliver...

2017-03-16 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/373

adds back exampleurls to deliveryservice in /api/version/deliveryserv…

…ices

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
add-example-url

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/373.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #373


commit dddb3a67095b2c07df46e3cd166fdb1843614c67
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-16T17:20:06Z

adds back exampleurls to deliveryservice in /api/version/deliveryservices




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #385: adds parent tenant name

2017-03-20 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/385

adds parent tenant name



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
adds_parent_tenant_name

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/385.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #385


commit 13959452413e231d724c7350c63dfe9a320b6a67
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-21T03:37:59Z

adds parent tenant name




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #368: [BACKPORT] - fixes regression - ...

2017-03-15 Thread mitchell852
Github user mitchell852 closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/368


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #362: [BACKPORT] [TC-189] - fixes 2 mi...

2017-03-15 Thread mitchell852
Github user mitchell852 closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/362


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #356: Security Enhancement - secures D...

2017-03-14 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/356#discussion_r106014345
  
--- Diff: traffic_ops/app/lib/UI/GenDbDump.pm ---
@@ -17,11 +17,17 @@ package UI::GenDbDump;
 #
 use Mojo::Base 'Mojolicious::Controller';
 use Data::Dumper;
+use UI::Utils;
 
 sub dbdump {
my $self = shift;
my $filename = $self->param('filename');
 
+   if ( !_oper($self) ) {
+   $self->internal_server_error( { Error => "Insufficient 
permissions for DB Dump. Admin access is required." } ); 
--- End diff --

unless you want to change that to is_admin()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #367: [TC-194] Add federation view fai...

2017-03-14 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/367

[TC-194] Add federation view failed to load DS's due to bad orderby value



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol TC-194

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/367.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #367


commit 6685b67d373562849e94cda3ee5c4ca630ee57fb
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-14T21:16:55Z

name is not a column on the ds table. display_name is however.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #356: Security Enhancement - secures D...

2017-03-14 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/356#discussion_r106014242
  
--- Diff: traffic_ops/app/lib/UI/GenDbDump.pm ---
@@ -17,11 +17,17 @@ package UI::GenDbDump;
 #
 use Mojo::Base 'Mojolicious::Controller';
 use Data::Dumper;
+use UI::Utils;
 
 sub dbdump {
my $self = shift;
my $filename = $self->param('filename');
 
+   if ( !_oper($self) ) {
+   $self->internal_server_error( { Error => "Insufficient 
permissions for DB Dump. Admin access is required." } ); 
--- End diff --

your error message is not quite right :)

Admin OR ops role is required...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/371#discussion_r106541559
  
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -0,0 +1,247 @@
+package API::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+use UI::Utils;
+
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+use JSON;
+use MojoPlugins::Response;
+
+my $finfo = __FILE__ . ":";
+
+sub getTenantName {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return defined($tenant_id) ? $self->db->resultset('Tenant')->search( { 
id => $tenant_id } )->get_column('name')->single() : "n/a";
+}
+
+sub isRootTenant {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return !defined($self->db->resultset('Tenant')->search( { id => 
$tenant_id } )->get_column('parent_id')->single());
+}
+
+sub index {
+   my $self= shift;
+
+   my @data;
+   my $orderby = $self->param('orderby') || "name";
+   my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by 
=> 'me.' . $orderby } );
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+
+sub show {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   my $rs_data = $self->db->resultset("Tenant")->search( { 'me.id' => $id 
});
+   my @data = ();
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+sub update {
+   my $self   = shift;
+   my $id = $self->param('id');
+   my $params = $self->req->json;
+
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   my $tenant = $self->db->resultset('Tenant')->find( { id => $id } );
+   if ( !defined($tenant) ) {
+   return $self->not_found();
+   }
+
+   if ( !defined($params) ) {
+   return $self->alert("Parameters must be in JSON format.");
+   }
+
+   if ( !defined( $params->{name} ) ) {
+   return $self->alert("Tenant name is required.");
+   }
+   
+   if ( $params->{name} ne $self->getTenantName($id) ) {
+   my $name = $params->{name};
+   my $existing = $self->db->resultset('Tenant')->search( { name 
=> $name } )->get_column('name')->single();
+   if ($existing) {
+   return $self->alert("A tenant with name \"$name\" 
already exists.");
+   }   
+   }   
+
+   if ( !defined( $params->{parentId}) && !$self->isRootTenant($id) ) {
+   return $self->alert("Parent Id is required.");
+   }
+   
+   my $is_active = $params->{active};
+   
+   if ( !$params->{active} && $self->isRootTenant($id)) {
+   return $self->alert("Root user cannot be in-active.");
+   }
+   
+
+   if ( !defined($params->{parentId}) && !isRootTenant($id) ) {
+   return $self->alert("Only the \"root\" tenant can have no 
parent.");
+   }
+   
 

[GitHub] incubator-trafficcontrol pull request #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/371#discussion_r106541595
  
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -0,0 +1,247 @@
+package API::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+use UI::Utils;
+
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+use JSON;
+use MojoPlugins::Response;
+
+my $finfo = __FILE__ . ":";
+
+sub getTenantName {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return defined($tenant_id) ? $self->db->resultset('Tenant')->search( { 
id => $tenant_id } )->get_column('name')->single() : "n/a";
+}
+
+sub isRootTenant {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return !defined($self->db->resultset('Tenant')->search( { id => 
$tenant_id } )->get_column('parent_id')->single());
+}
+
+sub index {
+   my $self= shift;
+
+   my @data;
+   my $orderby = $self->param('orderby') || "name";
+   my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by 
=> 'me.' . $orderby } );
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+
+sub show {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   my $rs_data = $self->db->resultset("Tenant")->search( { 'me.id' => $id 
});
+   my @data = ();
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+sub update {
+   my $self   = shift;
+   my $id = $self->param('id');
+   my $params = $self->req->json;
+
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   my $tenant = $self->db->resultset('Tenant')->find( { id => $id } );
+   if ( !defined($tenant) ) {
+   return $self->not_found();
+   }
+
+   if ( !defined($params) ) {
+   return $self->alert("Parameters must be in JSON format.");
+   }
+
+   if ( !defined( $params->{name} ) ) {
+   return $self->alert("Tenant name is required.");
+   }
+   
+   if ( $params->{name} ne $self->getTenantName($id) ) {
+   my $name = $params->{name};
+   my $existing = $self->db->resultset('Tenant')->search( { name 
=> $name } )->get_column('name')->single();
+   if ($existing) {
+   return $self->alert("A tenant with name \"$name\" 
already exists.");
+   }   
+   }   
+
+   if ( !defined( $params->{parentId}) && !$self->isRootTenant($id) ) {
+   return $self->alert("Parent Id is required.");
+   }
+   
+   my $is_active = $params->{active};
+   
+   if ( !$params->{active} && $self->isRootTenant($id)) {
+   return $self->alert("Root user cannot be in-active.");
+   }
+   
+
+   if ( !defined($params->{parentId}) && !isRootTenant($id) ) {
+   return $self->alert("Only the \"root\" tenant can have no 
parent.");
+   }
+   
 

[GitHub] incubator-trafficcontrol issue #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/371
  
Also, you forgot one thingdocumentation. I'll help you get started on 
that...I'll send a PR your way.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/371#discussion_r106573144
  
--- Diff: traffic_ops/app/lib/Fixtures/Tenant.pm ---
@@ -0,0 +1,46 @@
+package Fixtures::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+use Moose;
+extends 'DBIx::Class::EasyFixture';
+use namespace::autoclean;
+use Digest::SHA1 qw(sha1_hex);
+
+my %definition_for = (
+   ## id => 1
--- End diff --

can you get rid of this comment? it's misleading.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/371#discussion_r106541500
  
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -0,0 +1,247 @@
+package API::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+use UI::Utils;
+
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+use JSON;
+use MojoPlugins::Response;
+
+my $finfo = __FILE__ . ":";
+
+sub getTenantName {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return defined($tenant_id) ? $self->db->resultset('Tenant')->search( { 
id => $tenant_id } )->get_column('name')->single() : "n/a";
+}
+
+sub isRootTenant {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return !defined($self->db->resultset('Tenant')->search( { id => 
$tenant_id } )->get_column('parent_id')->single());
+}
+
+sub index {
+   my $self= shift;
+
+   my @data;
+   my $orderby = $self->param('orderby') || "name";
+   my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by 
=> 'me.' . $orderby } );
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+
+sub show {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   my $rs_data = $self->db->resultset("Tenant")->search( { 'me.id' => $id 
});
+   my @data = ();
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+sub update {
+   my $self   = shift;
+   my $id = $self->param('id');
+   my $params = $self->req->json;
+
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   my $tenant = $self->db->resultset('Tenant')->find( { id => $id } );
+   if ( !defined($tenant) ) {
+   return $self->not_found();
+   }
+
+   if ( !defined($params) ) {
+   return $self->alert("Parameters must be in JSON format.");
+   }
+
+   if ( !defined( $params->{name} ) ) {
+   return $self->alert("Tenant name is required.");
+   }
+   
+   if ( $params->{name} ne $self->getTenantName($id) ) {
+   my $name = $params->{name};
+   my $existing = $self->db->resultset('Tenant')->search( { name 
=> $name } )->get_column('name')->single();
+   if ($existing) {
+   return $self->alert("A tenant with name \"$name\" 
already exists.");
+   }   
+   }   
+
+   if ( !defined( $params->{parentId}) && !$self->isRootTenant($id) ) {
+   return $self->alert("Parent Id is required.");
+   }
+   
+   my $is_active = $params->{active};
+   
+   if ( !$params->{active} && $self->isRootTenant($id)) {
+   return $self->alert("Root user cannot be in-active.");
+   }
+   
+
+   if ( !defined($params->{parentId}) && !isRootTenant($id) ) {
+   return $self->alert("Only the \"root\" tenant can have no 
parent.");
+   }
+   
 

[GitHub] incubator-trafficcontrol issue #371: [TC-184] Tenancy table creation

2017-03-17 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/371
  
As far as the "active" flag being required on update, it's no big deal. 
either was is fine with me. i guess i was just thinking it might be confusing 
to a user that if I omit the active flag on an update, it would flip 
tenant.active back to false. 

It makes sense on create - if you don't supply it, it gets its default 
value of false. but i'm not sure about update...

up to  you.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #390: [BACKPORT] [TC-204] - only reloa...

2017-03-21 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/390

[BACKPORT] [TC-204] - only reload health table if browser window is active

lightens the load on the database

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 2.0.x

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/390.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #390


commit 87200cbfee65c044d18507a335e80c8a12315c6d
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-21T19:25:40Z

lower refresh rate from 10s to 30s

(cherry picked from commit bf0dd963432db330eb61f31484a7dfc1abcf093d)

commit c59ba4d292eabb02115ca6139144d305829b863e
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-21T20:52:35Z

only reload health table if browser window is active

(cherry picked from commit f0318c01d979faae2b0c151eb737a80075a696a7)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #390: [BACKPORT] [TC-204] - only reloa...

2017-03-21 Thread mitchell852
Github user mitchell852 closed the pull request at:

https://github.com/apache/incubator-trafficcontrol/pull/390


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #368: [BACKPORT] - fixes regression - ...

2017-03-15 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/368

[BACKPORT] - fixes regression - unable to create federations

(cherry picked from commit 6685b67d373562849e94cda3ee5c4ca630ee57fb)

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
2.0.x_tc-194

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/368.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #368


commit 334b0637310992d48f2a99966345d503a1f1ff0f
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-14T21:16:55Z

name is not a column on the ds table. display_name is however.

(cherry picked from commit 6685b67d373562849e94cda3ee5c4ca630ee57fb)




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #369: fixes broken cdn test. domainNam...

2017-03-15 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/369

fixes broken cdn test. domainName is required on put.



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol 
fix-cdn-test

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/369.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #369


commit ac4548c9268222d382134703cd015bef44906922
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-03-15T19:04:16Z

fixes broken cdn test. domainName is required on put.




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #299: Instant Invalidate for ORT and T...

2017-03-15 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/299#discussion_r106264761
  
--- Diff: traffic_ops/app/lib/API/Configs/ApacheTrafficServer.pm ---
@@ -76,7 +76,9 @@ sub get_config_metadata {
$data_obj->{'info'}->{'cdn_name'}   = $cdn_name;
$data_obj->{'info'}->{'cdn_id'} = 
$server->cdn->id;
$data_obj->{'info'}->{'tm_url'} = $tm_url;
-   $data_obj->{'info'}->{'tm_cache_url'}   = $tm_cache_url;
+   if ( $tm_cache_url ) {
--- End diff --

should this be called to_cache_url instead? it would be nice to get rid of 
all references to 'tm' at some point if possible...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #299: Instant Invalidate for ORT and T...

2017-03-15 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/299#discussion_r106267760
  
--- Diff: traffic_ops/app/lib/UI/Server.pm ---
@@ -915,20 +916,53 @@ sub readupdate {
{
$parent_pending{ 
$rs_servers->single->host_name } = 1;
}
+   if (   $prow->reval_pending == 1
+   && $prow->status->name ne 
"OFFLINE" )
+   {
+   $parent_reval_pending{ 
$rs_servers->single->host_name } = 1;
+   }
}
}
}
}
 
while ( my $row = $rs_servers->next ) {
-   if ( $parent_pending{ $row->host_name } ) {
+   if ( $parent_pending{ $row->host_name } && 
$parent_reval_pending{ $row->host_name } ) {
--- End diff --

can't we collapse this if/elseif...seems like the only thing that is 
different is the 

parent_pending => 0|1,
parent_reval_pending => 0|1

maybe a tertiary operator?

parent_pending => (condition) ? 1 : 0,
parent_reval_pending => (condition) ? 1 : 0,


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #299: Instant Invalidate for ORT and T...

2017-03-15 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/299#discussion_r106263950
  
--- Diff: 
traffic_ops/app/db/migrations/20170221190747_add_reval_pending.sql ---
@@ -0,0 +1,26 @@
+/*
+
--- End diff --

this migration file needs a later timestamp on the name. see existing 
migrations - 
https://github.com/apache/incubator-trafficcontrol/tree/master/traffic_ops/app/db/migrations

it needs to be timestamped later than the add_client_steering migration...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #299: Instant Invalidate for ORT and T...

2017-03-15 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/299#discussion_r106269894
  
--- Diff: traffic_ops/app/lib/UI/Server.pm ---
@@ -980,7 +1018,14 @@ sub postupdate {
 
my $update_server =
$self->db->resultset('Server')->search( { id => $serverid } );
-   if ( defined $updated ) {
+
+   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 ) {
--- End diff --

you can save a few lines of code here by getting rid of the else and moving 

$update_server->update( { upd_pending => $updated } );

below the remaining if...and also leave it out of the if...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/371#discussion_r106575505
  
--- Diff: traffic_ops/app/lib/API/Tenant.pm ---
@@ -0,0 +1,247 @@
+package API::Tenant;
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+#
+#
+
+use UI::Utils;
+
+use Mojo::Base 'Mojolicious::Controller';
+use Data::Dumper;
+use JSON;
+use MojoPlugins::Response;
+
+my $finfo = __FILE__ . ":";
+
+sub getTenantName {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return defined($tenant_id) ? $self->db->resultset('Tenant')->search( { 
id => $tenant_id } )->get_column('name')->single() : "n/a";
+}
+
+sub isRootTenant {
+   my $self= shift;
+   my $tenant_id   = shift;
+   return !defined($self->db->resultset('Tenant')->search( { id => 
$tenant_id } )->get_column('parent_id')->single());
+}
+
+sub index {
+   my $self= shift;
+
+   my @data;
+   my $orderby = $self->param('orderby') || "name";
+   my $rs_data = $self->db->resultset("Tenant")->search( undef, {order_by 
=> 'me.' . $orderby } );
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+
+sub show {
+   my $self = shift;
+   my $id   = $self->param('id');
+
+   my $rs_data = $self->db->resultset("Tenant")->search( { 'me.id' => $id 
});
+   my @data = ();
+   while ( my $row = $rs_data->next ) {
+   push(
+   @data, {
+   "id"   => $row->id,
+   "name" => $row->name,
+   "active"   => \$row->active,
+   "parentId" => $row->parent_id,
+   }
+   );
+   }
+   $self->success( \@data );
+}
+
+sub update {
+   my $self   = shift;
+   my $id = $self->param('id');
+   my $params = $self->req->json;
+
+   if ( !_oper($self) ) {
+   return $self->forbidden();
+   }
+
+   my $tenant = $self->db->resultset('Tenant')->find( { id => $id } );
+   if ( !defined($tenant) ) {
+   return $self->not_found();
+   }
+
+   if ( !defined($params) ) {
+   return $self->alert("Parameters must be in JSON format.");
+   }
+
+   if ( !defined( $params->{name} ) ) {
+   return $self->alert("Tenant name is required.");
+   }
+   
+   if ( $params->{name} ne $self->getTenantName($id) ) {
+   my $name = $params->{name};
+   my $existing = $self->db->resultset('Tenant')->search( { name 
=> $name } )->get_column('name')->single();
+   if ($existing) {
+   return $self->alert("A tenant with name \"$name\" 
already exists.");
+   }   
+   }   
+
+   if ( !defined( $params->{parentId}) && !$self->isRootTenant($id) ) {
+   return $self->alert("Parent Id is required.");
+   }
+   
+   my $is_active = $params->{active};
+   
+   if ( !$params->{active} && $self->isRootTenant($id)) {
--- End diff --

maybe you should just make "active" required on update. otherwise, if 
tenant.active=true (and not root) and I send thru no active parameter, I end up 
with tenant.active=false. it doesn't seem like a lot to ask of the api consumer 
to pass thru active=true|false...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol issue #371: [TC-184] Tenancy table creation

2017-03-16 Thread mitchell852
Github user mitchell852 commented on the issue:

https://github.com/apache/incubator-trafficcontrol/pull/371
  
I created a PR into your branch for the documentation - 
https://github.com/nir-sopher/incubator-trafficcontrol/pull/4

If it looks ok to you, just hit the merge button and my commit will be 
added to this PR.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #398: [TC-184] Org tenancy - adding te...

2017-04-01 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/398#discussion_r109293617
  
--- Diff: traffic_ops/app/lib/API/User.pm ---
@@ -174,7 +179,9 @@ sub update {
registration_sent   => ( 
$params->{registrationSent} ) ? 1 : 0,
role=> $params->{role},
state_or_province   => $params->{stateOrProvince},
-   username=> $params->{username}
+   username=> $params->{username},
+   tenant_id   => $tenant_id
--- End diff --

"There is no limitation currently forcing a single root tenant."

actually, there is, right? i mean, you can't create a tenant thru the api 
with parent=null. can you? i didn't think you could. i mean, technically, 
someone can do an insert on the tenant table directly to create multiple "root" 
tenants but they shouldn't be able to via the tenant api. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #398: [TC-184] Org tenancy - adding te...

2017-04-01 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/398#discussion_r109293498
  
--- Diff: traffic_ops/app/lib/API/User.pm ---
@@ -174,7 +179,9 @@ sub update {
registration_sent   => ( 
$params->{registrationSent} ) ? 1 : 0,
role=> $params->{role},
state_or_province   => $params->{stateOrProvince},
-   username=> $params->{username}
+   username=> $params->{username},
+   tenant_id   => $tenant_id
--- End diff --

I think you can just do this to get the desired result:

tenant_id  => $params->{tenantId}

and if it's not provided, it will set it to  undef, otherwise it will set 
it accordingly


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #398: [TC-184] Org tenancy - adding te...

2017-04-01 Thread mitchell852
Github user mitchell852 commented on a diff in the pull request:


https://github.com/apache/incubator-trafficcontrol/pull/398#discussion_r109293677
  
--- Diff: traffic_ops/app/lib/UI/Utils.pm ---
@@ -42,7 +42,7 @@ use constant ADMIN  => 30;
 our %EXPORT_TAGS = (
'all' => [
qw(trim_whitespace is_admin is_oper is_ldap is_privileged log 
is_ipaddress is_ip6address is_netmask in_same_net is_hostname admin_status_id 
type_id type_ids
-   profile_id profile_ids tm_version tm_url 
name_version_string is_regexp stash_role navbarpage rascal_hosts_by_cdn 
is_steering)
+   profile_id profile_ids tm_version tm_url 
name_version_string is_regexp stash_role navbarpage rascal_hosts_by_cdn 
is_steering defined_or_default current_user_tenant)
--- End diff --

can you change this to:

defined_or_default(current_user_tenant())

otherwise, it looks like 2 properties...


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] incubator-trafficcontrol pull request #427: [TC-222] - adds unique constrain...

2017-04-04 Thread mitchell852
GitHub user mitchell852 opened a pull request:

https://github.com/apache/incubator-trafficcontrol/pull/427

[TC-222] - adds unique constraint to a number of tables

to:

parameter (name, config_file, value)
job_status (name)
job_agent (name)
role (name)
status (name)
type (name)

also, instructs seeds.sql to skip if a constraint conflict exists, thus 
preventing duplicates.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/mitchell852/incubator-trafficcontrol seeds

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-trafficcontrol/pull/427.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #427


commit 382a7d4e183edd89976a95c54d89ec341a14c14a
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-04-04T20:21:00Z

adds unique constraints to job_status, role, status, type, job_agent and 
parameter table

commit eb06eb4304c8bb2aaf0af456d6cf5533df5e26a2
Author: Jeremy Mitchell <mitchell...@gmail.com>
Date:   2017-04-04T20:22:02Z

inserts are ignored if unique constraints are violated resulting in no 
errors / dups




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


  1   2   3   4   5   >