Rename option add_subdir_to_node to compose_node_name
diff --git a/README-extentions.rst b/README-extentions.rst
index f57b760..2053a2d 100644
--- a/README-extentions.rst
+++ b/README-extentions.rst
@@ -509,7 +509,7 @@
access to the database and included by the database server as well.
-Add subfolders to node name
+Compose node name
---------------------------
Nodes can be defined in subdirectories. However, node names (filename) must be unique across all subdirectories.
@@ -525,7 +525,7 @@
.. code-block:: yaml
- add_subdir_to_node: True # default False
+ compose_node_name: True # default False
This adds the subfolder to the node name and the structure above can then be used. It generates the following reclass objects:
diff --git a/reclass/__init__.py b/reclass/__init__.py
index 82fa0ab..2167a30 100644
--- a/reclass/__init__.py
+++ b/reclass/__init__.py
@@ -15,9 +15,9 @@
from .storage.loader import StorageBackendLoader
from .storage.memcache_proxy import MemcacheProxy
-def get_storage(storage_type, nodes_uri, classes_uri, add_subdir_to_node, **kwargs):
+def get_storage(storage_type, nodes_uri, classes_uri, compose_node_name, **kwargs):
storage_class = StorageBackendLoader(storage_type).load()
- return MemcacheProxy(storage_class(nodes_uri, classes_uri, add_subdir_to_node, **kwargs))
+ return MemcacheProxy(storage_class(nodes_uri, classes_uri, compose_node_name, **kwargs))
def get_path_mangler(storage_type,**kwargs):
return StorageBackendLoader(storage_type).path_mangler()
diff --git a/reclass/adapters/ansible.py b/reclass/adapters/ansible.py
index 3ebe575..be67198 100755
--- a/reclass/adapters/ansible.py
+++ b/reclass/adapters/ansible.py
@@ -69,7 +69,7 @@
storage = get_storage(options.storage_type,
options.nodes_uri,
options.classes_uri,
- options.add_subdir_to_node)
+ options.compose_node_name)
class_mappings = defaults.get('class_mappings')
defaults.update(vars(options))
settings = Settings(defaults)
diff --git a/reclass/adapters/salt.py b/reclass/adapters/salt.py
index 10a6a43..523b0c4 100755
--- a/reclass/adapters/salt.py
+++ b/reclass/adapters/salt.py
@@ -31,12 +31,12 @@
classes_uri=OPT_CLASSES_URI,
class_mappings=None,
propagate_pillar_data_to_reclass=False,
- add_subdir_to_node=OPT_ADD_SUBDIR_TO_NODE,
+ compose_node_name=OPT_COMPOSE_NODE_NAME,
**kwargs):
path_mangler = get_path_mangler(storage_type)
nodes_uri, classes_uri = path_mangler(inventory_base_uri, nodes_uri, classes_uri)
- storage = get_storage(storage_type, nodes_uri, classes_uri, add_subdir_to_node)
+ storage = get_storage(storage_type, nodes_uri, classes_uri, compose_node_name)
input_data = None
if propagate_pillar_data_to_reclass:
input_data = pillar
@@ -55,12 +55,12 @@
def top(minion_id, storage_type=OPT_STORAGE_TYPE,
inventory_base_uri=OPT_INVENTORY_BASE_URI, nodes_uri=OPT_NODES_URI,
- classes_uri=OPT_CLASSES_URI, class_mappings=None, add_subdir_to_node=OPT_ADD_SUBDIR_TO_NODE,
+ classes_uri=OPT_CLASSES_URI, class_mappings=None, compose_node_name=OPT_COMPOSE_NODE_NAME,
**kwargs):
path_mangler = get_path_mangler(storage_type)
nodes_uri, classes_uri = path_mangler(inventory_base_uri, nodes_uri, classes_uri)
- storage = get_storage(storage_type, nodes_uri, classes_uri, add_subdir_to_node)
+ storage = get_storage(storage_type, nodes_uri, classes_uri, compose_node_name)
settings = Settings(kwargs)
reclass = Core(storage, class_mappings, settings, input_data=None)
diff --git a/reclass/cli.py b/reclass/cli.py
index 89f3a8b..38bd5fc 100644
--- a/reclass/cli.py
+++ b/reclass/cli.py
@@ -34,7 +34,7 @@
storage = get_storage(options.storage_type,
options.nodes_uri,
options.classes_uri,
- options.add_subdir_to_node)
+ options.compose_node_name)
class_mappings = defaults.get('class_mappings')
defaults.update(vars(options))
settings = Settings(defaults)
diff --git a/reclass/config.py b/reclass/config.py
index cc3c35e..d24f7fd 100644
--- a/reclass/config.py
+++ b/reclass/config.py
@@ -36,8 +36,8 @@
ret.add_option('-z', '--ignore-class-notfound', dest='ignore_class_notfound',
default=defaults.get('ignore_class_notfound', OPT_IGNORE_CLASS_NOTFOUND),
help='decision for not found classes [%default]')
- ret.add_option('-a', '--add-subdir-to-node', dest='add_subdir_to_node', action="store_true",
- default=defaults.get('add_subdir_to_node', OPT_ADD_SUBDIR_TO_NODE),
+ ret.add_option('-a', '--compose-node-name', dest='compose_node_name', action="store_true",
+ default=defaults.get('compose_node_name', OPT_COMPOSE_NODE_NAME),
help='Add subdir when generating node names. [%default]')
ret.add_option('-x', '--ignore-class-notfound-regexp', dest='ignore_class_notfound_regexp',
default=defaults.get('ignore_class_notfound_regexp', OPT_IGNORE_CLASS_NOTFOUND_REGEXP),
diff --git a/reclass/defaults.py b/reclass/defaults.py
index 095ff36..f240f3f 100644
--- a/reclass/defaults.py
+++ b/reclass/defaults.py
@@ -21,7 +21,7 @@
OPT_CLASSES_URI = 'classes'
OPT_PRETTY_PRINT = True
OPT_GROUP_ERRORS = True
-OPT_ADD_SUBDIR_TO_NODE = False
+OPT_COMPOSE_NODE_NAME = False
OPT_NO_REFS = False
OPT_OUTPUT = 'yaml'
diff --git a/reclass/settings.py b/reclass/settings.py
index f2a6e1b..3e223cc 100644
--- a/reclass/settings.py
+++ b/reclass/settings.py
@@ -32,7 +32,7 @@
self.reference_sentinels = options.get('reference_sentinels', REFERENCE_SENTINELS)
self.ignore_class_notfound = options.get('ignore_class_notfound', OPT_IGNORE_CLASS_NOTFOUND)
self.strict_constant_parameters = options.get('strict_constant_parameters', OPT_STRICT_CONSTANT_PARAMETERS)
- self.add_subdir_to_node = options.get('add_subdir_to_node', OPT_ADD_SUBDIR_TO_NODE)
+ self.compose_node_name = options.get('compose_node_name', OPT_COMPOSE_NODE_NAME)
self.ignore_class_notfound_regexp = options.get('ignore_class_notfound_regexp', OPT_IGNORE_CLASS_NOTFOUND_REGEXP)
if isinstance(self.ignore_class_notfound_regexp, string_types):
@@ -67,7 +67,7 @@
and self.ignore_class_notfound_regexp == other.ignore_class_notfound_regexp \
and self.ignore_class_notfound_warning == other.ignore_class_notfound_warning \
and self.strict_constant_parameters == other.strict_constant_parameters \
- and self.add_subdir_to_node == other.add_subdir_to_node
+ and self.compose_node_name == other.compose_node_name
def __copy__(self):
cls = self.__class__
diff --git a/reclass/storage/yaml_fs/__init__.py b/reclass/storage/yaml_fs/__init__.py
index e511d44..88f0ec4 100644
--- a/reclass/storage/yaml_fs/__init__.py
+++ b/reclass/storage/yaml_fs/__init__.py
@@ -55,12 +55,12 @@
class ExternalNodeStorage(NodeStorageBase):
- def __init__(self, nodes_uri, classes_uri, add_subdir_to_node):
+ def __init__(self, nodes_uri, classes_uri, compose_node_name):
super(ExternalNodeStorage, self).__init__(STORAGE_NAME)
if nodes_uri is not None:
self._nodes_uri = nodes_uri
- if add_subdir_to_node:
+ if compose_node_name:
self._nodes = self._enumerate_inventory(nodes_uri, NameMangler.classes)
else:
self._nodes = self._enumerate_inventory(nodes_uri, NameMangler.nodes)
diff --git a/reclass/tests/test_core.py b/reclass/tests/test_core.py
index c79630a..047bf24 100644
--- a/reclass/tests/test_core.py
+++ b/reclass/tests/test_core.py
@@ -28,7 +28,7 @@
path_mangler = get_path_mangler('yaml_fs')
nodes_uri, classes_uri = path_mangler(inventory_uri, 'nodes', 'classes')
settings = Settings(opts)
- storage = get_storage('yaml_fs', nodes_uri, classes_uri, settings.add_subdir_to_node)
+ storage = get_storage('yaml_fs', nodes_uri, classes_uri, settings.compose_node_name)
return Core(storage, None, settings)
def test_type_conversion(self):