Skip to content

Commit dbc988c

Browse files
Specify the version for files downloaded from the CDN. (#48)
* Specify the version for files downloaded from the CDN. * Missed setting variable.
1 parent eca7bea commit dbc988c

8 files changed

+16
-8
lines changed

bin/download-collection.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -e
44

55
s3="https://files.planning.data.gov.uk/"
6+
timestamp=`date +%s`
67

78
csvcut -c collection specification/collection.csv | tail -n +2 |
89
while read collection
@@ -14,7 +15,7 @@ do
1415
if [ ! -f $path ] ; then
1516
mkdir -p $dir
1617
set -x
17-
curl -qsfL $flags --retry 3 -o $path "$s3$collection-collection/collection/$file"
18+
curl -qsfL $flags --retry 3 -o $path "$s3$collection-collection/collection/$file?version=$timestamp"
1819
set +x
1920
fi
2021
done

bin/download-column-field.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
s3="https://files.planning.data.gov.uk/"
44
column_field_dir="column-field/"
5+
timestamp=`date +%s`
56

67
python3 bin/resources.py |
78
while read collection pipeline resource
@@ -14,7 +15,7 @@ do
1415
if [ ! -f $path ] ; then
1516
mkdir -p $dir
1617
set -x
17-
curl -qsfL $flags "$s3$collection-collection/var/column-field/$pipeline/$resource.csv" > $path
18+
curl -qsfL $flags "$s3$collection-collection/var/column-field/$pipeline/$resource.csv?version=$timestamp" > $path
1819
set +x
1920
fi
2021
done

bin/download-converted-resources.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -e
33

44
s3="https://files.planning.data.gov.uk/"
55
dir=var/converted-resource
6+
timestamp=`date +%s`
67

78
python3 bin/resources.py |
89
while read collection pipeline resource
@@ -14,7 +15,7 @@ do
1415
if [ ! -f $path ] ; then
1516
mkdir -p $dir/$pipeline
1617
set -x
17-
curl -qsfL $flags "$s3$collection-collection/$dir/$pipeline/$resource.csv" -o $path ||:
18+
curl -qsfL $flags "$s3$collection-collection/$dir/$pipeline/$resource.csv?version=$timestamp" -o $path ||:
1819
set +x
1920
fi
2021
done

bin/download-digital-land.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
set -e
44

55
s3="https://files.planning.data.gov.uk/"
6+
timestamp=`date +%s`
67

78
# Directory to save the database
89
db_dir="dataset"
910
db_file="digital-land.sqlite3"
1011
db_path="${db_dir}/${db_file}"
11-
db_url="${s3}digital-land-builder/dataset/${db_file}"
12+
db_url="${s3}digital-land-builder/dataset/${db_file}?version=${timestamp}"
1213

1314
# Create directory if it does not exist
1415
mkdir -p $db_dir

bin/download-expectations.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -e
44

55
s3="https://files.planning.data.gov.uk/"
66
expectations_dir="expectations/"
7+
timestamp=`date +%s`
78

89
dir=var/$expectations_dir
910
mkdir -p $dir
@@ -19,7 +20,7 @@ do
1920
path=$dir$file
2021
if [ ! -f $path ] ; then
2122
set -x
22-
if ! curl -qsfL $flags --retry 3 -o $path $s3$collection-collection/dataset/$file; then
23+
if ! curl -qsfL $flags --retry 3 -o $path $s3$collection-collection/dataset/$file?version=$timestamp ; then
2324
echo "*** UNABLE TO DOWNLOAD $collection FROM $path ***"
2425
fi
2526
set +x

bin/download-issues.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#set -e
44

55
s3="https://files.planning.data.gov.uk/"
6+
timestamp=`date +%s`
67

78
python3 bin/resources.py |
89
while read collection pipeline resource
@@ -14,7 +15,7 @@ do
1415
if [ ! -f $path ] ; then
1516
mkdir -p $dir
1617
set -x
17-
curl -qsfL $flags "$s3$collection-collection/issue/$pipeline/$resource.csv" > $path
18+
curl -qsfL $flags "$s3$collection-collection/issue/$pipeline/$resource.csv?version=$timestamp" > $path
1819
set +x
1920
fi
2021
done

bin/download-operational-issues.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
s3="https://files.planning.data.gov.uk/"
66
operational_issue_dir="performance/operational_issue/"
7+
timestamp=`date +%s`
78

89
mkdir -p $operational_issue_dir
910

@@ -15,7 +16,7 @@ do
1516
if [ ! -f $path ] ; then
1617
mkdir -p $dir
1718
set -x
18-
curl -qsfL $flags "$s3$operational_issue_dir$dataset/operational-issue.csv" > $path
19+
curl -qsfL $flags "$s3$operational_issue_dir$dataset/operational-issue.csv?version=$timestamp" > $path
1920
set +x
2021
fi
2122
done

bin/download-resources.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
set -e
44

55
s3="https://files.planning.data.gov.uk/"
6+
timestamp=`date +%s`
67

78
python3 bin/resources.py |
89
while read collection pipeline resource
@@ -14,7 +15,7 @@ do
1415
if [ ! -f $path ] ; then
1516
mkdir -p $dir
1617
set -x
17-
curl -qsfL $flags "$s3$collection-collection/collection/resource/$resource" > $path
18+
curl -qsfL $flags "$s3$collection-collection/collection/resource/$resource?version=$timestamp" > $path
1819
set +x
1920
fi
2021
done

0 commit comments

Comments
 (0)