Created
January 4, 2017 17:40
-
-
Save mbukatov/99677776d905af50e265b69490484d8e to your computer and use it in GitHub Desktop.
tendrl-conf-check
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
#!/usr/bin/env python3 | |
# -*- coding: utf8 -*- | |
import os | |
import pprint | |
import sys | |
TENDRL_PROJECTS = [ | |
"performance_monitoring", | |
"alerting", | |
"node_agent", | |
"ceph_bridge", | |
"gluster_bridge", | |
"common", ] | |
pp = pprint.PrettyPrinter(indent=2) | |
# { project name -> { basename -> full path }} | |
config = {} | |
# find all config files across tendrl projects | |
for project in TENDRL_PROJECTS: | |
# find all config files in given tendrl-project | |
config[project] = {} | |
for dir_name, _, files in os.walk(os.path.join(project, 'etc')): | |
for filename in files: | |
config[project][filename] = os.path.join(dir_name, filename) | |
# pp.pprint(config) | |
conf_everywhere = [] | |
for filename, path in config["common"].items(): | |
included_everywhere = True | |
for project in TENDRL_PROJECTS: | |
if not filename in config[project]: | |
# print(config[project][filename]) | |
included_everywhere = False | |
break | |
if included_everywhere: | |
print(filename) | |
conf_everywhere.append(filename) | |
# pp.pprint(conf_everywhere) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment