Fixed enforcing an artifactory config issue while setting up a new server
Change-Id: Ia7191d8b5793a138ba37add0fa2cb05fde197547
diff --git a/_states/jenkins_artifactory.py b/_states/jenkins_artifactory.py
index 0fea075..7683cd7 100644
--- a/_states/jenkins_artifactory.py
+++ b/_states/jenkins_artifactory.py
@@ -15,7 +15,9 @@
server.getResolverCredentialsConfig().getCredentialsId().equals("{credentialsId}")){{
print("EXISTS")
}}else{{
- desc.getArtifactoryServers().removeIf{{it -> it.name.equals("{name}")}}
+ if(desc.getArtifactoryServers() != null && !desc.getArtifactoryServers().isEmpty()){{
+ desc.getArtifactoryServers().removeIf{{it -> it.name.equals("{name}")}}
+ }}
def newServer = new ArtifactoryServer(
"{name}",
"{serverUrl}",