commit 35efa46f1e3a6edf1f45f9be3e822e00ea9201b5
Author: Radek Pazdera <rpazdera(a)redhat.com>
Date: Wed Aug 28 16:41:24 2013 +0200
install: Adding schemes to the distribution
The schemes need to be installed with the controller so it can use them
during the runtime. This patch adds them to the setup.py script.
By default, they are stored in /usr/share/lnst/, but the path can be
configured in the controller config file using the 'resource_dir'
option.
Signed-off-by: Radek Pazdera <rpazdera(a)redhat.com>
Signed-off-by: Jiri Pirko <jiri(a)resnulli.us>
install/lnst-ctl.conf.in | 65 +++++++++++++++++++++++++--------------------
lnst/Common/Config.py | 5 +++
setup.py | 8 ++++-
3 files changed, 47 insertions(+), 31 deletions(-)
---
diff --git a/install/lnst-ctl.conf.in b/install/lnst-ctl.conf.in
index 576a562..c95a264 100644
--- a/install/lnst-ctl.conf.in
+++ b/install/lnst-ctl.conf.in
@@ -1,45 +1,52 @@
-#This file is used for system-wide controller configuration. It serves mainly
-#to set the default values which will be used when no user configuration is
-#found. Users should set their own configuration in the file
+# This file is used for system-wide controller configuration. It serves mainly
+# to set the default values which will be used when no user configuration is
+# found. Users should set their own configuration in the file
# $HOME$/.lnst/lnst-ctl.conf which will be automatically created when it
-#doesn't exist.
+# doesn't exist.
-#The section environment contains generic options mostly related to the
-#machine the controller is being run on.
+# The section environment contains generic options mostly related to the
+# machine the controller is being run on.
[environment]
-#mac_pool_range is used to specify the range of mac addresses that
-#will be used when creating new devices in virtual machines.
-#The option accepts two valid mac addresses separated by white spaces.
+# 'mac_pool_range' is used to specify the range of mac addresses that will
+# be used when creating new devices in virtual machines. The option accepts
+# two valid mac addresses separated by white spaces.
mac_pool_range = 52:54:01:00:00:01 52:54:01:FF:FF:FF
-#The rpcport options specifies the default port we will be connecting to, when
-#connecting to slave rpc servers.
-#The option accepts a single integer value.
+# The 'rpcport' options specifies the default port we will be connecting to,
+# when connecting to slave rpc servers. The option accepts a single integer
+# value.
rpcport = 9999
-#machine_pool_dirs specifies where the controller should look for specifications
-#of machines that can be used for matching templates inside recipes. This
-#option accepts a variable number of directory paths separated by white spaces.
-#It is also important to note that you can use the operator += to add to the
-#list of directories. If the operator = is used, the previous list is replaced.
+# This option specifies where the controller should look for specifications
+# of machines that can be used for matching templates inside recipes. It
+# accepts a variable number of directory paths separated by white spaces.
+# It is also important to note that you can use the operator += to add to
+# the list of directories. If the operator = is used, the previous list is
+# replaced.
machine_pool_dirs =
-#test_tool_dirs specifies where the controller looks for custom tools that
-#are used in tests. Every tool has it's own subdirectory in one of the
-#directories in this list. The option behaves the same way as the option
-#machine_pool_dirs, it accepts a list of directory paths and both operators,
+# 'test_tool_dirs' specifies where the controller looks for custom tools that
+# are used in tests. Every tool has it's own subdirectory in one of the
+# directories in this list. The option behaves the same way as the option
+# machine_pool_dirs, it accepts a list of directory paths and both operators,
# += and = can be used
test_tool_dirs = @ctl_tools_locations@
-#test_module_dirs specifies where the controller looks for custom test modules
-#the test modules need to be named Test<name>.py otherwise they won't be
-#recognized. The behaviour of the option is the same as test_tool_dirs, it
-#accepts a list of directory paths and both operators, += and = can be used.
+# 'test_module_dirs' specifies where the controller looks for custom test
+# modules the test modules need to be named Test<name>.py otherwise they won't
+# be recognized. The behaviour of the option is the same as test_tool_dirs, it
+# accepts a list of directory paths and both operators, += and = can be used.
test_module_dirs = @ctl_modules_locations@
-#log_dir option redirects the location of where logs are stored. Every run of
-#the application creates its own timestamped subdirectory in the path specified
-#in this option. The option accepts one directory path that will be created if
-#it doesn't exist. You cannot use the operator += here.
+# The 'resource_dir' option specifies, where are the generic resources
+# for LNST (such as XML schemas) installed. This option is set during the
+# installation and generally doesn't need to be changed (unless you know
+# what you're doing!).
+resource_dir = @ctl_resource_dir@
+
+# The 'log_dir' option redirects the location of where logs are stored. Every
+# run of the application creates its own timestamped subdirectory in the path
+# specified in this option. The option accepts one directory path that will
+# be created if it doesn't exist. You cannot use the operator += here.
log_dir = @ctl_logs_dir@
diff --git a/lnst/Common/Config.py b/lnst/Common/Config.py
index 67921d4..40e70da 100644
--- a/lnst/Common/Config.py
+++ b/lnst/Common/Config.py
@@ -64,6 +64,11 @@ class Config():
"additive" : False,
"action" : self.optionPath,
"name" : "log_dir"}
+ self.options['environment']['resource_dir'] = {\
+ "value" : "",
+ "additive" : False,
+ "action" : self.optionPath,
+ "name" : "resource_dir"}
self.colours_scheme()
diff --git a/setup.py b/setup.py
index 9fc6ebe..8f12344 100755
--- a/setup.py
+++ b/setup.py
@@ -45,6 +45,7 @@ MAN_DIR = "/usr/share/man/man1/"
CTL_MODULES_LOCATIONS = "/usr/share/lnst/test_modules/"
CTL_TOOLS_LOCATIONS = "/usr/share/lnst/test_tools/"
+CTL_RESOURCE_DIR = "/usr/share/lnst/"
CTL_LOGS_DIR = "~/.lnst/logs/"
SLAVE_LOGS_DIR = "/var/log/lnst"
@@ -57,6 +58,7 @@ TEMPLATES_VALUES = {
"ctl_modules_locations": CTL_MODULES_LOCATIONS,
"ctl_tools_locations": CTL_TOOLS_LOCATIONS,
+"ctl_resource_dir": CTL_RESOURCE_DIR,
"ctl_logs_dir": CTL_LOGS_DIR,
"slave_logs_dir": SLAVE_LOGS_DIR,
@@ -143,9 +145,11 @@ MULTICAST_TEST_TOOLS = [
MAN_PAGES = [(MAN_DIR, ["install/lnst-ctl.1.gz",
"install/lnst-slave.1.gz"])]
-CONFIG = [("/etc/", ["install/lnst-ctl.conf",
"install/lnst-slave.conf"])]
+CONFIG = [(CONF_DIR, ["install/lnst-ctl.conf",
"install/lnst-slave.conf"])]
-DATA_FILES = CONFIG + TEST_MODULES + MULTICAST_TEST_TOOLS + MAN_PAGES
+SCHEMAS = [(CTL_RESOURCE_DIR, ["schema-recipe.rng",
"schema-sm.rng"])]
+
+DATA_FILES = CONFIG + TEST_MODULES + MULTICAST_TEST_TOOLS + MAN_PAGES + SCHEMAS
setup(name="lnst",
version="git",