This is an automated email from the ASF dual-hosted git repository.

ocket8888 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficcontrol.git


The following commit(s) were added to refs/heads/master by this push:
     new 0f9f4c94e4 use a comma separated list of IPs for purge_allow_ip (#7233)
0f9f4c94e4 is described below

commit 0f9f4c94e49b4b93cb25078cb033f00d78211102
Author: Joe Pappano <[email protected]>
AuthorDate: Wed Dec 14 12:44:10 2022 -0500

    use a comma separated list of IPs for purge_allow_ip (#7233)
    
    * use a comma separated list of IPs for purge_allow_ip
    
    * Updated docs to use comma separated list.
    
    * updated purge allow ip to use comma separated list
    
    * fixed run-on sentence
---
 docs/source/overview/profiles_and_parameters.rst | 2 +-
 lib/go-atscfg/ipallowdotconfig.go                | 4 +++-
 lib/go-atscfg/ipallowdotyaml.go                  | 4 +++-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/docs/source/overview/profiles_and_parameters.rst 
b/docs/source/overview/profiles_and_parameters.rst
index 18cae3bb93..7b62a90675 100644
--- a/docs/source/overview/profiles_and_parameters.rst
+++ b/docs/source/overview/profiles_and_parameters.rst
@@ -308,7 +308,7 @@ This configuration file is mainly generated based on the 
assignments of :term:`c
 
 ip_allow.config
 '''''''''''''''
-This configuration file is mostly generated from various server data, but can 
be affected by a Parameter that has a :ref:`parameter-name` of 
"purge_allow_ip", which will cause the insertion of a line with 
:file:`src_ip={VALUE} action=ip_allow method=ALL` where ``VALUE`` is the 
Parameter's Value_. Additionally, Parameters with :ref:`Names <parameter-name>` 
like :file:`coalesce_{masklen|number}_v{4|6}` cause Traffic Ops to generate 
coalesced IP ranges in different ways. In the case that `` [...]
+This configuration file is mostly generated from various server data, but can 
be affected by a Parameter that has a :ref:`parameter-name` of 
"purge_allow_ip", which will cause the insertion of a line with 
:file:`src_ip={VALUE} action=ip_allow method=ALL` where ``VALUE`` is the 
Parameter's Value_. To allow purge from multiple IPs use a comma separated list 
in the Parameter's Value_.  Additionally, Parameters with :ref:`Names 
<parameter-name>` like :file:`coalesce_{masklen|number}_v{4|6}`  [...]
 
 .. impl-detail:: At the time of this writing, coalescence is implemented 
through the `the NetAddr\:\:IP Perl library 
<http://search.cpan.org/~miker/NetAddr-IP-4.078/IP.pm>`_.
 
diff --git a/lib/go-atscfg/ipallowdotconfig.go 
b/lib/go-atscfg/ipallowdotconfig.go
index 5a419a85ed..c4f9788457 100644
--- a/lib/go-atscfg/ipallowdotconfig.go
+++ b/lib/go-atscfg/ipallowdotconfig.go
@@ -89,7 +89,9 @@ func MakeIPAllowDotConfig(
                for _, val := range vals {
                        switch name {
                        case ParamPurgeAllowIP:
-                               ipAllowDat = append(ipAllowDat, allowAll(val))
+                               for _, ip := range strings.Split(val, ",") {
+                                       ipAllowDat = append(ipAllowDat, 
allowAll(strings.TrimSpace(ip)))
+                               }
                        case ParamCoalesceMaskLenV4:
                                if vi, err := strconv.Atoi(val); err != nil {
                                        warnings = append(warnings, "got param 
'"+name+"' val '"+val+"' not a number, ignoring!")
diff --git a/lib/go-atscfg/ipallowdotyaml.go b/lib/go-atscfg/ipallowdotyaml.go
index 0b19ca38a5..99c5692c1e 100644
--- a/lib/go-atscfg/ipallowdotyaml.go
+++ b/lib/go-atscfg/ipallowdotyaml.go
@@ -91,7 +91,9 @@ func MakeIPAllowDotYAML(
                for _, val := range vals {
                        switch name {
                        case ParamPurgeAllowIP:
-                               ipAllowDat = append(ipAllowDat, 
yamlAllowAll(val))
+                               for _, ip := range strings.Split(val, ",") {
+                                       ipAllowDat = append(ipAllowDat, 
yamlAllowAll(strings.TrimSpace(ip)))
+                               }
                        case ParamCoalesceMaskLenV4:
                                if vi, err := strconv.Atoi(val); err != nil {
                                        warnings = append(warnings, "got param 
'"+name+"' val '"+val+"' not a number, ignoring!")

Reply via email to