Fix download-boxes.sh if no boxes are present (#106)
In case of grep not matching any line, it would return an error code and thus stop the script. This patch sets "present_boxes" to an empty value in case any of the commands fail.
This commit is contained in:
parent
57e528832b
commit
d5d02280c1
7
.github/download-boxes.sh
vendored
7
.github/download-boxes.sh
vendored
@ -17,11 +17,14 @@ all_boxes=$(cat "${GIT_ROOT}"/molecule/*/molecule.yml |
|
|||||||
uniq)
|
uniq)
|
||||||
|
|
||||||
# Read the boxes that are currently present on the system (for the current provider)
|
# Read the boxes that are currently present on the system (for the current provider)
|
||||||
present_boxes=$(vagrant box list |
|
present_boxes=$(
|
||||||
|
(vagrant box list |
|
||||||
grep "${PROVIDER}" | # Filter by boxes available for the current provider
|
grep "${PROVIDER}" | # Filter by boxes available for the current provider
|
||||||
awk '{print $1;}' | # The box name is the first word in each line
|
awk '{print $1;}' | # The box name is the first word in each line
|
||||||
sort |
|
sort |
|
||||||
uniq)
|
uniq) ||
|
||||||
|
echo "" # In case any of these commands fails, just use an empty list
|
||||||
|
)
|
||||||
|
|
||||||
# The boxes that we need to download are the ones present in $all_boxes, but not $present_boxes.
|
# The boxes that we need to download are the ones present in $all_boxes, but not $present_boxes.
|
||||||
download_boxes=$(comm -2 -3 <(echo "${all_boxes}") <(echo "${present_boxes}"))
|
download_boxes=$(comm -2 -3 <(echo "${all_boxes}") <(echo "${present_boxes}"))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user