Update Openstack, add missed steps to upgrade computes
Additional changes:
* Refactored switch_to_proposed_pipelines to avoid multiply executions
Change-Id: If9b0c460bdbf41b8248dc3cb5f0d2f486b47e954
diff --git a/tcp_tests/managers/reclass_manager.py b/tcp_tests/managers/reclass_manager.py
index 8448169..f8895c6 100644
--- a/tcp_tests/managers/reclass_manager.py
+++ b/tcp_tests/managers/reclass_manager.py
@@ -11,7 +11,6 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
-
from tcp_tests import logger
from tcp_tests.managers.execute_commands import ExecuteCommandsMixin
@@ -69,18 +68,40 @@
path=short_path
))
- def get_key(self, key, short_path):
+ def get_key(self, key, file_name):
"""Find a key in a YAML
:param key: string, parameter to add
- :param short_path: path to reclass yaml file.
- It takes into account default path where the reclass is located.
- May look like cluster/*/cicd/control/leader.yml
+ :param file_name: name of YAML file to find a key
:return: str, key if found
"""
- return self.ssh.check_call(
- "{reclass_tools} get-key {key} /srv/salt/reclass/classes".format(
- reclass_tools=self.reclass_tools_cmd, key=key))
+ request_key = self.ssh.check_call(
+ "{reclass_tools} get-key {key} /srv/salt/reclass/*/{file_name}".
+ format(reclass_tools=self.reclass_tools_cmd,
+ key=key,
+ file_name=file_name))['stdout']
+
+ # Reclass-tools returns result to stdout, so we get it as
+ # ['\n',
+ # '---\n',
+ # '# Found parameters._param.jenkins_pipelines_branch in \
+ # /srv/salt/reclass/classes/cluster/../infra/init.yml\n',
+ # 'release/proposed/2019.2.0\n',
+ # '...\n',
+ # '\n']
+ # So we have no chance to get value without dirty code like `stdout[3]`
+
+ LOG.info("From reclass.get_key {}".format(request_key))
+ if len(request_key) < 4:
+ assert "Can't find {key} in {file_name}. Got stdout {stdout}".\
+ format(
+ key=key,
+ file_name=file_name,
+ stdout=request_key
+ )
+ value = request_key[3].strip('\n')
+ LOG.info("From reclass.get_key {}".format(value))
+ return value
def add_bool_key(self, key, value, short_path):
"""