Yuvipanda has submitted this change and it was merged.

Change subject: shinken: Style fixes for shinkengen
......................................................................


shinken: Style fixes for shinkengen

- Fix some names to be more consistent
- Add some more documentation
- Add license header

Change-Id: Id3d0d7e9817da6a293cc0fb61d7b84e3e68bc913
---
M modules/shinken/files/shinkengen
M modules/shinken/templates/shinkengen.yaml.erb
2 files changed, 35 insertions(+), 4 deletions(-)

Approvals:
  Yuvipanda: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/shinken/files/shinkengen b/modules/shinken/files/shinkengen
index c00dc0c..8021746 100755
--- a/modules/shinken/files/shinkengen
+++ b/modules/shinken/files/shinkengen
@@ -1,4 +1,35 @@
 #!/usr/bin/python3
+#   Copyright 2014 Yuvi Panda <[email protected]>
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+#
+"""
+Generates config about labs instances for shinken, taking info from LDAP.
+
+Emits a host definition for each instance in the whitelisted projects
+(whitelist in the config file).
+
+Sets as hostgroup for each instance:
+    - Name of project instance is a part of
+    - Each puppet role explicitly applied to it (via Wikitech)
+
+Sets as contact for each instance a contactgroup with the same name as the
+project the instance is in. This contactgroup must be created whenever a
+new project is whitelisted.
+
+Sets the project name in the notes section of each instance, so that
+can be used when constructing graphite metric paths.
+"""
 import yaml
 import ldap3
 import jinja2
@@ -36,7 +67,7 @@
                                      user=bindas, password=passwd,
                                      auto_bind=ldap3.AUTO_BIND_TLS_AFTER_BIND)
 
-    def get_hosts(self, project):
+    def get_instances(self, project):
         """
         Get info about all instances in the given project.
 
@@ -86,7 +117,7 @@
                             config['ldap']['password'])
 
     for project in config['projects']:
-        instances = ldapsource.get_hostsinfo(project)
+        instances = ldapsource.get_instances(project)
         host_configs = []
         for instance in instances:
             co = ConfigObject('host')
@@ -105,7 +136,7 @@
             co.properties['notes'] = project  # Used for auto deriving 
graphite path
             host_configs.append(co)
         hosts_config_path = '%s/%s.cfg' % (
-            config['base_path'], project
+            config['output_path'], project
         )
         with open(hosts_config_path, 'w') as hostsfile:
             hostsfile.write('\n'.join([str(hc) for hc in host_configs]))
diff --git a/modules/shinken/templates/shinkengen.yaml.erb 
b/modules/shinken/templates/shinkengen.yaml.erb
index e6e3ca0..2a13007 100644
--- a/modules/shinken/templates/shinkengen.yaml.erb
+++ b/modules/shinken/templates/shinkengen.yaml.erb
@@ -1,5 +1,5 @@
 projects: [ 'tools', 'deployment-prep', 'extdist', 'analytics', 'integration', 
'shinken', 'cvn', 'wdq-mm' ]
-base_path: '/etc/shinken/generated'
+output_path: '/etc/shinken/generated'
 ldap:
   server: <%= @ldap_server %>
   bindas: <%= @ldap_bindas %>

-- 
To view, visit https://gerrit.wikimedia.org/r/182079
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Id3d0d7e9817da6a293cc0fb61d7b84e3e68bc913
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Yuvipanda <[email protected]>
Gerrit-Reviewer: Yuvipanda <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to