forked from juju/juju-controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#68 from manadart/write-controller-config
Write controller config and signal the controller agent
- Loading branch information
Showing
6 changed files
with
360 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright 2023 Canonical Ltd. | ||
# Licensed under the GPLv3, see LICENSE file for details. | ||
import urllib | ||
from typing import Optional | ||
|
||
import unixsocket | ||
import logging | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class ConfigChangeSocketClient(unixsocket.SocketClient): | ||
""" | ||
Client to the Juju config change socket. | ||
""" | ||
def __init__(self, socket_path: str, | ||
opener: Optional[urllib.request.OpenerDirector] = None): | ||
super().__init__(socket_path, opener=opener) | ||
|
||
def get_controller_agent_id(self): | ||
resp = self.request_raw(path='/agent-id', method='GET') | ||
return resp.read().decode('utf-8') | ||
|
||
def reload_config(self): | ||
self.request_raw(path='/reload', method='POST') |
Oops, something went wrong.