gerald1248 / openshift-backup

nightly project backups for clusters
MIT License
9 stars 7 forks source link

syntax errors in shell script project_export.sh #7

Closed b2cc closed 6 years ago

b2cc commented 6 years ago

The shell script project_export.sh which comes with the docker image "gerald1248/openshift-backup" produces the following error during execution (once for every project it loops through):

bash-4.2$ openshift-backup
Processing 'default'
/usr/bin/project_export.sh: project_export.sh: line 135: syntax error near unexpected token `!'
...
Exporting 'serviceaccounts' resources to default/serviceaccounts.json
/usr/bin/project_export.sh: line 501: ${BACKUP_SECRETS}: command not found

The line 135 reads: if jq '.spec.triggers[].type' "${PROJECT}/dc_${dc}.json" | ! grep -q "ImageChange"; then

I suspect there is a pipe missing. If it's changed to:

if jq '.spec.triggers[].type' "${PROJECT}/dc_${dc}.json" || ! grep -q "ImageChange"; then

it seems to work. Not sure about what's going on on line 501 while exporting secrets though.

gerald1248 commented 6 years ago

Thanks & apologies for errors, will fix ASAP.

b2cc commented 6 years ago

thanks for responding! just wanted to add some suggestions I noticed while testing the backups:

thanks for your support and consideration!

gerald1248 commented 6 years ago

@b2cc thanks again for alerting me to this problem. There were two issues:

Issue is ready for re-testing.

gerald1248 commented 6 years ago

PS I forgot to mention a third issue with backward compatibility. On my 3.9 cluster the RBAC apiVersion led to errors. PPS Thanks for the suggestions re limitrange and datestamp. Will fold these in shortly.

b2cc commented 6 years ago

@gerald1248: our comments just overlapped... thanks for picking those up, will test shortly and respond. PS: I just noticed the missing BACKUP_SECRETS variable while browsing through the dc. Must have escaped me yesterday somehow, sorry for that.

gerald1248 commented 6 years ago

Have adjusted limits and datestamp. Happy to fine-tune if not quite right.

b2cc commented 6 years ago

Seems to work as described/expected now. I just re-setup the backup project and let it do backups every 10 minutes, no errors so far. I guess this can be closed now. thanks again for your support and the quick fix!

gerald1248 commented 6 years ago

Thanks for re-testing!