Merge "Watch both /etc/hiera/nodes.yaml and /etc/hiera/astute.yaml" into 7.0
This commit is contained in:
commit
452ed7dc51
|
@ -4,6 +4,7 @@ import pyinotify
|
|||
import subprocess
|
||||
import yaml
|
||||
|
||||
from pluginutils import ASTUTE_CONFIG
|
||||
from pluginutils import NODES_CONFIG
|
||||
|
||||
SCRIPTS_LOCATION="##REPLACE_ON_INSTALL##/"
|
||||
|
@ -12,7 +13,7 @@ UPDATE_ETCD_CLUSTER = SCRIPTS_LOCATION + "update_etcd_cluster.sh"
|
|||
|
||||
|
||||
def _get_configured_nodes(roles):
|
||||
with open(NODES_CONFIG, "r") as f:
|
||||
with open(ASTUTE_CONFIG, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
return [node for node in config["nodes"] if node["role"] in roles]
|
||||
|
@ -52,5 +53,6 @@ if __name__ == "__main__":
|
|||
handler = DeploymentChangeHandler()
|
||||
watch_manager = pyinotify.WatchManager()
|
||||
notifier = pyinotify.Notifier(watch_manager, handler)
|
||||
watch_manager.add_watch(ASTUTE_CONFIG, pyinotify.IN_MODIFY)
|
||||
watch_manager.add_watch(NODES_CONFIG, pyinotify.IN_MODIFY)
|
||||
notifier.loop()
|
||||
|
|
|
@ -3,11 +3,11 @@
|
|||
|
||||
import yaml
|
||||
|
||||
from pluginutils import NODES_CONFIG
|
||||
from pluginutils import ASTUTE_CONFIG
|
||||
|
||||
|
||||
def main(node_roles):
|
||||
with open(NODES_CONFIG, "r") as f:
|
||||
with open(ASTUTE_CONFIG, "r") as f:
|
||||
config = yaml.safe_load(f)
|
||||
|
||||
node_ips = [node["internal_address"] for node in config["nodes"]
|
||||
|
|
|
@ -5,7 +5,8 @@ import os
|
|||
|
||||
# This config file is updated with the latest node details as the deployment
|
||||
# evolves. It only contains node details, not other config settings.
|
||||
NODES_CONFIG = "/etc/hiera/astute.yaml"
|
||||
ASTUTE_CONFIG = "/etc/hiera/astute.yaml"
|
||||
NODES_CONFIG = "/etc/hiera/nodes.yaml"
|
||||
|
||||
# These config files contain details of the nodes at initial deployment, but
|
||||
# they are not subsequently updated with node changes. However, they contain
|
||||
|
|
Loading…
Reference in New Issue