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 | da85a486e3178e94a27d3c9c1ccb9645d099081c (patch) | |
tree | 2265ce2328d084ea5b60093a4efdae5a47995f65 | |
parent | Made node-classifier not fail on missing name. (diff) | |
download | webdav_server-da85a486e3178e94a27d3c9c1ccb9645d099081c.tar.gz webdav_server-da85a486e3178e94a27d3c9c1ccb9645d099081c.tar.xz |
Improve node classifier.
-rw-r--r-- | manifests/site.pp | 4 | ||||
-rw-r--r-- | modules/profiles/files/node-classifier.py | 20 |
2 files changed, 4 insertions, 20 deletions
diff --git a/manifests/site.pp b/manifests/site.pp index d9db62a..9f216dc 100644 --- a/manifests/site.pp +++ b/manifests/site.pp @@ -1,7 +1,3 @@ -node 'yoursql.adrift.space' { - include ::profiles::common -} - node 'busting.adrift.space' { include ::profiles::common 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)) |