I'm trying to get a python script to run base on the os release and if its physical or virtual machine. If its virtual the script will NOT run, but if its Physical the script will run base on the os release level. I'm a little bit confusing putting the second check for virtual.
Can someone help me on this. Thank you.
#!/usr/bin/env python import os import platform import sys import os.path os_release = platform.dist() platform = os.system("dmidecode -s system-manufacturer") # RHEL5 if os_release == "Santiago": if platform == "IBM": os.system("cat /etc/redhat-release") else: print platform # RHEL6 elif os_release == "Tikanga": os.system("cat /etc/redhat-release") # RHEL7 elif os_release == "Maipo": os.system("cat /etc/redhat-release")