def __init__(self, working_dir, source_da_dir): if not os.path.exists(working_dir): raise Exception("Map files dir must exist: {}".format(working_dir)) if not os.path.exists(source_da_dir): raise Exception("DirectAdmin user config dir must exist: {}".format(source_da_dir)) self.working_dir = working_dir self.tpl_ssl_vhost_file_name = os.path.join(os.path.dirname(__file__), 'vhost_ssl.conf.tpl') if not os.path.exists(self.tpl_ssl_vhost_file_name): raise Exception( "Place Nginx vhost template in the correct location: {}".format(self.tpl_ssl_vhost_file_name)) self.source_da_dir = source_da_dir self.map_users = NginxMap('http_host', 'user') self.map_domains = NginxMap('http_host', 'domain') self.map_subdomains = NginxMap('http_host', 'subdomain') self._load()