~hazmat/pyjuju/proposed-support

« back to all changes in this revision

Viewing changes to juju/providers/maas/machine.py

  • Committer: kapil.thangavelu at canonical
  • Date: 2012-05-22 22:08:15 UTC
  • mfrom: (484.1.53 trunk)
  • Revision ID: kapil.thangavelu@canonical.com-20120522220815-acyt8m89i9ybe0w1
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
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).
3
3
 
4
 
"""Juju machine provider for MaaS."""
 
4
"""Juju machine provider for MAAS."""
5
5
 
6
6
from juju.machine import ProviderMachine
7
7
 
8
8
 
9
 
class MaaSMachine(ProviderMachine):
10
 
    """MaaS-specific provider machine implementation."""
 
9
class MAASMachine(ProviderMachine):
 
10
    """MAAS-specific provider machine implementation."""
11
11
 
12
12
    @classmethod
13
13
    def from_dict(cls, d):
14
 
        """Convert a `dict` into a :class:`MaaSMachine`.
 
14
        """Convert a `dict` into a :class:`MAASMachine`.
15
15
 
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`
19
19
        """
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"]
 
21
        return cls(
 
22
            instance_id=resource_uri, dns_name=hostname,
 
23
            private_dns_name=hostname)