* 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>
* refactor: remove print statement
* fix: hide filters if hide_actions is set
* refactor (cyoress): wait after clearing field
Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com>
* fix: fallback for default desk page
* fix: return if reference name does not exist
* refactor: rename to Query Report
* refactor: codacy linting fixes
* refactor: null check for data in workspace
* feat: enable cypress recording
* chore: codacy linting fixes
* refactor: don't set route explicitly
* fix (cypress): wait for request to be complete in grid pagination test
* fix (cypress): explicitly return async calls
* refactor: visit new_form directly
* refactor: skip some scripts for ui tests
* Revert "refactor: skip some scripts for ui tests"
This reverts commit 1e46e3cd5361c2910d25efb244774d153511af53.
currently, since we return possible actions as dict_values, pickle fails
to work with it with the following error:
```python-traceback
Traceback (most recent call last):
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 99, in execute_job
method(**kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/workflow/doctype/workflow_action/workflow_action.py", line 210, in send_workflow_action_email
enqueue(method=frappe.sendmail, queue='short', **email_args)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/background_jobs.py", line 69, in enqueue
kwargs=queue_args)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py", line 258, in enqueue_call
job = self.enqueue_job(job, at_front=at_front)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/queue.py", line 324, in enqueue_job
job.save(pipeline=pipe)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/job.py", line 516, in save
connection.hmset(key, self.to_dict(include_meta=include_meta))
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/job.py", line 469, in to_dict
obj['data'] = zlib.compress(self.data)
File "/home/frappe/frappe-bench/env/lib/python3.6/site-packages/rq/job.py", line 234, in data
self._data = dumps(job_tuple)
TypeError: can't pickle dict_values objects
```
passing the values as a list instead works fine.
Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>