1
# Copyright 2012 Canonical Ltd. This software is licensed under the
2
# GNU Affero General Public License version 3 (see the file LICENSE).
4
"""Refresh node-group worker's knowledge."""
6
from __future__ import (
19
from apiclient.creds import convert_tuple_to_string
20
from maasserver.models.user import get_creds_tuple
21
from provisioningserver.tasks import refresh_secrets
24
def refresh_worker(nodegroup):
25
"""Send worker for `nodegroup` a refresh message with credentials etc.
27
This is how we tell the worker its MAAS API credentials, the name of
28
the node group it manages, and so on. The function gathers all the
29
usual information (although we can always extend the mechanism with
30
more specific knowledge that we may choose not to include here) and
31
issues a task to the node-group worker that causes it to absorb the
32
given information items.
36
'api_credentials': convert_tuple_to_string(
37
get_creds_tuple(nodegroup.api_token)),
38
'nodegroup_uuid': nodegroup.uuid,
41
refresh_secrets.apply_async(queue=nodegroup.work_queue, kwargs=items)