diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:47:30 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-01-01 23:52:25 +0100 |
commit | 495442e3d992c7f95836836ee248c1dfc8aa6ff1 (patch) | |
tree | ddafcdc48528839379ea9d9d0e5568d9669d7fae /files/node-classifier.py | |
parent | Made node-classifier not fail on missing name. (diff) | |
download | profiles-495442e3d992c7f95836836ee248c1dfc8aa6ff1.tar.gz profiles-495442e3d992c7f95836836ee248c1dfc8aa6ff1.tar.xz |
Improve node classifier.
Diffstat (limited to '')
-rw-r--r-- | files/node-classifier.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/files/node-classifier.py b/files/node-classifier.py index be8df7e..8c28ddb 100644 --- a/files/node-classifier.py +++ b/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)) |