Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-31189

Configure SyslogLoggerPlugin with Groovy

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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

        Attachments

          Activity

          Hide
          cleclerc 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

          Show
          cleclerc 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
          Hide
          scm_issue_link 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

          Show
          scm_issue_link 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
          Hide
          cleclerc Cyrille Le Clerc added a comment -

          John Mickey 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)

          Show
          cleclerc Cyrille Le Clerc added a comment - John Mickey 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)
          Hide
          jsmickey John Mickey added a comment -

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

          Show
          jsmickey John Mickey added a comment - Cyrille Le Clerc Cyrille, I will test locally, but it will be a few days due to travel.
          Hide
          jsmickey John Mickey added a comment -

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

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

          Thanks John Mickey, 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

          Show
          cleclerc Cyrille Le Clerc added a comment - Thanks John Mickey , 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
          Hide
          jsmickey 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()
          
          Show
          jsmickey 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()

            People

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

              Dates

              • Created:
                Updated:
                Resolved: