Commit 81a500d0 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos.core: Improve configuration search to be more precise

  Several packages has same namespace, this prevents fail if several
  slapos related packages are installed on the same machine.
parent 22c7a6fe
...@@ -125,7 +125,7 @@ def _replaceParameterValue(original_content, to_replace): ...@@ -125,7 +125,7 @@ def _replaceParameterValue(original_content, to_replace):
return original_content return original_content
def _generateSlaposNodeConfigurationFile(slapos_node_config_path, args): def _generateSlaposNodeConfigurationFile(slapos_node_config_path, args):
template_arg_list = (__name__.split('.')[0], 'slapos.cfg.example') template_arg_list = (__name__, '../../slapos.cfg.example')
with pkg_resources.resource_stream(*template_arg_list) as fout: with pkg_resources.resource_stream(*template_arg_list) as fout:
slapos_node_configuration_template = fout.read() slapos_node_configuration_template = fout.read()
master_url = 'http://%s:%s' % (args.daemon_listen_ip, args.daemon_listen_port) master_url = 'http://%s:%s' % (args.daemon_listen_ip, args.daemon_listen_port)
...@@ -152,7 +152,7 @@ def _generateSlaposNodeConfigurationFile(slapos_node_config_path, args): ...@@ -152,7 +152,7 @@ def _generateSlaposNodeConfigurationFile(slapos_node_config_path, args):
fout.write(slapos_node_configuration_content.encode('utf8')) fout.write(slapos_node_configuration_content.encode('utf8'))
def _generateSlaposProxyConfigurationFile(conf): def _generateSlaposProxyConfigurationFile(conf):
template_arg_list = (__name__.split('.')[0], 'slapos-proxy.cfg.example') template_arg_list = (__name__, '../../slapos-proxy.cfg.example')
with pkg_resources.resource_stream(*template_arg_list) as fout: with pkg_resources.resource_stream(*template_arg_list) as fout:
slapos_proxy_configuration_template = fout.read() slapos_proxy_configuration_template = fout.read()
slapos_proxy_configuration_path = os.path.join( slapos_proxy_configuration_path = os.path.join(
......
...@@ -986,7 +986,7 @@ database_uri = %(tempdir)s/lib/external_proxy.db ...@@ -986,7 +986,7 @@ database_uri = %(tempdir)s/lib/external_proxy.db
import slapos import slapos
self.external_proxy_process = subprocess.Popen( self.external_proxy_process = subprocess.Popen(
[ [
sys.executable, '%s/cli/entry.py' % os.path.dirname(slapos.__file__), sys.executable, '%s/../cli/entry.py' % os.path.dirname(slapos.tests.__file__),
'proxy', 'start', '--cfg', self.external_slapproxy_configuration_file_location 'proxy', 'start', '--cfg', self.external_slapproxy_configuration_file_location
], ],
env={"PYTHONPATH": ':'.join(sys.path)} env={"PYTHONPATH": ':'.join(sys.path)}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment