add possibility of redefine parameter
possibility to define parameter nodes_uri
(thats allow targeting node-config-dir)
trough salt-metadata to avoid issues, when
reclass inventory failed due incorrect node configurations
even if broken-configs does not used
related to: https://gerrit.mcp.mirantis.net/#/c/7818/3
Change-Id: I009a7434cc0372361bb2e44374534ee95aefcd19
diff --git a/_modules/reclass.py b/_modules/reclass.py
index eace0bf..4dc988d 100644
--- a/_modules/reclass.py
+++ b/_modules/reclass.py
@@ -115,7 +115,8 @@
def _get_nodes_dir():
defaults = find_and_read_configfile()
- return os.path.join(defaults.get('inventory_base_uri'), 'nodes')
+ return defaults.get('nodes_uri') or \
+ os.path.join(defaults.get('inventory_base_uri'), 'nodes')
def _get_classes_dir():
diff --git a/metadata/service/storage/salt.yml b/metadata/service/storage/salt.yml
index a597727..7f18493 100644
--- a/metadata/service/storage/salt.yml
+++ b/metadata/service/storage/salt.yml
@@ -7,6 +7,7 @@
storage:
enabled: true
base_dir: /srv/salt/reclass
+ nodes_uri:
output: yaml
data_source:
engine: git
diff --git a/reclass/files/reclass-config.yml b/reclass/files/reclass-config.yml
index 5fb1490..9314923 100644
--- a/reclass/files/reclass-config.yml
+++ b/reclass/files/reclass-config.yml
@@ -3,9 +3,12 @@
pretty_print: True
output: {{ storage.get('output', 'json') }}
inventory_base_uri: {{ storage.base_dir }}
+{%- if storage.nodes_uri is defined %}
+nodes_uri: {{ nodes_uri }}
+{%- endif %}
{%- if storage.class_mappings is defined %}
class_mappings:
{%- for mapping in storage.class_mappings %}
- {{ mapping.target }} {{ mapping.class }}
{%- endfor %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}