mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[mod] Move this block to have a whole part dedicated to migrations
This commit is contained in:
parent
376cce4f53
commit
bee4fb70fd
1 changed files with 37 additions and 31 deletions
|
@ -970,6 +970,43 @@ def tools_reboot(operation_logger, force=False):
|
||||||
subprocess.check_call(['systemctl', 'reboot'])
|
subprocess.check_call(['systemctl', 'reboot'])
|
||||||
|
|
||||||
|
|
||||||
|
def tools_shell(command=None):
|
||||||
|
"""
|
||||||
|
Launch an (i)python shell in the YunoHost context.
|
||||||
|
|
||||||
|
This is entirely aim for development.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from yunohost.utils.ldap import _get_ldap_interface
|
||||||
|
ldap = _get_ldap_interface()
|
||||||
|
|
||||||
|
if command:
|
||||||
|
exec(command)
|
||||||
|
return
|
||||||
|
|
||||||
|
logger.warn("The \033[1;34mldap\033[0m interface is available in this context")
|
||||||
|
try:
|
||||||
|
from IPython import embed
|
||||||
|
embed()
|
||||||
|
except ImportError:
|
||||||
|
logger.warn("You don't have IPython installed, consider installing it as it is way better than the standard shell.")
|
||||||
|
logger.warn("Falling back on the standard shell.")
|
||||||
|
|
||||||
|
import readline # will allow Up/Down/History in the console
|
||||||
|
readline # to please pyflakes
|
||||||
|
import code
|
||||||
|
vars = globals().copy()
|
||||||
|
vars.update(locals())
|
||||||
|
shell = code.InteractiveConsole(vars)
|
||||||
|
shell.interact()
|
||||||
|
|
||||||
|
|
||||||
|
# ############################################ #
|
||||||
|
# #
|
||||||
|
# Migrations management #
|
||||||
|
# #
|
||||||
|
# ############################################ #
|
||||||
|
|
||||||
def tools_migrations_list(pending=False, done=False):
|
def tools_migrations_list(pending=False, done=False):
|
||||||
"""
|
"""
|
||||||
List existing migrations
|
List existing migrations
|
||||||
|
@ -1155,37 +1192,6 @@ def tools_migrations_state():
|
||||||
return read_json(MIGRATIONS_STATE_PATH)
|
return read_json(MIGRATIONS_STATE_PATH)
|
||||||
|
|
||||||
|
|
||||||
def tools_shell(command=None):
|
|
||||||
"""
|
|
||||||
Launch an (i)python shell in the YunoHost context.
|
|
||||||
|
|
||||||
This is entirely aim for development.
|
|
||||||
"""
|
|
||||||
|
|
||||||
from yunohost.utils.ldap import _get_ldap_interface
|
|
||||||
ldap = _get_ldap_interface()
|
|
||||||
|
|
||||||
if command:
|
|
||||||
exec(command)
|
|
||||||
return
|
|
||||||
|
|
||||||
logger.warn("The \033[1;34mldap\033[0m interface is available in this context")
|
|
||||||
try:
|
|
||||||
from IPython import embed
|
|
||||||
embed()
|
|
||||||
except ImportError:
|
|
||||||
logger.warn("You don't have IPython installed, consider installing it as it is way better than the standard shell.")
|
|
||||||
logger.warn("Falling back on the standard shell.")
|
|
||||||
|
|
||||||
import readline # will allow Up/Down/History in the console
|
|
||||||
readline # to please pyflakes
|
|
||||||
import code
|
|
||||||
vars = globals().copy()
|
|
||||||
vars.update(locals())
|
|
||||||
shell = code.InteractiveConsole(vars)
|
|
||||||
shell.interact()
|
|
||||||
|
|
||||||
|
|
||||||
def _get_migrations_list():
|
def _get_migrations_list():
|
||||||
migrations = []
|
migrations = []
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue