I am using jenkins declerative pipeline to read file properties from workspace , File is in INI format (ansible host file).
I am using following syntax but its not working throwing following error, Please suggest how to read or correct syntax to read the properties.
Groovy code:
def props = readProperties file: 'files/hosts'
assert props['webserver']
or
println props['webserver']
------------------------------------
hosts files contains following:
-------------------------------
[webserver]
server1
server2
[dbserver]
db1
db2
I want to read value of webserver 1 like webserver[0]...
Error which i am getting:
java.lang.NoSuchMethodError: No such DSL method 'readProperties' found among steps [ArtifactoryGradleBuild, MavenDescriptorStep, addBadge, addErrorBadge, addHtmlBadge, addInfoBadge, addInteractivePromotion, addShortText, addWarningBadge, ansiColor, ansiblePlaybook, ansibleVault, archive, artifactoryDistributeBuild, artifactoryDownload, artifactoryEditProps, artifactoryMavenBuild, artifactoryNpmInstall, artifactoryNpmPublish, artifactoryPromoteBuild, artifactoryUpload, bat, build, catchError, checkout, collectEnv, conanAddRemote, conanAddUser,