Compare commits

..

2 Commits

Author SHA1 Message Date
bd0f850d25 Release 2.10.1 2023-07-28 03:21:19 +03:00
5904727da2 do not create application in shell handler
The main reason for having shell handler is to be able to fix if
something (e.g. migrations) goes wrong. In this way we need to reduce
actions inside this wrapper
2023-07-28 03:06:28 +03:00
7 changed files with 4166 additions and 4300 deletions

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 812 KiB

After

Width:  |  Height:  |  Size: 809 KiB

View File

@ -1,4 +1,4 @@
.TH AHRIMAN "1" "2023\-07\-22" "ahriman" "Generated Python Manual"
.TH AHRIMAN "1" "2023\-07\-28" "ahriman" "Generated Python Manual"
.SH NAME
ahriman
.SH SYNOPSIS
@ -733,7 +733,7 @@ path to unix socket used for interprocess communications
.SH COMMAND \fI\,'ahriman service\-shell'\/\fR
usage: ahriman service\-shell [\-h] [code]
drop into python shell while having created application
drop into python shell
.TP
\fBcode\fR

View File

@ -58,9 +58,9 @@ _shtab_ahriman_commands() {
"service-config-validate:validate configuration and print found errors"
"service-key-import:import PGP key from public sources to the repository user"
"service-setup:create initial service configuration, requires root"
"service-shell:drop into python shell while having created application"
"service-shell:drop into python shell"
"setup:create initial service configuration, requires root"
"shell:drop into python shell while having created application"
"shell:drop into python shell"
"sign:(re-)sign packages and repository database according to current settings"
"status:request status of the package"
"status-update:update package status on the status page"

View File

@ -1,7 +1,7 @@
# Maintainer: Evgeniy Alekseev
pkgname='ahriman'
pkgver=2.10.0
pkgver=2.10.1
pkgrel=1
pkgdesc="ArcH linux ReposItory MANager"
arch=('any')

View File

@ -904,8 +904,7 @@ def _set_service_shell_parser(root: SubParserAction) -> argparse.ArgumentParser:
argparse.ArgumentParser: created argument parser
"""
parser = root.add_parser("service-shell", aliases=["shell"], help="invoke python shell",
description="drop into python shell while having created application",
formatter_class=_formatter)
description="drop into python shell", formatter_class=_formatter)
parser.add_argument("code", help="instead of dropping into shell, just execute the specified code", nargs="?")
parser.add_argument("-v", "--verbose", help=argparse.SUPPRESS, action="store_true")
parser.set_defaults(handler=handlers.Shell, lock=None, report=False)

View File

@ -23,7 +23,6 @@ import sys
from pathlib import Path
from ahriman.application.application import Application
from ahriman.application.handlers import Handler
from ahriman.core.configuration import Configuration
from ahriman.core.formatters import StringPrinter
@ -47,14 +46,12 @@ class Shell(Handler):
configuration(Configuration): configuration instance
report(bool): force enable or disable reporting
"""
# pylint: disable=possibly-unused-variable
application = Application(architecture, configuration, report=report)
if args.verbose:
# licensed by https://creativecommons.org/licenses/by-sa/3.0
path = Path(sys.prefix) / "share" / "ahriman" / "templates" / "shell"
StringPrinter(path.read_text(encoding="utf8")).print(verbose=False)
# we only want to pass application instance inside
local_variables = {"architecture": architecture, "configuration": configuration}
if args.code is None:
code.interact(local={"application": application})
code.interact(local=local_variables)
else:
code.InteractiveConsole(locals={"application": application}).runcode(args.code)
code.InteractiveConsole(locals=local_variables).runcode(args.code)

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__version__ = "2.10.0"
__version__ = "2.10.1"