geofront.remote — Remote sets

Every remote set is represented as a mapping (which is immutable, or mutable) of alias str to Remote object e.g.:

    'web-1': Remote('ubuntu', ''),
    'web-2': Remote('ubuntu', ''),
    'web-3': Remote('ubuntu', ''),
    'worker-1': Remote('ubuntu', ''),
    'worker-2': Remote('ubuntu', ''),
    'db-1': Remote('ubuntu', ''),
    'db-2': Remote('ubuntu', '')

However, in the age of the cloud, you don’t have to manage the remote set since the most of cloud providers offer their API to list provisioned remote nodes.

This module provides CloudRemoteSet, a subtype of, that proxies to the list dynamically made by cloud providers.

class geofront.remote.AuthorizedKeyList(sftp_client: paramiko.sftp_client.SFTPClient)

List-like abstraction for remote authorized_keys.

Note that the contents are all lazily evaluated, so in order to pretend heavy duplicate communications over SFTP use list() to eagerly evaluate e.g.:

lazy_list = AuthorizedKeyList(sftp_client)
eager_list = list(lazy_list)
# ... some modifications on eager_list ...
lazy_list[:] = eager_list
Parameters:sftp_client (paramiko.sftp_client.SFTPClient) – the remote sftp connection to access authorized_keys
FILE_PATH = '.ssh/authorized_keys'

(str) The path of authorized_keys file.

class geofront.remote.CloudRemoteSet(driver: libcloud.compute.base.NodeDriver, user: str='ec2-user', port: numbers.Integral=22)

Libcloud-backed remote set. It supports more than 20 cloud providers through the efforts of Libcloud.

from geofront.remote import CloudRemoteSet
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

driver_cls = get_driver(Provider.EC2_US_WEST)
driver = driver_cls('access id', 'secret key')
REMOTE_SET = CloudRemoteSet(driver)
  • driver (libcloud.compute.base.NodeDriver) – libcloud compute driver
  • user (str) – the username to ssh. the default is 'ec2-user' which is the default user of amazon linux ami
  • port (numbers.Integral) – the port number to ssh. the default is 22 which is the default ssh port

See also

Compute — Libcloud
The compute component of libcloud allows you to manage cloud and virtual servers offered by different providers, more than 20 in total.
class geofront.remote.Remote(user: str, host: str, port: numbers.Integral=22)

Remote node to SSH.

  • user (str) – the username to ssh
  • host (str) – the host to access
  • port (numbers.Integral) – the port number to ssh. the default is 22 which is the default ssh port
host = None

(Address) The hostname to access.

port = None

(numbers.Integral) The port number to SSH.

user = None

(str) The username to SSH.

geofront.remote.authorize(public_keys:, master_key: paramiko.pkey.PKey, remote: geofront.remote.Remote, timeout: datetime.timedelta) → datetime.datetime

Make an one-time authorization to the remote, and then revokes it when timeout reaches soon.


the expiration time

Return type: