From da85a486e3178e94a27d3c9c1ccb9645d099081c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 1 Jan 2022 23:47:30 +0100 Subject: Improve node classifier. --- modules/profiles/files/node-classifier.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'modules') diff --git a/modules/profiles/files/node-classifier.py b/modules/profiles/files/node-classifier.py index be8df7e..8c28ddb 100644 --- a/modules/profiles/files/node-classifier.py +++ b/modules/profiles/files/node-classifier.py @@ -5,19 +5,8 @@ import sys # https://puppet.com/docs/puppet/7/nodes_external.html -data = { - 'yoursql.adrift.space': { - # must contain at least either classes or parameters - 'classes': [ - 'profiles::common', - ], - 'environment': 'mysql', - }, -} - -default_data = { - 'parameters': {}, -} +with open('/nodes.yaml') as f: + data = yaml.load(f) def main(args): if len(args) == 1: @@ -27,9 +16,8 @@ def main(args): nodename = sys.argv[1] instance = data.get(nodename) if not instance: - print(yaml.dump(default_data)) - else: - print(yaml.dump(instance)) + instance = data.get('default') + print(yaml.dump(instance)) if __name__ == '__main__': sys.exit(main(sys.argv)) -- cgit v1.2.3