/usr/lib/python3/dist-packages/provisioningserver/rpc/__init__.py is in python3-maas-provisioningserver 2.4.0~beta2-6865-gec43e47e6-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 | # Copyright 2013-2015 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
"""Cluster Controller RPC."""
__all__ = [
"getRegionClient",
]
import provisioningserver
from provisioningserver.rpc import exceptions
def getRegionClient():
"""getRegionClient()
Get a client with which to make RPCs to the region.
:raises: :py:class:`~.exceptions.NoConnectionsAvailable` when there
are no open connections to the region controller.
"""
# TODO: retry a couple of times before giving up if the service is
# not running or if exceptions.NoConnectionsAvailable gets raised.
try:
rpc_service = provisioningserver.services.getServiceNamed('rpc')
except KeyError:
raise exceptions.NoConnectionsAvailable(
"Cluster services are unavailable.")
else:
return rpc_service.getClient()
|