* fix: restoring site breaks when checking backup version
The `backup_version` variable exists if and only if the `if match` branch executes, but it is used in a condition in a scope where it may not exist. Changing the variable to `match` leads to correct behaviour.
* fix: restoring site breaks when checking backup version
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
* fix: version check when restoring site should be done from `match` scope
* chore: add a `return None` for better readability
No functional difference, just easier to understand/read the code.
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
---------
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Co-authored-by: Akhil Narang <me@akhilnarang.dev>
Don't raise exceptions where a simple print() will suffice
Print exception before prompting for rollback
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Our version detection code is relatively simple, so we shouldn't have any exceptions arising there
Just check for a None return value to decide whether we should use the older logic
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
Use `zgrep` to check for table name match where required
Also use a table that's at the top of the dump files (`__Auth`)
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
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.
This has been done because the mysql command issues a deprecation warning now
mysql: Deprecated program name. It will be removed in a future release, use '/usr/bin/mariadb' instead
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
When you reinstall app forcefully all dependencies will also get
forcefully reinstalled. This IMO isn't required in most cases and can
even be breaking.
Anyway if required those apps can be manually force installed.
This avoids having to manipulate config files in brittle bash
entrypoints that need to react to dynamic service discovery.
This significantly improves the operability of various bench sites.
This isn't working because it uses update_site_config command which
attemts to find site_dir to create a lock which doesn't work when site
isn't init-ed.