bfraser/puppet-grafana — pull request #11 by neoice (2014-10-27 14:14:44+00:00)
Title: sort datasource keys for idempotence

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.