message "You have data stored in an older format and/or unreadable data." after Groovy init script

84 views
Skip to first unread message

Jeroen Wolff

unread,
Sep 28, 2018, 2:43:33 PM9/28/18
to Jenkins Users
Hi all,


I've got an init.d/ groovy script to configure the mailer task:

import jenkins.model.*
def jenkinsInst = Jenkins.getInstance()
def mailerDesc = jenkinsInst.getDescriptor("hudson.tasks.Mailer");
mailerDesc.setSmtpHost("smtp.domain.com")
mailerDesc.setUseSsl(false)
mailerDesc.setDefaultSuffix("@domain.com")
mailerDesc.setReplyToAddress("jen...@domain.com")
mailerDesc.setCharset("UTF-8")
mailerDesc.save()

When the next time Jenkins restarts after this script i get an warning  "You have data stored in an older format and/or unreadable data."

type: 
jenkins.model.JenkinsLocationConfiguration
name: 
JenkinsLocationConfiguration
error: 
MissingFieldException: No field 'defaultSuffix' found in class 'jenkins.model.JenkinsLocationConfiguration', MissingFieldException: No field 'replyToAddress' found in class 'jenkins.model.JenkinsLocationConfiguration', MissingFieldException: No field 'smtpHost' found in class 'jenkins.model.JenkinsLocationConfiguration'


What can be wrong?

Regards,

Jeroen

Vincent Latombe

unread,
Oct 1, 2018, 5:04:45 AM10/1/18
to Jenkins Users
Seems to be caused by some weird logic in this class if there is no configuration yet.


So it means you don't have any configuration set for jenkins.model.JenkinsLocationConfiguration.

I would recommend calling something like

def jlc = jenkins.model.JenkinsLocationConfiguration.get()
jlc.setUrl("http://domain.com")
jlc.setAdminAddress("jen...@domain.com")
jlc.save()


Vincent


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/cf900a97-cdcf-4bd9-a4be-d4d1098338c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages