Skip to content

Instantly share code, notes, and snippets.

@martinsotir
Last active October 6, 2020 09:18
Show Gist options
  • Save martinsotir/3436ff420cc787747a012a82497b3895 to your computer and use it in GitHub Desktop.
Save martinsotir/3436ff420cc787747a012a82497b3895 to your computer and use it in GitHub Desktop.
A quick way to check if the we are running within openstack from python
def _is_host_openstack():
product_name = Path("/sys/devices/virtual/dmi/id/product_name")
return product_name.exists() and "OpenStack" in product_name.read_text()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment