From 17c805d5a7321550c9dc1f30ce308b68fe82ca25 Mon Sep 17 00:00:00 2001 From: Nils Philippsen Date: May 12 2017 10:56:18 +0000 Subject: fix typo in test dependencies section --- diff --git a/docs/example-config.yaml b/docs/example-config.yaml index 5c1be04..277f973 100644 --- a/docs/example-config.yaml +++ b/docs/example-config.yaml @@ -29,7 +29,7 @@ packages: - default # packages what will be installed on host machine (for example nc (netcat) for testing if module # provides service on port exported to host) -testdependecies: +testdependencies: rpms: - nc # default module type for testing if not set by env variable diff --git a/docs/howtowriteyamlconf.md b/docs/howtowriteyamlconf.md index 47c5116..afe6721 100644 --- a/docs/howtowriteyamlconf.md +++ b/docs/howtowriteyamlconf.md @@ -17,7 +17,7 @@ packages: rpms: - memcached - perl-Carp -testdependecies: +testdependencies: rpms: - nc ``` @@ -26,7 +26,7 @@ testdependecies: * `compose-url:` final compose build (done by pungi) it contains repositories + moduleMD infromations for tooling * `service:` In case module is service like memcached, store there port number, can be then used in tests, to not hardcode port number *(Optional)* * `packages:` Which packages will be installed inside module (docker container, guest, any type of module) - * `testdependecies:` Install dependencies on host, what are important for module testing, for example when you would like to use `nc`, you have to install it explicitly, it is not in cloud images. + * `testdependencies:` Install dependencies on host, what are important for module testing, for example when you would like to use `nc`, you have to install it explicitly, it is not in cloud images. ## Module types specification It contains specification for each type of module, now for __rpm__ and __docker__ based modules diff --git a/examples/haproxy/config.yaml b/examples/haproxy/config.yaml index 1c3e267..bf6fb68 100644 --- a/examples/haproxy/config.yaml +++ b/examples/haproxy/config.yaml @@ -7,7 +7,7 @@ service: packages: rpms: - haproxy -testdependecies: +testdependencies: rpms: - nc - docker diff --git a/examples/memcached/config.yaml b/examples/memcached/config.yaml index 3b7a612..623410f 100644 --- a/examples/memcached/config.yaml +++ b/examples/memcached/config.yaml @@ -8,7 +8,7 @@ packages: rpms: - memcached - perl-Carp -testdependecies: +testdependencies: rpms: - nc module: diff --git a/examples/multios_testing/config.yaml b/examples/multios_testing/config.yaml index d9eee0e..aed834b 100644 --- a/examples/multios_testing/config.yaml +++ b/examples/multios_testing/config.yaml @@ -9,7 +9,7 @@ packages: #- centos-release - psmisc - procps-ng -testdependecies: +testdependencies: rpms: - nc - fedora-release diff --git a/examples/ngnix/config.yaml b/examples/ngnix/config.yaml index efa83a8..b5d3793 100644 --- a/examples/ngnix/config.yaml +++ b/examples/ngnix/config.yaml @@ -4,7 +4,7 @@ name: ngnix modulemd-url: https://raw.githubusercontent.com/container-images/nginx/master/nginx.yaml service: port: 80 -testdependecies: +testdependencies: rpms: - curl module: diff --git a/moduleframework/module_framework.py b/moduleframework/module_framework.py index 3c900ea..2936a0a 100644 --- a/moduleframework/module_framework.py +++ b/moduleframework/module_framework.py @@ -45,6 +45,7 @@ import pdc_data from common import * from timeoutlib import Retry import time +import warnings PROFILE = None @@ -93,9 +94,21 @@ class CommonFunctions(object): :param packages: List of packages, if not set, it will install rpms from config.yaml :return: None """ - if not packages and 'testdependecies' in self.config and 'rpms' in self.config[ - 'testdependecies']: - packages = self.config['testdependecies']['rpms'] + if not packages: + typo = 'testdependecies' in self.config + if typo: + warnings.warn("'testdependecies' is a typo, please fix", + DeprecationWarning) + + # try section without typo first + packages = self.config.get('testdependencies', {}).get('rpms') + if packages: + if typo: + warnings.warn("preferring section without typo") + else: + # fall back to mistyped test dependency section + packages = self.config.get('testdependecies', {}).get('rpms') + if packages: self.runHost( "{HOSTPACKAGER} install ".format(**trans_dict) +