I would like to configure this plugin with groovy

      My code

      import jenkins.model.*
      import org.jenkinsci.plugins.*
      
      def inst = Jenkins.getInstance()
      
      def desc = inst.getDescriptor("org.jenkinsci.plugins.sysloglogger.SyslogLoggerPlugin")
      
      desc.setSyslogTransport("UDP")
      desc.save()
      

      Error

      STDERR: groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.sysloglogger.SyslogLoggerPlugin.setSyslogTransport() is applicable for argument types: (java.lang.String) values: [UDP]
      

      I'm light on Groovy experience and am having trouble. Any help is appreciated

          [JENKINS-31189] Configure SyslogLoggerPlugin with Groovy

          We forgot to expose setter methods, we have to add them.

          A workaround is to invoke SyslogLoggerPlugin.configure(StaplerRequest req, JSONObject formData).

          https://github.com/jenkinsci/syslog-logger-plugin/blob/syslog-logger-1.0.4/src/main/java/org/jenkinsci/plugins/sysloglogger/SyslogLoggerPlugin.java

          Cyrille Le Clerc added a comment - We forgot to expose setter methods, we have to add them. A workaround is to invoke SyslogLoggerPlugin.configure(StaplerRequest req, JSONObject formData). https://github.com/jenkinsci/syslog-logger-plugin/blob/syslog-logger-1.0.4/src/main/java/org/jenkinsci/plugins/sysloglogger/SyslogLoggerPlugin.java

          Code changed in jenkins
          User: Cyrille Le Clerc
          Path:
          src/main/java/org/jenkinsci/plugins/sysloglogger/SyslogLoggerPlugin.java
          http://jenkins-ci.org/commit/syslog-logger-plugin/5cecbb44f39f9c5fea1b717ae2ecb28380b255a6
          Log:
          JENKINS-31189 Add setters

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Cyrille Le Clerc Path: src/main/java/org/jenkinsci/plugins/sysloglogger/SyslogLoggerPlugin.java http://jenkins-ci.org/commit/syslog-logger-plugin/5cecbb44f39f9c5fea1b717ae2ecb28380b255a6 Log: JENKINS-31189 Add setters

          jsmickey Hi John, I just pushed the code change. Can you build locally and test? I can send you a .hpi file if you have issues building (it should just be git checkout + mvn package)

          Cyrille Le Clerc added a comment - jsmickey Hi John, I just pushed the code change. Can you build locally and test? I can send you a .hpi file if you have issues building (it should just be git checkout + mvn package)

          John Mickey added a comment -

          cleclerc Cyrille, I will test locally, but it will be a few days due to travel.

          John Mickey added a comment - cleclerc Cyrille, I will test locally, but it will be a few days due to travel.

          John Mickey added a comment -

          cleclerc, I have completed testing. I was able to configure the plugin via Groovy script. This is a pass

          John Mickey added a comment - cleclerc , I have completed testing. I was able to configure the plugin via Groovy script. This is a pass

          Thanks jsmickey, I have released the code, as I don't have permissions to push to the jenkins maven repo, it may take few hours/days to get someone to push it.

          https://github.com/jenkinsci/syslog-logger-plugin/releases/tag/syslog-logger-1.0.5

          Cyrille Le Clerc added a comment - Thanks jsmickey , I have released the code, as I don't have permissions to push to the jenkins maven repo, it may take few hours/days to get someone to push it. https://github.com/jenkinsci/syslog-logger-plugin/releases/tag/syslog-logger-1.0.5

          John Mickey added a comment -

          Here is the code I used to configure the plugin with Groovy for my configuration, see the git commit for additional options

              import jenkins.model.*
              import org.jenkinsci.plugins.*
          
              def inst = Jenkins.getInstance()
          
              def desc = inst.getDescriptor("org.jenkinsci.plugins.sysloglogger.SyslogLoggerPlugin")
          
              desc.setSyslogServerHostname("localhost")
              desc.setSyslogServerPort(514)
              desc.setSyslogTransport("UDP")
              desc.setFacility("SYSLOG")
              desc.save()
          

          John Mickey added a comment - Here is the code I used to configure the plugin with Groovy for my configuration, see the git commit for additional options import jenkins.model.* import org.jenkinsci.plugins.* def inst = Jenkins.getInstance() def desc = inst.getDescriptor( "org.jenkinsci.plugins.sysloglogger.SyslogLoggerPlugin" ) desc.setSyslogServerHostname( "localhost" ) desc.setSyslogServerPort(514) desc.setSyslogTransport( "UDP" ) desc.setFacility( "SYSLOG" ) desc.save()

            cleclerc Cyrille Le Clerc
            jsmickey John Mickey
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: