[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-02-07 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/brooklyn-server/pull/544


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-02-03 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/544#discussion_r99424592
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BrooklynImageChooser.java
 ---
@@ -128,15 +128,18 @@ public double score(Image img) {
 
 
 // prefer these guys, in stock brooklyn provisioning
-score += punishmentForOldOsVersions(img, OsFamily.UBUNTU, 11);
-score += punishmentForOldOsVersions(img, OsFamily.CENTOS, 6);
 
 OperatingSystem os = img.getOperatingSystem();
 if (os!=null) {
 if (os.getFamily()!=null) {
 // preference for these open, popular OS (but only wrt 
versions above) 
-if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
+if (os.getFamily().equals(OsFamily.CENTOS)) {
+score += punishmentForOldOsVersions(img, 
OsFamily.CENTOS, 7);
+score += 3;
+
+}
 else if (os.getFamily().equals(OsFamily.UBUNTU)) {
+score += punishmentForOldOsVersions(img, 
OsFamily.UBUNTU, 11);
--- End diff --

@neykov It later does:
```
if ("14.04".equals(os.getVersion())) score += 0.2;
else if ("12.04".equals(os.getVersion())) score += 0.1;
```
so is rewarding 12+, even if it's not punishing 11.

I agree that bumping this to 12 would make sense though. If we changed it 
to 14, we'd end up preferring 12.10 or 13.10 over  12.04.5 (even though the 
last one is supported until April 2017, while the first two are not supported).

However, I doubt we ever test our blueprints on 12.04!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-02-03 Thread neykov
Github user neykov commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/544#discussion_r99381007
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BrooklynImageChooser.java
 ---
@@ -128,15 +128,18 @@ public double score(Image img) {
 
 
 // prefer these guys, in stock brooklyn provisioning
-score += punishmentForOldOsVersions(img, OsFamily.UBUNTU, 11);
-score += punishmentForOldOsVersions(img, OsFamily.CENTOS, 6);
 
 OperatingSystem os = img.getOperatingSystem();
 if (os!=null) {
 if (os.getFamily()!=null) {
 // preference for these open, popular OS (but only wrt 
versions above) 
-if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
+if (os.getFamily().equals(OsFamily.CENTOS)) {
+score += punishmentForOldOsVersions(img, 
OsFamily.CENTOS, 7);
+score += 3;
+
+}
 else if (os.getFamily().equals(OsFamily.UBUNTU)) {
+score += punishmentForOldOsVersions(img, 
OsFamily.UBUNTU, 11);
--- End diff --

Suggest bumping this to at least 12, ideally 14.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-02-03 Thread neykov
Github user neykov commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/544#discussion_r99380876
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BrooklynImageChooser.java
 ---
@@ -73,7 +73,7 @@ protected static boolean 
imageNameContainsWordCaseInsensitive(Image img, String
 return 
img.getName().toLowerCase().matches("(.*[^a-z])?"+pattern.toLowerCase()+"([^a-z].*)?");
 }
 
-public double punishmentForOldOsVersions(Image img, OsFamily family, 
double minVersion) {
+private double punishmentForOldOsVersions(Image img, OsFamily family, 
double minVersion) {
--- End diff --

Can you make this `protected`. If someone needs to fine-tune the selection 
the easiest thing to do would be to extend this class and configure an override 
in the location.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-01-31 Thread aledsage
Github user aledsage commented on a diff in the pull request:

https://github.com/apache/brooklyn-server/pull/544#discussion_r98661586
  
--- Diff: 
locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/BrooklynImageChooser.java
 ---
@@ -135,10 +135,14 @@ public double score(Image img) {
 if (os!=null) {
 if (os.getFamily()!=null) {
 // preference for these open, popular OS (but only wrt 
versions above) 
-if (os.getFamily().equals(OsFamily.CENTOS)) score += 2;
-else if (os.getFamily().equals(OsFamily.UBUNTU)) {
+if (os.getFamily().equals(OsFamily.CENTOS)) {
 score += 2;
 
+if(os.getVersion()!= null && 
os.getVersion().startsWith("7.")) score += 0.1;
+}
+else if (os.getFamily().equals(OsFamily.UBUNTU)) {
+score += 1;
--- End diff --

Will the version always start with "7.", or might it just be "CentOS 7"? 
I'd be inclined to say `startsWith("7")`.

Do we want to favour more recent CentOS over slightly older ones (e.g. 7.3 
is better than 7.1)? Not sure of the best way to do that in a future-proof way. 
We could do something similar to `punishmentForOldOsVersions`, but to reward 
newer versions. However, we'd need to be careful that if someone says 
`7.20170104` that we don't give it a ridiculous high score!)

Changing Ubuntu to `+= 1` puts it at the same level as RHEL, AMZN_LINUX and 
DEBIAN. I wonder if we should make it `+= 1.5`? Or we could make CentOS `+= 3`?

Minor personal preference: I'd refactor to move the 
`punishmentForOldOsVersions(img, OsFamily.CENTOS, 6)` call into the `if 
(...CENTOS)` block here. Similar for ubuntu.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] brooklyn-server pull request #544: Prefer centos 7

2017-01-31 Thread duncangrant
GitHub user duncangrant opened a pull request:

https://github.com/apache/brooklyn-server/pull/544

Prefer centos 7

As discusson on the Apache Brooklyn discussion mailing list this PR updates 
BrooklynImageChooser to prefer centos over ubuntu

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/duncangrant/brooklyn-server use-centos

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/brooklyn-server/pull/544.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #544


commit 51802f8b5f0ec5a2f23a938589e589df819fff57
Author: Duncan Grant 
Date:   2017-01-31T10:52:49Z

Prefer centos 7




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---