Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort datasource keys for idempotence #11

Merged
merged 1 commit into from
Oct 28, 2014
Merged

sort datasource keys for idempotence #11

merged 1 commit into from
Oct 28, 2014

Conversation

neoice
Copy link
Contributor

@neoice neoice commented Oct 27, 2014

I see on this line https://github.com/bfraser/puppet-grafana/blob/master/templates/config.js.erb#L13 a .sort being called. I assume this is to keep the order of the hash consistent so that writes to config.js are idempotent.

however, my Puppet Reports are full of these:

 datasources: {
+        graphite: {
+            default: true,
+            type: 'graphite',
+            url: 'https://graphite.example.com',
+        },
         elasticsearch: {
             grafanaDB: true,
             index: 'grafana-dash',
             type: 'elasticsearch',
             url: 'https://logstash.example.com:9200',
         },
-        graphite: {
-            default: true,
-            type: 'graphite',
-            url: 'https://graphite.example.com',
-        },
     },
     datasources: {
-        graphite: {
-            default: true,
-            type: 'graphite',
-            url: 'https://graphite.example.com',
-        },
         elasticsearch: {
             grafanaDB: true,
             index: 'grafana-dash',
             type: 'elasticsearch',
             url: 'https://logstash.example.com:9200',
         },
+        graphite: {
+            default: true,
+            type: 'graphite',
+            url: 'https://graphite.example.com',
+        },
     },

an additional .sort is required to sort the datasources as well as the contents of each datasource.

bfraser added a commit that referenced this pull request Oct 28, 2014
sort datasource keys for idempotence
@bfraser bfraser merged commit 995194d into bfraser:master Oct 28, 2014
bastelfreak pushed a commit to bastelfreak/puppet-grafana that referenced this pull request Mar 10, 2017
cegeka-jenkins pushed a commit to cegeka/puppet-grafana that referenced this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants