Andrew Bogott has submitted this change and it was merged.

Change subject: shinkengen: Remove use of puppetVars
......................................................................


shinkengen: Remove use of puppetVars

Change-Id: I108c2b75787ef6697d814c4dc11a74e42301bb83
---
M modules/shinken/files/shinkengen
1 file changed, 5 insertions(+), 12 deletions(-)

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



diff --git a/modules/shinken/files/shinkengen b/modules/shinken/files/shinkengen
index b603016..e9eee93 100755
--- a/modules/shinken/files/shinkengen
+++ b/modules/shinken/files/shinkengen
@@ -80,12 +80,9 @@
                              configure page in wikitech.
             - project: Name of project the instance is contained in
             - name: Name of the instance
-            - puppetVars: Dictionary containing any custom puppet variables 
that
-                          have been set in the configure page in wikitech. Also
-                          contains default keys of `instanceproject` & 
`instancename`
         """
         self.conn.search('ou=hosts,dc=wikimedia,dc=org',
-                         '(puppetVar=instanceproject=%s)' % project,
+                         '(dc=*.%s.eqiad.wmflabs)' % project,
                          ldap3.SEARCH_SCOPE_WHOLE_SUBTREE,
                          attributes=ldap3.ALL_ATTRIBUTES)
         hosts = []
@@ -93,22 +90,18 @@
         for responseitem in self.conn.response:
             hostinfo = responseitem['attributes']
             ip = [a for a in hostinfo['aRecord'] if a.startswith('10.')][0]
-            puppetvars = {
-                var[0]: var[1]
-                for var in [pv.split("=") for pv in hostinfo['puppetVar']]
-            }
-            if puppetvars['instancename'] in hostnames:
+            instancename, projectname, site, realm = 
hostinfo['dc'][0].split(".")
+            if instancename in hostnames:
                 continue
             else:
-                hostnames.add(puppetvars['instancename'])
+                hostnames.add(instancename)
             hosts.append({
                 'ec2id': hostinfo['dc'][0],
                 'ip': ip,
                 'region': hostinfo['l'][0],
                 'puppetClasses': hostinfo.get('puppetClass', []),
                 'project': project,
-                'name': puppetvars['instancename'],
-                'puppetVars': puppetvars
+                'name': instancename
             })
 
         return hosts

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I108c2b75787ef6697d814c4dc11a74e42301bb83
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Alex Monk <a...@wikimedia.org>
Gerrit-Reviewer: Andrew Bogott <abog...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
Gerrit-Reviewer: Yuvipanda <yuvipa...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to