Giuseppe Lavagetto has submitted this change and it was merged.

Change subject: naggen2: order resources by title in puppetDB as well
......................................................................


naggen2: order resources by title in puppetDB as well

Also, sort all the parameters for reducing differences further.

Change-Id: Iebc821b9adf465fb48115b23543c56f6ce8fe7b0
---
M modules/puppetmaster/files/naggen2
1 file changed, 10 insertions(+), 4 deletions(-)

Approvals:
  Giuseppe Lavagetto: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/puppetmaster/files/naggen2 
b/modules/puppetmaster/files/naggen2
index 3eba6f4..734530e 100755
--- a/modules/puppetmaster/files/naggen2
+++ b/modules/puppetmaster/files/naggen2
@@ -135,16 +135,22 @@
             self.config.get('main', 'port'),
             self.restype[what]
         )
-        resources_raw = requests.get(url, params={'query': '["=", 
["parameter", "ensure"], "present"]'})
+        resources_raw = requests.get(url, params={
+            'query': '["=", ["parameter", "ensure"], "present"]',
+            'order-by': '[{"field": "title"}]'
+        })
         return resources_raw.json()
 
     def _filter_entity(self, entity, what):
-        name = entity['certname']
-        params = [p for p in entity['parameters'].iteritems() if p[0] not in 
['ensure', 'target']]
+        name = entity['title']
         # PuppetDB 2.3 does not collect the host_name parameter, apparently
         if what in ['hosts', 'hostextinfo']:
-            params.append(('host_name', entity['title']))
+            if 'host_name' not in entity['parameters']:
+                entity['parameters']['host_name'] = entity['title']
 
+        param_keys = entity['parameters'].keys()
+        param_keys.sort()
+        params = [(p, entity['parameters'][p]) for p in param_keys if p not in 
['ensure', 'target']]
         return (name, params)
 
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Iebc821b9adf465fb48115b23543c56f6ce8fe7b0
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@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