awslabs / rds-snapshot-tool

The Snapshot Tool for Amazon RDS automates the task of creating manual snapshots, copying them into a different account and a different region, and deleting them after a specified number of days
Apache License 2.0
341 stars 145 forks source link

Wrong Makefile rules #15

Closed aleksey-alt closed 6 years ago

aleksey-alt commented 6 years ago

On Ubuntu 18.04 LTS I used master branch for creating .zip files and uploading them to my S3 bucket.

From the README:

Type make at the command line. It will call zip to make the zip files, and then it will call aws s3 cp to copy the zip files to the bucket you named.

Indeed, it calls zip. But before creating zip files it builds dependencies for this target, i.e. tries to upload unzipped folder to S3 bucket.

Here is my fix:

-# if you define "._foo.zip" as a file on this line, then it will look for
+# if you define "._foo" as a file on this line, then it will look for
# a folder called foo, copy the standard files into it, and then make foo.zip.
-all:   ._copy_snapshots_dest_rds.zip \
-       ._copy_snapshots_no_x_account_rds.zip \
-       ._delete_old_snapshots_dest_rds.zip \
-       ._delete_old_snapshots_no_x_account_rds.zip \
-       ._delete_old_snapshots_rds.zip \
-       ._share_snapshots_rds.zip \
-       ._take_snapshots_rds.zip
+all:   ._copy_snapshots_dest_rds \
+       ._copy_snapshots_no_x_account_rds \
+       ._delete_old_snapshots_dest_rds \
+       ._delete_old_snapshots_no_x_account_rds \
+       ._delete_old_snapshots_rds \
+       ._share_snapshots_rds \
+       ._take_snapshots_rds

 clean:
        rm -f ._*

-._%: %
+._%: %.zip
        "$(AWSCMD)" $(AWSARGS) s3 cp "$<" "s3://$(S3DEST)" \
                --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
        cp "$<" "$@"
pacohope commented 6 years ago

Yup. Sorry. Kinda embarrassed I got that logic inverted.

mrcoronel commented 6 years ago

17