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(group_context) → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.Framework], None]

Deletes a single instance matching the selector.

sendmail(group_context, queue, limit) → None

Sends mail from a specific mail queue.

sendsms(group_context) → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.Framework], None]

Sends the SMS in the smsdir for a given instance.

sms_spooler(group_context) → None

Continuously spools the SMS in the smsdir for all instances using

transfer(group_context, server, remote_config, ...) → None

Transfers the database and all files from a server running a

upgrade(group_context, dry_run) → tuple[collections.abc.Callable[..., Any], ...]

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

shell() → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.Framework], None]

Enters an interactive shell.

Module Contents

core.cli.commands.cli[source]
core.cli.commands.delete(group_context: onegov.core.cli.core.GroupContext) → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.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) → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.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.full_match() method. patterns and ignore_patterns are expected to be a list of strings following standard glob syntax.

Patterns follow standard glob semantics where * matches any characters, ? matches a single character, and [...] denotes a character class. To match literal special characters like [, use standard glob escapes such as [[] or glob.escape().

Parameters:
  • patterns – Patterns to allow matching event paths.

  • ignore_patterns – Patterns to ignore matching event paths.

  • ignore_directories – True if directories should be ignored; False otherwise.

  • case_sensitive – True if path names should be matched sensitive to case; False otherwise.

  • ignore_policy (IgnorePolicy | str) – Policy for multi-path events (e.g. moves/renames). Defaults to ANY.

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

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

Parameters:

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

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

Called when a file or directory is created.

Parameters:

event (watchdog.events.DirCreatedEvent or watchdog.events.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[collections.abc.Callable[..., Any], ...][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() → collections.abc.Callable[[onegov.core.request.CoreRequest, onegov.core.framework.Framework], None][source]

Enters an interactive shell.