brooklyncentral/brooklyn — pull request #1266 by sjcorbett (2014-03-18 17:23:06+00:00)
Title: Improved location details

Improves what an `SshMachineLocation` knows about itself.
* Added `MachineDetails` and `HardwareDetails` interfaces. MachineDetails has a `getOsDetails` method.
* Added `getMachineDetails` to MachineLocation interface and deprecated `getOsDetails` in its favour.
* Moved `os-details.sh` script from brooklyn-software-base to brooklyn-core.
* SshMachineLocation uses the script above to gather data. Details are cached after first retrieval.
* JcloudsSshMachineLocation attempts to create machine details from its metadata, deferring to SshMachineLocation if anything is missing.

Abridged output from `mvn clean install -PLive -Dtest=MachineTasks*Test` in brooklyn-software-base:
```
2014-03-18 15:18:16,752 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-F86PdBxp-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-81-235-193.compute-1.amazonaws.com:ec2-54-81-235-193.compute-1.amazonaws.com/54.81.235.193]
2014-03-18 15:18:19,689 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-F86PdBxp-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-81-235-193.compute-1.amazonaws.com:ec2-54-81-235-193.compute-1.amazonaws.com/54.81.235.193]
2014-03-18 15:18:19,690 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=centos, version=5.6, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:23:21,348 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-OIoLPIMX-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-198-107-101.compute-1.amazonaws.com:ec2-54-198-107-101.compute-1.amazonaws.com/54.198.107.101]
2014-03-18 15:23:22,592 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-OIoLPIMX-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-198-107-101.compute-1.amazonaws.com:ec2-54-198-107-101.compute-1.amazonaws.com/54.198.107.101]
2014-03-18 15:23:22,592 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=centos, version=6.3, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:25:33,389 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-FFCWTWaz-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-205-170-159.compute-1.amazonaws.com:ec2-54-205-170-159.compute-1.amazonaws.com/54.205.170.159]
2014-03-18 15:25:34,656 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-FFCWTWaz-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-205-170-159.compute-1.amazonaws.com:ec2-54-205-170-159.compute-1.amazonaws.com/54.205.170.159]
2014-03-18 15:25:34,657 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=debian, version=6.0, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:27:59,569 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-ZJmV6FSW-4]: Machine details for SshMachineLocation[54.198.80.43:54.198.80.43/54.198.80.43] missing from Jclouds, using SSH test instead. name=Optional.of(debian), version=Optional.absent(), arch=Optional.of(x86_64), ram=Optional.of(1740), #cpus=Optional.of(1)
2014-03-18 15:28:01,574 DEBUG b.l.basic.BasicMachineDetails [brooklyn-execmanager-ZJmV6FSW-8]: Machine details for SshMachineLocation[54.198.80.43:54.198.80.43/54.198.80.43]: MachineDetails{os=OsDetails{name=Debian GNU/Linux, version=7, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1661}}
2014-03-18 15:28:10,894 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-ZJmV6FSW-0]: Machine details for SshMachineLocation[54.198.80.43:54.198.80.43/54.198.80.43] missing from Jclouds, using SSH test instead. name=Optional.of(debian), version=Optional.absent(), arch=Optional.of(x86_64), ram=Optional.of(1740), #cpus=Optional.of(1)
2014-03-18 15:28:10,894 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=Debian GNU/Linux, version=7, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1661}}
2014-03-18 15:31:38,414 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-pVaw1DLC-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-198-74-220.compute-1.amazonaws.com:ec2-54-198-74-220.compute-1.amazonaws.com/54.198.74.220]
2014-03-18 15:31:45,725 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-pVaw1DLC-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-198-74-220.compute-1.amazonaws.com:ec2-54-198-74-220.compute-1.amazonaws.com/54.198.74.220]
2014-03-18 15:31:45,726 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=rhel, version=6.0, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:36:43,173 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-k9ntGiUf-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-82-65-162.compute-1.amazonaws.com:ec2-54-82-65-162.compute-1.amazonaws.com/54.82.65.162]
2014-03-18 15:36:44,525 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-k9ntGiUf-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-82-65-162.compute-1.amazonaws.com:ec2-54-82-65-162.compute-1.amazonaws.com/54.82.65.162]
2014-03-18 15:36:44,526 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=ubuntu, version=10.04, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:39:13,893 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-F58yUd0Q-4]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-82-87-111.compute-1.amazonaws.com:ec2-54-82-87-111.compute-1.amazonaws.com/54.82.87.111]
2014-03-18 15:39:16,493 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-F58yUd0Q-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[ec2-54-82-87-111.compute-1.amazonaws.com:ec2-54-82-87-111.compute-1.amazonaws.com/54.82.87.111]
2014-03-18 15:39:16,494 INFO b.e.s.MachineTasksEc2LiveTest [main]: MachineTasks live test found the following at JcloudsLocation[AWS Virginia:AKIAINAQUGY6FNLPLKGQ]: MachineDetails{os=OsDetails{name=ubuntu, version=12.04, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=1740}}
2014-03-18 15:41:49,981 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-Sz9k9IYC-4]: Machine details for SshMachineLocation[23.251.143.114:23.251.143.114/23.251.143.114] missing from Jclouds, using SSH test instead. name=Optional.absent(), version=Optional.absent(), arch=Optional.absent(), ram=Optional.of(3840), #cpus=Optional.of(1)
2014-03-18 15:41:50,879 DEBUG b.l.basic.BasicMachineDetails [brooklyn-execmanager-Sz9k9IYC-7]: Machine details for SshMachineLocation[23.251.143.114:23.251.143.114/23.251.143.114]: MachineDetails{os=OsDetails{name=CentOS, version=6.4, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=3579}}
2014-03-18 15:41:51,286 DEBUG b.l.j.JcloudsSshMachineLocation [brooklyn-execmanager-Sz9k9IYC-0]: Gathered machine details from Jclouds, skipping SSH test on SshMachineLocation[23.251.143.114:23.251.143.114/23.251.143.114]
2014-03-18 15:41:51,286 INFO b.e.s.MachineTasksGoogleComputeLiveTest [main]: MachineTasks live test found the following at JcloudsLocation[google-compute-engine:590421487852@developer.gserviceaccount.com]: MachineDetails{os=OsDetails{name=centos, version=6, arch=x86_64}, hardware=HardwareDetails{cpuCount=1, ram=3840}}
```