Branch: refs/heads/development
  Home:   https://github.com/jenkinsci/influxdb-plugin
  Commit: ccf3192e71a9e1fb2b9762a747c282de7b682ad6
      
https://github.com/jenkinsci/influxdb-plugin/commit/ccf3192e71a9e1fb2b9762a747c282de7b682ad6
  Author: Frederic R <zougi...@gmail.com>
  Date:   2018-05-31 (Thu, 31 May 2018)

  Changed paths:
    M src/main/java/jenkinsci/plugins/influxdb/DescriptorImpl.java

  Log Message:
  -----------
  set influxdb servers detail from groovy scripts

This give the ability to set influxdb servers detail from groovy scripts,

this PR is a follow of https://github.com/jenkinsci/influxdb-plugin/pull/31
you can test it using the [Jenkins 
Console](https://wiki.jenkins.io/display/JENKINS/Jenkins+Script+Console).

We could already list the servers with groovy

```groovy
import jenkinsci.plugins.influxdb.models.Target

def influxdb = 
Jenkins.instance.getDescriptorByType(jenkinsci.plugins.influxdb.DescriptorImpl)

println "list of InfluxDB Targets:"
println "========================="
influxdb.targets.each { target ->
  
  println """
description = '${target.description}'"
url = '${target.url}'
username = '${target.username}'
password = '${target.password}'
database = '${target.database}'
=========================
"""
}
```

Which will print something like

```
list of InfluxDB Targets:
=========================

description = 'myserver1'"
url = 'http://10.37.24.14:8086/'
username = 'telegraf'
password = 'myPassword'
database = 'db0'
=========================
=========================

description = 'myserver1'"
url = 'http://10.37.24.15:8086/'
username = 'telegraf'
password = 'myPassword'
database = 'db0'
=========================
```

We can now, with this PR, override these servers with new ones

```groovy
import jenkinsci.plugins.influxdb.models.Target
import hudson.util.CopyOnWriteList

def influxdb = 
Jenkins.instance.getDescriptorByType(jenkinsci.plugins.influxdb.DescriptorImpl)

def target = new Target()
target.description = 'mydb'
target.url = 'http://10.10.10.10:8086'
target.username = 'admin'
target.password = 'admin'
target.database = 'db0'
CopyOnWriteList<Target> targets = new CopyOnWriteList<Target>()
targets.add(target)
influxdb.targets = targets

influxdb.save()
```


  Commit: 9797c3a21cdf9d80946f0c910a9e4a905832c714
      
https://github.com/jenkinsci/influxdb-plugin/commit/9797c3a21cdf9d80946f0c910a9e4a905832c714
  Author: Aleksi Simell <aleksi.sim...@eficode.com>
  Date:   2018-08-18 (Sat, 18 Aug 2018)

  Changed paths:
    M src/main/java/jenkinsci/plugins/influxdb/DescriptorImpl.java

  Log Message:
  -----------
  Merge pull request #35 from Zougi/patch-3

JENKINS-50962 - set influxdb servers detail from groovy scripts


Compare: 
https://github.com/jenkinsci/influxdb-plugin/compare/86b60f169d15...9797c3a21cdf
      **NOTE:** This service has been marked for deprecation: 
https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Commits" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-commits+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to