Merge "Watch both /etc/hiera/nodes.yaml and /etc/hiera/astute.yaml" into 7.0

This commit is contained in:
Jenkins 2016-03-08 16:08:55 +00:00 committed by Gerrit Code Review
commit 452ed7dc51
3 changed files with 7 additions and 4 deletions

View File

@ -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()

View File

@ -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"]

View File

@ -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