geofront.backends.cloudLibcloud-backed implementations

This module provides built-in implementations of Geofront’s some core interfaces through libcloud. Libcloud is “a library for interacting with many of the popular cloud service providers using unified API.”

New in version 0.2.0.

class geofront.backends.cloud.CloudKeyStore(driver: libcloud.compute.base.NodeDriver, key_name_format: str = None) → None

Store public keys into the cloud provider’s key pair service. Note that not all providers support key pair service. For example, Amazon EC2, and Rackspace (Next Gen) support it.

from geofront.backends.cloud import CloudKeyStore
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

driver_cls = get_driver(Provider.EC2)
driver = driver_cls('api key', 'api secret key', region='us-east-1')
KEY_STORE = CloudKeyStore(driver)
Parameters:
DEFAULT_KEY_NAME_FORMAT = '{identity.team_type.__module__}.{identity.team_type.__qualname__} {identity.identifier} {fingerprint}'

(str) The default key_name_format. The type name of team followed by identifier, and then key fingerprint follows e.g. 'geofront.backends.github.GitHubOrganization dahlia 00:11:22:..:ff'.

class geofront.backends.cloud.CloudMasterKeyStore(driver: libcloud.storage.base.StorageDriver, container: libcloud.storage.base.Container, object_name: str) → None

Store the master key into the cloud object storage e.g. AWS S3. It supports more than 20 cloud providers through the efforts of Libcloud.

from geofront.backends.cloud import CloudMasterKeyStore
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

driver_cls = get_driver(Provider.S3)
driver = driver_cls('api key', 'api secret key')
container = driver.get_container(container_name='my-master-key-bucket')
MASTER_KEY_STORE = CloudMasterKeyStore(container)
Parameters:

See also

Object Storage — Libcloud
Storage API allows you to manage cloud object storage and services such as Amazon S3, Rackspace CloudFiles, Google Storage and others.
class geofront.backends.cloud.CloudMasterPublicKeyStore(driver: libcloud.compute.base.NodeDriver, key_pair_name: str, master_key_store: geofront.masterkey.MasterKeyStore) → None

It doesn’t store the whole master key, but stores only public part of the master key into cloud provider’s key pair registry. So it requires the actual master_key_store to store the whole master key which is not only public part but also private part.

It helps to create compute instances (e.g. Amazon EC2) that are already colonized.

Parameters:

New in version 0.2.0.

class geofront.backends.cloud.CloudRemoteSet(driver: libcloud.compute.base.NodeDriver, user: str = 'ec2-user', port: int = 22, alias_namer: typing.Callable[[libcloud.compute.base.Node], str] = <function CloudRemoteSet.<lambda>>) → None

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

from geofront.backends.cloud import CloudRemoteSet
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

driver_cls = get_driver(Provider.EC2)
driver = driver_cls('access id', 'secret key', region='us-east-1')
REMOTE_SET = CloudRemoteSet(driver)

If the given driver supports metadata feature (for example, AWS EC2, Google Compute Engine, and OpenStack support it) the resulted Remote objects will fill their metadata as well.

Parameters:
  • 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 (int) – the port number to ssh. the default is 22 which is the default ssh port
  • alias_namer – A function to name an alias for the given node. Node.name is used by default.

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.

New in version 0.4.0.

Changed in version 0.2.0: It fills metadata of the resulted Remote objects if the driver supports.