| | |
| | | return result; |
| | | } |
| | | |
| | | bool ExecutionEnvironment::is_cloud() const { return getCloudProvider() != ON_PREMISE; } |
| | | bool ExecutionEnvironment::is_cloud() const { |
| | | CLOUD_PROVIDER prov = getCloudProvider(); |
| | | return prov != ON_PREMISE && prov != PROV_UNKNOWN; |
| | | } |
| | | |
| | | // TODO test and azure |
| | | CLOUD_PROVIDER ExecutionEnvironment::getCloudProvider() const { |
| | | CLOUD_PROVIDER result = PROV_UNKNOWN; |
| | | if (bios_description.size() > 0 || bios_vendor.size() > 0 || sys_vendor.size() > 0) { |
| | | if (bios_vendor.find("SEABIOS") != string::npos || bios_description.find("ALIBABA") != string::npos || |
| | | sys_vendor.find("ALIBABA") != string::npos) { |
| | | if (m_bios_description.size() > 0 || m_bios_vendor.size() > 0 || m_sys_vendor.size() > 0) { |
| | | if (m_bios_vendor.find("SEABIOS") != string::npos || m_bios_description.find("ALIBABA") != string::npos || |
| | | m_sys_vendor.find("ALIBABA") != string::npos) { |
| | | result = ALI_CLOUD; |
| | | } else if (sys_vendor.find("GOOGLE") != string::npos || bios_description.find("GOOGLE") != string::npos) { |
| | | } else if (m_sys_vendor.find("GOOGLE") != string::npos || m_bios_description.find("GOOGLE") != string::npos) { |
| | | result = GOOGLE_CLOUD; |
| | | } else if (bios_vendor.find("AWS") != string::npos || bios_description.find("AMAZON") != string::npos || |
| | | sys_vendor.find("AWS") != string::npos) { |
| | | } else if (m_bios_vendor.find("AWS") != string::npos || m_bios_description.find("AMAZON") != string::npos || |
| | | m_sys_vendor.find("AWS") != string::npos) { |
| | | result = AWS; |
| | | } else if (m_bios_description.find("HP-COMPAQ") != string::npos || m_bios_description.find("ASUS") || |
| | | m_bios_description.find("DELL")) { |
| | | result = ON_PREMISE; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | } // namespace os |