Navigation Menu

Skip to content

Commit

Permalink
[JENKINS-38196] Fixed method private String getHostToReserve(Label la…
Browse files Browse the repository at this point in the history
…bel), which is also affected
  • Loading branch information
pjanouse committed Sep 16, 2016
1 parent 3285da9 commit fd68281
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions src/main/java/com/redhat/foreman/ForemanSharedNodeCloud.java
Expand Up @@ -151,15 +151,9 @@ 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) {
return true;
if (label == null || label.matches(Label.parse(hostsMap.get(host)))) {
return true;
}
}
return false;
Expand Down Expand Up @@ -284,11 +278,9 @@ private String getHostToReserve(Label label) {
Map<String, String> hostsMap = getForemanAPI().getCompatibleHosts();
Set<String> hosts = hostsMap.keySet();
for (String host: hosts) {
boolean match = label.matches(Label.parse(hostsMap.get(host)));
if (match) {
if (getForemanAPI().isHostFree(host)) {
return host;
}
if (getForemanAPI().isHostFree(host)
&& (label == null || label.matches(Label.parse(hostsMap.get(host))))) {
return host;
}
}
return null;
Expand Down

0 comments on commit fd68281

Please sign in to comment.