core.cli.commands

Attributes

cli

Classes

SmsEventHandler

Matches given patterns with file paths associated with occurring events.

EnhancedInteractiveConsole

Wraps the InteractiveConsole with some basic shell features:

Functions

delete(→ Callable[[CoreRequest, Framework], None])

Deletes a single instance matching the selector.

sendmail(→ None)

Sends mail from a specific mail queue.

sendsms(→ Callable[[CoreRequest, Framework], None])

Sends the SMS in the smsdir for a given instance.

sms_spooler(→ None)

Continuously spools the SMS in the smsdir for all instances using

transfer(→ None)

Transfers the database and all files from a server running a

upgrade(→ tuple[Callable[..., Any], Ellipsis])

Upgrades all application instances of the given namespace(s).

shell(→ Callable[[CoreRequest, Framework], None])

Enters an interactive shell.

Module Contents

core.cli.commands.cli[source]
core.cli.commands.delete(group_context: onegov.core.cli.core.GroupContext) Callable[[CoreRequest, Framework], None][source]

Deletes a single instance matching the selector.

Selectors matching multiple organisations are disabled for saftey reasons.

core.cli.commands.sendmail(group_context: onegov.core.cli.core.GroupContext, queue: str, limit: int) None[source]

Sends mail from a specific mail queue.

core.cli.commands.sendsms(group_context: onegov.core.cli.core.GroupContext) Callable[[CoreRequest, Framework], None][source]

Sends the SMS in the smsdir for a given instance.

For example:

onegov-core --select '/onegov_town6/meggen' sendsms
class core.cli.commands.SmsEventHandler(queue_processors: list[onegov.core.sms_processor.SmsQueueProcessor])[source]

Bases: watchdog.events.PatternMatchingEventHandler

Matches given patterns with file paths associated with occurring events. Uses pathlib’s PurePath.match() method. patterns and ignore_patterns are expected to be a list of strings.

queue_processors[source]
on_moved(event: watchdog.events.FileSystemEvent) None[source]

Called when a file or a directory is moved or renamed.

Parameters:

event (DirMovedEvent or FileMovedEvent) – Event representing file/directory movement.

on_created(event: watchdog.events.FileSystemEvent) None[source]

Called when a file or directory is created.

Parameters:

event (DirCreatedEvent or FileCreatedEvent) – Event representing file/directory creation.

core.cli.commands.sms_spooler(group_context: onegov.core.cli.core.GroupContext) None[source]

Continuously spools the SMS in the smsdir for all instances using a watchdog that monitors the smsdir for newly created files.

For example:

onegov-core sms-spooler
core.cli.commands.transfer(group_context: onegov.core.cli.core.GroupContext, server: str, remote_config: str, confirm: bool, no_filestorage: bool, no_database: bool, transfer_schema: str | None, add_admins: bool, delta: bool) None[source]

Transfers the database and all files from a server running a onegov-cloud application and installs them locally, overwriting the local data!

This command expects to have access to the remote server via ssh (no password) and to be run sudo without password. If this is too scary for you, feel free to write something saner.

Only namespaces which are present locally and remotely are considered.

So if you have a ‘cities’ namespace locally and a ‘towns’ namespace on the remote, nothing will happen.

It’s also possible to transfer only a given schema, e.g. /town6/govikon or /town6/*. But beware, global files are copied in any case!

WARNING: This may delete local content!

core.cli.commands.upgrade(group_context: onegov.core.cli.core.GroupContext, dry_run: bool) tuple[Callable[..., Any], Ellipsis][source]

Upgrades all application instances of the given namespace(s).

class core.cli.commands.EnhancedInteractiveConsole(locals: dict[str, Any] | None = None)[source]

Bases: code.InteractiveConsole

Wraps the InteractiveConsole with some basic shell features:

  • horizontal movement (e.g. arrow keys)

  • history (e.g. up and down keys)

  • very basic tab completion

init_completer() None[source]
core.cli.commands.shell() Callable[[CoreRequest, Framework], None][source]

Enters an interactive shell.