From 9a57b3961297585598c4294a7eb4cc87314c3bd3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com>
Date: Thu, 23 Jun 2011 10:44:22 +0200
Subject: [PATCH] Add support for [slapconsole] config part and aliases (you
 have variables kvm, mysql, etc, defined from config

---
 slapos/console.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/slapos/console.py b/slapos/console.py
index 7f0926d08..eb2a0bd44 100644
--- a/slapos/console.py
+++ b/slapos/console.py
@@ -76,11 +76,13 @@ class Config:
     configuration_parser = ConfigParser.SafeConfigParser()
     configuration_parser.read(configuration_file_path)
     # Merges the arguments and configuration
-    for section in ("slapos",):
+    for section in ("slapconsole",):
       configuration_dict = dict(configuration_parser.items(section))
       for key in configuration_dict:
         if not getattr(self, key, None):
           setattr(self, key, configuration_dict[key])
+    configuration_dict = dict(configuration_parser.items('slapos'))
+    setattr(self, 'master_url', configuration_dict['master_url'])
           
     if not self.master_url:
       raise ValueError('master-url is required.')
@@ -96,6 +98,11 @@ def run():
       key_file=config.key_file, cert_file=config.cert_file)
   local = globals()
   local['slap'] = slap
+  alias = config.alias.split('\n')
+  for software in alias:
+    if software is not '':
+      name, url = software.split(' ')
+      local[name] = url
   # XXX-Cedric Maybe we should generate a new OpenOrder for each request?
   local['request'] = slap.registerOpenOrder().request
   
-- 
2.30.9