1
1
# Copyright 2012 Canonical Ltd. This software is licensed under the
2
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Juju machine provider for MaaS."""
4
"""Juju machine provider for MAAS."""
6
6
from juju.machine import ProviderMachine
9
class MaaSMachine(ProviderMachine):
10
"""MaaS-specific provider machine implementation."""
9
class MAASMachine(ProviderMachine):
10
"""MAAS-specific provider machine implementation."""
13
13
def from_dict(cls, d):
14
"""Convert a `dict` into a :class:`MaaSMachine`.
14
"""Convert a `dict` into a :class:`MAASMachine`.
16
16
:param dict d: a dict as returned (in a list) by
17
:meth:`juju.providers.maas.maas.MaaSClient.start_node`
18
:rtype: :class:`MaaSMachine`
17
:meth:`juju.providers.maas.maas.MAASClient.start_node`
18
:rtype: :class:`MAASMachine`
20
system_id, hostname = d["system_id"], d["hostname"]
21
return cls(system_id, hostname, hostname)
20
resource_uri, hostname = d["resource_uri"], d["hostname"]
22
instance_id=resource_uri, dns_name=hostname,
23
private_dns_name=hostname)