Add safeguard against accidental overwriting of a previously created project on S3.
Implementation
Some initial thoughts on implementation
Create S3 integration code
Create lib-level code and related data:s3:integrate command that:
- Generates a unique hash
- Checks if
bucket@s3_path/.project_id exists
- If exists, errors out
- If not exists:
- Stores hash as
project_id setting in config/datakit-data.json
- Creates
bucket@s3_path/.project_id with the unique hash
Initialization
- Triggers
data:s3:integrate
- If
bucket@s3_path/.project_id exists:
- Store
config/datakit-data.json without the project_id setting
- Warn user that the
s3_path already exists, that they should update the setting and run data:s3:integrate
- If the hidden file does not exist, proceed with the actions of
data:s3:integrate:
- Stores hash as
project_id setting in config/datakit-data.json
- Creates
bucket@s3_path/.project_id with the unique hash
Push/Pull
Update data push and pull to always run a preliminary check of project_id from local config against bucket@s3_path/.project_id
- If hashes match, proceed with operation
- If hashes don't match, exit with a warning
Add safeguard against accidental overwriting of a previously created project on S3.
Implementation
Some initial thoughts on implementation
Create S3 integration code
Create lib-level code and related
data:s3:integratecommand that:bucket@s3_path/.project_idexistsproject_idsetting inconfig/datakit-data.jsonbucket@s3_path/.project_idwith the unique hashInitialization
data:s3:integratebucket@s3_path/.project_idexists:config/datakit-data.jsonwithout theproject_idsettings3_pathalready exists, that they should update the setting and rundata:s3:integratedata:s3:integrate:project_idsetting inconfig/datakit-data.jsonbucket@s3_path/.project_idwith the unique hashPush/Pull
Update data
pushandpullto always run a preliminary check ofproject_idfrom local config againstbucket@s3_path/.project_id