Add new method to ReclassManager to easy edit the reclass models. PROD-36050
Change-Id: Iab007f21abbd00cdc085e999dc8e4b035e93d4a7
diff --git a/tcp_tests/managers/reclass_manager.py b/tcp_tests/managers/reclass_manager.py
index ab6bd72..56116fc 100644
--- a/tcp_tests/managers/reclass_manager.py
+++ b/tcp_tests/managers/reclass_manager.py
@@ -182,6 +182,29 @@
path=short_path
))
+ def merge_context(self, yaml_context, short_path):
+ """
+ Merge
+
+ :param yaml_context: string, yaml with extra context
+ :param short_path: string, path to reclass yaml file.
+ It takes into account default path where the reclass locates.
+ May look like cluster/*/cicd/control/leader.yml
+ :return: None
+ """
+ tmp_file = "/tmp/extra_context.yaml"
+ with open(tmp_file, "w") as f:
+ f.write(yaml_context)
+
+ self.ssh.upload(tmp_file, tmp_file)
+ self.ssh.check_call(
+ "{reclass_tools} merge-context {yaml} \
+ /srv/salt/reclass/classes/{path}".format(
+ reclass_tools=self.reclass_tools_cmd,
+ yaml=tmp_file,
+ path=short_path
+ ))
+
def commit(self, text_commit):
self.ssh.check_call(
"cd /srv/salt/reclass; git add -u && git commit --allow-empty "