Ejemplo n.º 1
0
  /** Checks if node configuration matches with template definition. */
  private static boolean isNodeEligibleForReuse(
      AzureSlave slaveNode, AzureSlaveTemplate slaveTemplate) {

    // Do not reuse slave if it is marked for deletion.
    if (slaveNode.isDeleteSlave()) {
      return false;
    }

    // Check for null label and mode.
    if (AzureUtil.isNull(slaveNode.getLabelString()) && (slaveNode.getMode() == Node.Mode.NORMAL)) {
      return true;
    }

    if (AzureUtil.isNotNull(slaveNode.getLabelString())
        && slaveNode.getLabelString().equalsIgnoreCase(slaveTemplate.getLabels())) {
      return true;
    }

    return false;
  }