#!/usr/bin/env python3

import sys
import os
import subprocess

dirname = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, dirname+'/../lib/')
from ports import open_ports

try:
    if open_ports(sys.argv[2], 123, 'udp') == False:
        print("OK")
        print("The NTP service isn't available on the machine")
        sys.exit(0)
except Exception:
    print("SKIPPED")
    print("Failed to read the results of a required dependency (open_ports).")
    sys.exit(0)

retValue = subprocess.call([dirname+'/main.sh', sys.argv[1], sys.argv[2], sys.argv[3]])
sys.exit(retValue)
