/usr/lib/python2.7/dist-packages/maasserver/rpc/__init__.py is in python-django-maas 1.5+bzr2252-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # Copyright 2014 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Region Controller RPC."""
from __future__ import (
absolute_import,
print_function,
unicode_literals,
)
str = None
__metaclass__ = type
__all__ = [
"getClientFor",
"getAllClients",
]
from maasserver import eventloop
from provisioningserver.rpc import exceptions
from provisioningserver.utils import asynchronous
@asynchronous
def getClientFor(uuid):
"""getClientFor(uuid)
Get a client with which to make RPCs to the specified cluster.
:raises: :py:class:`~.exceptions.NoConnectionsAvailable` when there
are no open connections to the specified cluster controller.
"""
try:
service = eventloop.services.getServiceNamed("rpc")
except KeyError:
raise exceptions.NoConnectionsAvailable()
else:
return service.getClientFor(uuid)
@asynchronous
def getAllClients():
"""getAllClients()
Get all recorded clients ready to make RPCs to clusters.
"""
try:
service = eventloop.services.getServiceNamed("rpc")
except KeyError:
return []
else:
return service.getAllClients()
|