From f2a841a87ce1651650d16305e42bfe33c3eaa0b9 Mon Sep 17 00:00:00 2001 From: kali Date: Thu, 20 Sep 2012 04:40:12 +0900 Subject: cleanup --- src/leap/base/config.py | 108 -------------------------------------------- src/leap/base/connection.py | 17 ------- 2 files changed, 125 deletions(-) (limited to 'src') diff --git a/src/leap/base/config.py b/src/leap/base/config.py index a468a849..76fbee3c 100644 --- a/src/leap/base/config.py +++ b/src/leap/base/config.py @@ -273,111 +273,3 @@ def get_username(): def get_groupname(): gid = os.getgroups()[-1] return grp.getgrgid(gid).gr_name - - -# json stuff - -# XXX merge with JSONConfig / EIPChecks as appropiate. -#def get_config_json(config_file=None): - #""" - #will replace get_config function be developing them - #in parralel for branch purposes. - #@param: configuration file - #@type: file - #@rparam: configuration turples - #@rtype: dictionary - #""" - #if not config_file: - #TODO: NOT SURE WHAT this default should be, if anything - #fpath = get_config_file('eip.json') - #if not os.path.isfile(fpath): - #dpath, cfile = os.path.split(fpath) - #if not os.path.isdir(dpath): - #mkdir_p(dpath) - #with open(fpath, 'wb') as configfile: - #configfile.flush() - #try: - #return json.load(open(fpath)) - #except ValueError: - #raise exceptions.MissingConfigFileError -# - #else: - #TODO: add validity checks of file - #try: - #return json.load(open(config_file)) - #except IOError: - #raise exceptions.MissingConfigFileError -# -# -#def get_definition_file(url=None): - #""" - #""" - #TODO: determine good default location of definition file. - #r = requests.get(url) - #return r.json -# -# -#def is_internet_up(): - #"""TODO: Build more robust network diagnosis capabilities - #""" - #try: - #requests.get('http://128.30.52.45', timeout=1) - #return True - #except requests.Timeout: # as err: - #pass - #return False -# -# XXX DEPRECATE. -# move to eip.checks -# -# XXX merge conflict -# some tests are still using this deprecated Configuration object. -# moving it here transiently until I clean merge commit. -# -- kali 2012-08-24 00:32 -# -# -# -#class Configuration(object): - #""" - #All configurations (providers et al) will be managed in this class. - #""" - #def __init__(self, provider_url=None): - #try: - #requests.get('foo') - #self.providers = {} - #self.error = False - #provider_file = self.check_and_get_definition_file(provider_url) - #self.providers['default'] = get_config_json(provider_file) - #except (requests.HTTPError, requests.RequestException) as e: - #self.error = e.message - #except requests.ConnectionError as e: - #if e.message == "[Errno 113] No route to host": - #if not is_internet_up: - # this was meant to be a function invocation I guess... - #self.error = "No valid internet connection found" - #else: - #self.error = "Provider server appears currently down." -# - #def check_and_get_definition_file(self, provider_url): - #""" - #checks if provider definition.json file is present. - #if not downloads one from the web. - #""" - #default_provider_path = get_default_provider_path() -# - #if not os.path.isdir(default_provider_path): - #mkdir_p(default_provider_path) -# - #definition_file = get_config_file( - #'definition.json', - #folder=default_provider_path) -# - #if os.path.isfile(definition_file): - #return -# - #else: - #r = requests.get(provider_url) - #r.raise_for_status() - #with open(definition_file, 'wb') as f: - #f.write(json.dumps(r.json, indent=4)) - #return definition_file diff --git a/src/leap/base/connection.py b/src/leap/base/connection.py index f594d21c..e478538d 100644 --- a/src/leap/base/connection.py +++ b/src/leap/base/connection.py @@ -5,7 +5,6 @@ from __future__ import (division, unicode_literals, print_function) import logging -#from leap.base.config import JSONLeapConfig from leap.base.authentication import Authentication logger = logging.getLogger(name=__name__) @@ -56,22 +55,6 @@ class Connection(Authentication): """ return self.desired_connection_state - #def poll_connection_state(self): - #""" - #""" - #try: - #state = self.get_connection_state() - #except ConnectionRefusedError: - # connection refused. might be not ready yet. - #return - #if not state: - #return - #(ts, status_step, - #ok, ip, remote) = state - #self.status.set_vpn_state(status_step) - #status_step = self.status.get_readable_status() - #return (ts, status_step, ok, ip, remote) - def get_icon_name(self): """ get icon name from status object -- cgit v1.2.3