No description
Find a file
Andy Zhu fcdb923d2e
fix: Missing bucket name check (#9546)
* fix: missing bucket name check when user make changes on s3 backup setting

Problem: If the user changed the backup limit, then press save. The validate function will give an error message that the bucket name already exists. It would be inconvenient for the user to use a different bucket name to save any changes.

So I implemented a flag ''bucket_name_exist'' to indicate if the bucket name exists, if not, then go to the flow of trying to create a bucket.

* fix: extra line removed

* fix: Use head_bucket Boto3 API 

1. Head_bucket will return 200 Ok if the bucket exists and you have permission to access it.
2. Error code 403 Forbidden, Error code 404 Not Found.
3. Use bucket_name_exist to check if need to create bucket.

Thanks @Mangesh-Khairnar suggestions.
Reference: 
1. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.head_bucket
2. https://boto3.amazonaws.com/v1/documentation/api/latest/guide/migrations3.html#accessing-a-bucket

Further improvements:
1. Use 'GET' Requestion to check if the Access Key ID and Secret Access Key is valid (Because AWS tier has 20,000 GET requests while only 2,000 LIST requests)
2. Edge case on Error prompts when head_bucket returns an error code other than '403' or '404'.

* fix: add an extra line to align with original code style

* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py

Co-Authored-By: Chinmay Pai <chinmaydpai@gmail.com>

* fix: remove the flag and redundant exception

When we got a 404 error, we can just create the bucket as 1. The bucket name does not exist in the current bucket. 2. we have permission to access the bucket.

* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py

Co-Authored-By: Himanshu <himanshuwarekar@yahoo.com>

* Update frappe/integrations/doctype/s3_backup_settings/s3_backup_settings.py

Co-Authored-By: Chinmay Pai <chinmaydpai@gmail.com>

* fix: missing handling the error code '400' - 'Bad Request'

* fix: applied with DeepSource analysis

1. Lines too long
2. Doc Lines too long
3. Expected 2 blank lines between class and method
4. Unused variable removed

Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
Co-authored-by: Himanshu <himanshuwarekar@yahoo.com>
2020-03-13 13:06:36 +05:30
.github chore: Add github action to automate backporting (#9456) 2020-02-18 14:49:06 +05:30
.travis fix: conflicts 2019-11-13 11:23:30 +05:30
ci add my_config patch to travis 2014-10-12 18:54:44 +05:30
cypress fix(dashboard chart): Hide filters if hide_actions is set (#9679) 2020-03-13 11:57:34 +05:30
frappe fix: Missing bucket name check (#9546) 2020-03-13 13:06:36 +05:30
rollup feat: Run build command for all apps (#9589) 2020-03-02 11:24:05 +05:30
.codacy.yml fix(minor): rename "queue" to "frequency" 2019-11-07 12:14:09 +05:30
.deepsource.toml chore: Add Deepsource 2019-10-26 18:28:11 +05:30
.eslintignore Added files in .eslintignore, updated globals 2017-06-02 15:00:15 +05:30
.eslintrc chore: Add strip_number_groups to eslint globals 2019-10-20 09:37:49 +05:30
.gitignore fix: Undo gitignore entry 2019-02-26 16:54:55 +05:30
.mergify.yml chore(mergify): configuration update (#9682) 2020-03-12 20:07:27 +05:30
.pylintrc reactor(scheduler): created "Scheduler Job Type" and cleaned up scheduler 2019-11-07 12:14:09 +05:30
.snyk chore(snyk): Ignore PYYAML from snyk check 2020-03-02 23:33:49 +05:30
.travis.yml Merge branch 'develop' into offline-erpnext 2020-01-24 09:23:15 +05:30
attributions.md Non Pour Accent! (#5427) 2018-04-10 22:53:42 -08:00
bandit.yml fix(tests): tests and linting 2019-02-13 16:50:34 +05:30
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2017-09-12 09:14:34 +05:30
cypress.json fix(ui-tests): Pick admin password from config (#7842) 2019-07-05 12:24:07 +05:30
generate_bootstrap_theme.js fix: Common scss options for theme generator and rollup scss 2019-02-19 18:04:56 +05:30
hooks.md Non Pour Accent! (#5427) 2018-04-10 22:53:42 -08:00
LICENSE Update LICENSE 2018-04-12 17:27:20 +05:30
Makefile [NEW] Makefile to clean cache without restart 2018-03-08 15:18:32 +05:30
node_utils.js feat(build): Log build errors in browser console (#5932) 2018-08-07 14:42:39 +05:30
package.json chore(deps): bump snyk from 1.297.2 to 1.297.4 (#9633) 2020-03-04 09:10:52 +05:30
README.md fix: new frappe framework logo 2019-01-29 17:39:17 +05:30
requirements.txt chore(deps): bump urllib3 from 1.25.7 to 1.25.8 (#9624) 2020-03-03 07:45:57 +05:30
SECURITY.md chore: updated Security policy and issue template 2019-10-12 12:06:36 +05:30
setup.py fix(unicode): Import unicode_literals in every file (#6805) 2019-01-25 11:56:27 +05:30
socketio.js frappe: refactor async to realtime (#6015) 2018-08-28 15:31:20 +05:30
yarn.lock chore(deps): bump snyk from 1.297.2 to 1.297.4 (#9633) 2020-03-04 09:10:52 +05:30

Full-stack web application framework that uses Python and MariaDB on the server side and a tightly integrated client side library. Built for ERPNext

Table of Contents

Installation

Install via Frappe Bench

Contributing

  1. Pull Request Requirements
  2. Translations

Website

For details and documentation, see the website https://frappe.io

License

This repository has been released under the MIT License.