Skip to content
Browse files

renamed module conffiles => conf

  • Loading branch information...
1 parent 75338ce commit bbdf9f62981e5f4bdf92da0be4c8ce658dcf6175 Liraz Siri committed Oct 4, 2010
Showing with 8 additions and 7 deletions.
  1. +3 −3 conffiles.py → conf.py
  2. +5 −4 confconsole.py
View
6 conffiles.py → conf.py
@@ -6,15 +6,15 @@
class Error(Exception):
pass
-def get_configuration_path(filename):
+def path(filename):
for dir in ("conf", "/etc/confconsole"):
path = os.path.join(dir, filename)
if os.path.exists(path):
return path
raise Error('could not find configuration file: %s' % path)
-class ConsoleConf:
+class Conf:
def _load_conf(self):
if not os.path.exists(self.conf_file):
return
@@ -33,7 +33,7 @@ def _load_conf(self):
def __init__(self):
self.default_nic = None
- self.conf_file = get_configuration_path("confconsole.conf")
+ self.conf_file = path("confconsole.conf")
self._load_conf()
def set_default_nic(self, ifname):
View
9 confconsole.py
@@ -9,7 +9,8 @@
import ifutil
import executil
-from conffiles import ConsoleConf, get_configuration_path
+
+import conf
from StringIO import StringIO
import traceback
@@ -134,7 +135,7 @@ def _validip(ifname):
return True
return False
- ifname = ConsoleConf().default_nic
+ ifname = conf.Conf().default_nic
if ifname and _validip(ifname):
return ifname
@@ -225,7 +226,7 @@ def usage(self):
return "networking"
#display usage
- t = file(get_configuration_path("usage.txt"), 'r').read()
+ t = file(conf.path("usage.txt"), 'r').read()
text = Template(t).substitute(hostname=ifutil.get_hostname().capitalize(),
appname=self.appname,
ipaddr=ifutil.get_ipconf(ifname)[0])
@@ -393,7 +394,7 @@ def _ifconf_dhcp(self):
return "ifconf"
def _ifconf_default(self):
- ConsoleConf().set_default_nic(self.ifname)
+ conf.Conf().set_default_nic(self.ifname)
return "ifconf"
def _adv_install(self):

0 comments on commit bbdf9f6

Please sign in to comment.
Something went wrong with that request. Please try again.