Skip to content

Commit

Permalink
[JENKINS-38196] Fix a NPE when there is a job without label restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
pjanouse committed Sep 14, 2016
1 parent e1b4524 commit 3285da9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/java/com/redhat/foreman/ForemanSharedNodeCloud.java
Expand Up @@ -151,6 +151,11 @@ ForemanAPI getForemanAPI() {
public boolean canProvision(Label label) {
Map<String, String> hostsMap = getForemanAPI().getCompatibleHosts();
Set<String> hosts = hostsMap.keySet();

if (label == null) {
return !hostsMap.isEmpty();
}

for (String host: hosts) {
boolean match = label.matches(Label.parse(hostsMap.get(host)));
if (match) {
Expand Down

0 comments on commit 3285da9

Please sign in to comment.