Commit graph

278 commits

Author SHA1 Message Date
Akhil Narang
ea1c8910e6
feat: delete failed backups
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-04-10 12:57:16 +05:30
Akhil Narang
0d3b2499fc
fix: don't use frappe.flags for mariadb_user_host_login_scope
This gets reset whenever we call `frappe.init()` again

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 16:57:04 +05:30
David
39d4318a27
feat: enable db socket connection 2024-03-29 10:29:50 +01:00
David
6eb1607c0a
refactor: name and explain user host login scope flag for mariadb 2024-03-29 10:26:49 +01:00
Akhil Narang
ee8e2fef8c
refactor(new-site): update rollback prompt
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 12:12:19 +05:30
Akhil Narang
4b2fde1d8f
fix: check if rollback callback is defined
Don't raise exceptions where a simple print() will suffice
Print exception before prompting for rollback

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 12:00:25 +05:30
Akhil Narang
c58e986a87
chore: check whether we're in an interactive session or not
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 12:00:25 +05:30
Akhil Narang
147c0c8b37
feat: initial failed site rollback implementation
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-29 12:00:25 +05:30
Akhil Narang
a01085ddcc
fix(partial-restore): add in missing whitespace between sentences (#25393)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-03-13 10:54:59 +00:00
Akhil Narang
3f1e19de85
refactor(treewide): enable RUF rules
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-21 16:20:28 +05:30
Faris Ansari
6d26b0bd9a fix: check if user exists in browse command 2024-02-18 14:51:45 +05:30
Akhil Narang
26ae0f3460
fix: ruff fixes
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-02-07 17:04:31 +05:30
Ankush Menat
de9ac89748 style: re-format with ruff 2024-02-05 18:53:33 +05:30
Ankush Menat
d53a0ae45e
Revert "fix(module_map): only include apps installed on the site - not everything on the bench" (#24605) 2024-01-30 07:39:09 +00:00
Akhil Narang
db72dd37aa
refactor: fallback to all apps on bench when site isn't ready yet
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-29 17:31:52 +05:30
David Arnold
d87092936f
chore: simplify frappe.connect & require explicit site initialization 2024-01-17 16:53:30 +01:00
Ankush Menat
307da3097f
Merge pull request #23329 from akhilnarang/allow-setting-db-username
refactor: allow setting a db user name different from the database name
2024-01-16 17:46:03 +05:30
Akhil Narang
265c0b0e01
fix(drop-site): set db root credentials in frappe.flags like how new-site is done
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
1e6eeba9b7
fix: add in missing logic, add in a test for creating a site with a specific user
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
Akhil Narang
c721fcf8c4
refactor: allow setting a db user name different from the database name
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-16 12:35:01 +05:30
David Arnold
4e7676806f
fix: undue error printing 2024-01-14 17:33:12 +01:00
Akhil Narang
232da65e4c
fix(restore): check backup directory and bench directory if we can't find the file
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-01-05 15:42:31 +05:30
Ankush Menat
8a7707e3fa
fix(DX): store tracebacks with context (#24059) 2024-01-01 07:16:47 +00:00
Ankush Menat
78cd62fec0
chore: faster total rows estimation (#24058) 2024-01-01 07:09:36 +00:00
Akhil Narang
7f433b84af
feat: allow creating a backup with the older metadata style
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
a06e402f38
refactor: use a function with context manager for backup decryption
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
148efbc3ed
refactor(restore): adjust downgrade check
First actually check whether its a downgrade, then check for the force flag

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
50d21677b8
chore: drop use of magic library, run file command directly
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
2b7c74dd5e
feat(restore): handle encrypted backups better
Determine the mimetype based on the file contents instead of waiting for an exception
Cleaner + no need of duplicate code

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:09:08 +05:30
Akhil Narang
3b0f6de883
perf: don't extract backup files unless required
Read from the gzipped file wherever possible

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-12-26 11:08:48 +05:30
Ankush Menat
ca33deae12 fix: cast SQL booleans to python 2023-12-17 12:07:14 +05:30
Ankush Menat
40e48c9ac4
feat: describe-database-table to get stats about a table (#23813)
* feat: `describe-database-table` to get stats about a table

This provides description of table, indexes, total row count in machine
parseable format.

Towards https://github.com/frappe/press/issues/1265

* Update test_commands.py
2023-12-15 17:53:11 +05:30
Ankush Menat
b7c2989823
feat: add-database-index command to add and persist custom indexes (#23787) 2023-12-14 15:16:49 +00:00
barredterra
c35476256f refactor: simplify conditional logic
Command: `sourcery review --fix --enable de-morgan .`
2023-12-05 11:14:41 +01:00
Akhil Narang
d21c7730da
fix(commands/site): the old logic did rely on 0 evaluting to false
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 16:34:28 +05:30
Akhil Narang
fbc88a4d24
refactor(treewide): code cleanup
Drop redundant bool conversion

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2023-11-23 13:57:51 +05:30
David Arnold
890becda33
fix: typo 2023-11-09 19:22:17 +01:00
David Arnold
b2f9ff09aa
feat(db): boostrap only option if resource management is exogenous
The database resource management including privileges granting can be
done by external secops. It can be undesirable to grant the grant option
to the framework user.

This commit implements the possibility to remove user resource
management from frappe entirely and only boostrap the database with its
target user.
2023-11-09 17:11:39 +01:00
saif
8b83e051d0 refactor: Improve list_apps function readability and maintainability.
- Improve variable naming and reduce redundancy.
- Reorganize and simplify code structure.
2023-09-17 11:41:13 +03:00
0xsaif
aa7ee1c6b9
refactor: force ipv4 localhost (#22394)
* reafctor: force ipv4 localhost

Replacing "localhost" with "127.0.0.1" in the codebase; sometimes the name localhost force-resolves to ipv6

* revert: leave localhost usage in oauth tests

Change not required.

---------

Co-authored-by: Ankush Menat <ankush@frappe.io>
2023-09-13 16:23:23 +05:30
Ankush Menat
970a740164
revert: #22308 (#22389)
* Revert "chore: move function to correct file"

This reverts commit ebfdfa283b.

* Revert "refactor!: merge get_site_url into get_url (#22308)"

This reverts commit 2001bc278f.
2023-09-13 14:34:52 +05:30
David Arnold
2001bc278f
refactor!: merge get_site_url into get_url (#22308)
* chore: merge get_site_url into get_url

* fix: keep alias with deprecation notice
2023-09-11 15:09:05 +05:30
gavin
ddc4e4813a
Merge pull request #22253 from gavindsouza/trim_database-fix
fix(trim-db): Dont show confirm dialog on dry run
2023-08-31 11:26:38 +05:30
Gavin D'souza
d4fe4c7e02 fix(trim-db): Dont show confirm dialog on dry run 2023-08-30 13:04:33 +00:00
David Arnold
8dabd2bae6
refactor: make the app source accessor explicit
The parent folder of a python module (inside `./site-packages`) can be
`./lib`. Separate code paths that depend on the app source into its own
getter so that patching that function becomes easier in those cases
where the python module is not served from the source checkout.
2023-08-20 01:11:05 +02:00
Ankush Menat
441495b561
refactor!: Drop support for currentsite.txt (#21536)
* refactor!: Drop currentsite.txt

- `bench use` will continue to work.
- Instead of txt file use common_site_config to set default site using `default_site` key.
- `FRAPPE_SITE` environment variable also works

* fix(DX): warn if non-empty currentsite.txt is present
2023-06-30 17:57:40 +05:30
Ankush Menat
8a37d6d278
perf: reduce memory usage of background processes (#21467)
* perf: defer translation.py imports

This indirectly imports babel which isn't really required most of the
time.

* perf: defer gzip import

* perf: move validate_and_sanitize_search_inputs

This causes all sorts of indirect imports and increases memory usage

* perf: defer requests module imports

* perf: defer system settings import

* perf: defer LOG_DOCTYPES import

Causes many indirect imports

* perf: defer update_site_config

* perf: defer notifications import

* perf: remove unused import

* perf: defer safe exec import

* test: memory usage overhead
2023-06-23 12:51:45 +05:30
Gavin D'souza
4ccabc4e21 fix(new-site): Pass sql archive as --source-sql
Add --source-sql option as an alias to --source_sql
2023-02-09 15:32:06 +05:30
Ankush Menat
11f7e41994 fix: Show local variables in tracebacks during migration 2023-02-03 16:01:30 +05:30
phot0n
16eeedc28c feat(minor): add use-default-authtoken to ngrok command 2023-01-02 16:27:38 +05:30