Skip to content

Commit

Permalink
Recursively invalidate all files and dirs
Browse files Browse the repository at this point in the history
This fixes a bug where /en-US/ was not invalidated.
  • Loading branch information
brson committed Aug 18, 2016
1 parent f0afbc5 commit 186a8ec
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions travis/inval-list.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,24 @@ def pretty_time():
return '-'.join(time.strftime('%c').split())

def list_files(site, name):
base = os.path.join(site, name)
return [os.path.join(name, f) for f in os.listdir(base) if os.path.isfile(os.path.join(base, f))]
base = site + name
files = [name]
for f in os.listdir(base):
path = os.path.join(base, f)
if os.path.isfile(path):
files.extend([name + f])
if os.path.isdir(path):
files.extend(list_files(site, name + f + "/"))

def build_payload(site):
files = [ f for f in os.listdir(site) if os.path.isfile(os.path.join(site,f)) ]
return files

def build_payload(site):
# translations
files.extend(list_files(site, "en-US"))
files = list_files(site, "/")

obj = { "Paths": {
"Quantity": len(files),
"Items": [ '/' + f for f in files] },
"Items": [ f for f in files] },
"CallerReference": "travis-" + pretty_time() }
return obj

Expand Down

0 comments on commit 186a8ec

Please sign in to comment.