Wilfred API

Warning

The API is currently not stable and should not be used.

wilfred.api.servers

class wilfred.api.servers.Servers
__init__(docker_client: docker.client.DockerClient, configuration: dict, images: wilfred.api.images.Images)

Initiates wilfred.api.Servers, method for controlling servers

Parameters
  • docker_client (docker.DockerClient) – DockerClient object from Docker module

  • configuration (dict) – Dictionary of Wilfred config

  • images (Images) – wilfred.api.Images object

all(cpu_load=False, memory_usage=False)

Returns data of all servers

Parameters
  • cpu_load (bool) – Include the CPU load of the container. Defaults to None if server is not running.

  • memory_usage (bool) – Include RAM usage of the container. Defaults to None if server is not running.

remove(server: wilfred.database.Server)

Removes specified server

Parameters

server (wilfred.database.Server) – Server database object

console(server: wilfred.database.Server, disable_user_input=False)

Enters server console

Parameters
  • server (wilfred.database.Server) – Server database object

  • disable_user_input (bool) – Blocks user input if True. By default this is False.

Raises

ServerNotRunning – If server is not running

install(server: wilfred.database.Server, skip_wait=False, spinner=None)

Performs installation

Parameters
  • server (wilfred.database.Server) – Server database object

  • skip_wait (bool) – Doesn’t stall while waiting for server installation to complete if True.

  • spinner (Halo) – If Halo spinner object is defined, will then write and perform actions to it.

Raises

WriteError – If not able to create directory or write to it

kill(server)

Kills server container

Parameters

server (wilfred.database.Server) – Server database object

Raises

ServerNotRunning – If server is not running

command(server, command)

Sends command to server console

Parameters
  • server (wilfred.database.Server) – Server database object

  • command (str) – The command to send to the stdin of the server

Raises

ServerNotRunning – If server is not running

sync()

Performs sync, checks for state of containers

rename(server, name)

Renames server and moves server folder

Parameters
  • server (wilfred.database.Server) – Server database object

  • name (str) – New name of the server

Raises
  • WilfredException – If server is running

  • WriteError – If not able to move folder

wilfred.api.images

class wilfred.api.images.Images
download()

Downloads default Wilfred Images from GitHub

data_strip_non_ui()

Returns a list of all images with only the variables important to the user shown

Returns

Returns list of images.

Raises

wilfred.api.images.ImagesNotRead

get_image(uid: str)

Retrieves image configuration for specific image

Returns

Returns dict of image configuration.

Raises

wilfred.api.images.ImagesNotRead

read_images()

Reads and parses all images on system

Returns

Returns True if success.

Raises
  • wilfred.api.images.ImagesNotPresent

  • wilfred.api.errors.ReadError

  • wilfred.api.images.ImageAPIMismatch