Skip to content
Snippets Groups Projects
Commit 944ff966 authored by User expired's avatar User expired
Browse files

changed hostname retrieval function

parent 29185ebb
No related branches found
No related tags found
No related merge requests found
Upcoming version:
-----------------
- changed hostname retrieval function (Nikolaus Krismer)
- choosing vagrant provider depending on host (in gradle; not only in vagrantfile) (Nikolaus Krismer)
- not validating vagrant installation in gradle anymore (Nikolaus Krismer)
- removed provider definition from gradle (only needed within vagrant) (Nikolaus Krismer)
......
......@@ -37,22 +37,7 @@ def getDate() {
}
def getHostname() {
InetAddress result = null;
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
Enumeration<InetAddress> addresses = interfaces.nextElement().getInetAddresses();
while (addresses.hasMoreElements()) {
InetAddress address = addresses.nextElement();
if (!address.isLoopbackAddress()) {
if (address.isSiteLocalAddress()) {
return address.getHostName();
} else if (result == null) {
result = address;
}
}
}
}
return (result != null ? result : InetAddress.getLocalHost()).getHostName();
return InetAddress.getLocalHost().getHostName()
}
// Repositories, Configurations, Dependencies and SourceSets setup
......@@ -107,7 +92,7 @@ scmversion {
}
vagrant {
def hostname = getHostname();
def hostname = getHostname()
provider = (hostname.startsWith('ci') || hostname.startsWith('dbis-ci') || hostname.startsWith('isochrone') || hostname.startsWith('dbis-isochrone')) ? 'libvirt' : 'virtualbox';
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment