Commit e81d4620 authored by camp's avatar camp
Browse files

Added code to check all of the hosts aliases for finding the host profile.



git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@10042 18c085ea-50e0-402c-830e-de6fd14e8384
parent a2bdaf88
......@@ -931,6 +931,8 @@ HostProfileList::GetActiveLaunchProfileForHost(const std::string &hostName) cons
// Try matching against the original hostname if matching against the
// resolved host name fails.
//
// David Camp, Fri Feb 26 13:53:28 PST 2010
// Try matching against all of the host's aliases.
// ****************************************************************************
#if defined(_WIN32)
#include <winsock2.h>
......@@ -941,25 +943,40 @@ HostProfileList::GetActiveLaunchProfileForHost(const std::string &hostName) cons
MachineProfile *
HostProfileList::GetMachineProfileForHost(const std::string &hostName) const
{
std::string fqhostName(hostName);
struct hostent *hostEnt = gethostbyname(fqhostName.c_str());
if (hostEnt)
fqhostName = std::string(hostEnt->h_name);
// Check for the hostname
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
if (m->ProfileMatchesHost(hostName))
return m;
}
for(size_t i = 0; i < machines.size(); i++)
struct hostent *hostEnt = gethostbyname(hostName.c_str());
if (hostEnt)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(hostName))
return m;
// Check for the official host name
std::string fqhostName(hostEnt->h_name);
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
return m;
}
// Check all of the aliases
for(int j=0; hostEnt->h_aliases[j] != NULL; j++)
{
fqhostName = std::string(hostEnt->h_aliases[j]);
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
return m;
}
}
}
return NULL;
......
......@@ -55,6 +55,8 @@ Definition:
// Try matching against the original hostname if matching against the
// resolved host name fails.
//
// David Camp, Fri Feb 26 13:53:28 PST 2010
// Try matching against all of the host's aliases.
// ****************************************************************************
#if defined(_WIN32)
#include <winsock2.h>
......@@ -65,25 +67,40 @@ Definition:
MachineProfile *
HostProfileList::GetMachineProfileForHost(const std::string &hostName) const
{
std::string fqhostName(hostName);
struct hostent *hostEnt = gethostbyname(fqhostName.c_str());
if (hostEnt)
fqhostName = std::string(hostEnt->h_name);
// Check for the hostname
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
if (m->ProfileMatchesHost(hostName))
return m;
}
for(size_t i = 0; i < machines.size(); i++)
struct hostent *hostEnt = gethostbyname(hostName.c_str());
if (hostEnt)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(hostName))
return m;
// Check for the official host name
std::string fqhostName(hostEnt->h_name);
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
return m;
}
// Check all of the aliases
for(int j=0; hostEnt->h_aliases[j] != NULL; j++)
{
fqhostName = std::string(hostEnt->h_aliases[j]);
for(size_t i = 0; i < machines.size(); i++)
{
MachineProfile *m = (MachineProfile *)(machines[i]);
if (m->ProfileMatchesHost(fqhostName))
return m;
}
}
}
return NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment