From ca46c7f7cdefcb825806c113615acd05e0516b28 Mon Sep 17 00:00:00 2001 From: Srijeet Chatterjee Date: Tue, 11 Apr 2023 22:58:10 +0530 Subject: [PATCH 1/2] Adding CDN lock check for invalidation jobs --- .../invalidationjobs/invalidationjobs.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/traffic_ops/traffic_ops_golang/invalidationjobs/invalidationjobs.go b/traffic_ops/traffic_ops_golang/invalidationjobs/invalidationjobs.go index 2f6a00ede3..22f9d887b5 100644 --- a/traffic_ops/traffic_ops_golang/invalidationjobs/invalidationjobs.go +++ b/traffic_ops/traffic_ops_golang/invalidationjobs/invalidationjobs.go @@ -595,6 +595,17 @@ func CreateV40(w http.ResponseWriter, r *http.Request) { return } + _, cdnName, _, err := dbhelpers.GetDSNameAndCDNFromID(inf.Tx.Tx, int(dsid)) + if err != nil { + api.HandleErr(w, r, inf.Tx.Tx, http.StatusInternalServerError, nil, errors.New("getting delivery service and CDN name from ID: "+err.Error())) + return + } + userErr, sysErr, statusCode := dbhelpers.CheckIfCurrentUserCanModifyCDN(inf.Tx.Tx, string(cdnName), inf.User.UserName) + if userErr != nil || sysErr != nil { + api.HandleErr(w, r, inf.Tx.Tx, statusCode, userErr, sysErr) + return + } + row := inf.Tx.Tx.QueryRow(insertQueryV4, job.TTLHours, dsid, // Used in inner select for deliveryservice From 3ca7bed1c31b735d9e68d0494006d2be2f1da7be Mon Sep 17 00:00:00 2001 From: Srijeet Chatterjee Date: Tue, 11 Apr 2023 23:01:41 +0530 Subject: [PATCH 2/2] changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec37e0a781..b997b88acf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). - [#7386](https://github.com/apache/trafficcontrol/pull/7386) *Traffic Portal* Increased the number of events that are logged to the TP access log. ### Fixed +- [#7441](https://github.com/apache/trafficcontrol/pull/7441) *Traffic Ops* Fixed the invalidation jobs endpoint to respect CDN locks. - [#7414](https://github.com/apache/trafficcontrol/pull/7414) * Traffic Portal* Fixed DSR difference for DS required capability. - [#7130](https://github.com/apache/trafficcontrol/issues/7130) *Traffic Ops* Fixes service_categories response to POST API. - [#7340](https://github.com/apache/trafficcontrol/pull/7340) *Traffic Router* Fixed TR logging for the `cqhv` field when absent.