server_name = sys.argv[1] user_name = sys.argv[2] password = sys.argv[3] try: alert_id = sys.argv[4] except IndexError: alert_id = None try: # instantiate the Tintri server. tintri = Tintri(server_name) # Get version and product version_info = tintri.version product_name = version_info.productName if not tintri.is_vmstore(): raise TintriServerError(0, -1, "Tintri server needs to be VMstore, not " + product_name) preferredVersion = version_info.preferredVersion print("API Version: " + preferredVersion) # Login to TGC tintri.login(user_name, password) except TintriServerError as tse: print_error(tse.__str__()) sys.exit(2) try: print_policies()
operation = sys.argv[2] # Assume the user name is admin for reboot or shutdown. user_name = "admin" # Read the password password = getpass.getpass("Enter " + user_name + " password: "******"Tintri server needs to be VMstore, not " + product_name) version = version_info.preferredVersion print("API Version: " + version) # Login to TGC tintri.login(user_name, password) # Validate and execute the operations. if operation == "shutdown": print_info("Shuting down " + server) tintri.shutdown("default") elif operation == "reboot":