From 807ea1032a07936343ffad96e7c26b21400e949c Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Mar 20 2017 13:01:56 +0000
Subject: [PATCH 1/3] added better config handling, and allow use defaultmodule parameter in config yaml file


---

diff --git a/docs/example-config.yaml b/docs/example-config.yaml
index 3b7a612..562f2a6 100644
--- a/docs/example-config.yaml
+++ b/docs/example-config.yaml
@@ -11,6 +11,7 @@ packages:
 testdependecies:
     rpms:
         - nc
+defaultmodule: docker
 module:
     docker:
         start: "docker run -it -e CACHE_SIZE=128 -p 11211:11211"
diff --git a/moduleframework/module_framework.py b/moduleframework/module_framework.py
index c82e909..c1d4016 100644
--- a/moduleframework/module_framework.py
+++ b/moduleframework/module_framework.py
@@ -33,15 +33,9 @@ class CommonFunctions():
 
     def loadconfig(self):
         self.__modulemdConf = None
-        xconfig = os.environ.get('CONFIG') if os.environ.get(
-            'CONFIG') else "config.yaml"
-        with open(xconfig, 'r') as ymlfile:
-            self.config = yaml.load(ymlfile)
-            if self.config['document'] != 'modularity-testing':
-                print "Bad config file"
-                sys.exit(1)
-            self.packages = self.config['packages']['rpms']
-            self.moduleName = self.config['name']
+        self.config = get_correct_config()
+        self.packages = self.config['packages']['rpms']
+        self.moduleName = self.config['name']
         self.installTestDependencies()
 
     def getModulemdYamlconfig(self, urllink=None):
@@ -312,8 +306,11 @@ class RpmAvocadoTest(AvocadoTest):
     """
     pass
 
-
 def get_correct_backend(amodule=os.environ.get('MODULE')):
+    readconfig = CommonFunctions()
+    readconfig.loadconfig()
+    if readconfig.config.has_key("defaultmodule") and readconfig.config["defaultmodule"] is not None and amodule == None:
+        amodule = readconfig.config["defaultmodule"]
     if amodule == 'docker':
         return ContainerHelper(), amodule
     elif amodule == 'rpm':
@@ -328,3 +325,14 @@ def get_correct_profile(amodule=os.environ.get('PROFILE')):
 
 def get_correct_url(amodule=os.environ.get('URL')):
     return amodule
+
+def get_correct_config(cfgfile=os.environ.get('CONFIG')):
+    if not cfgfile:
+        cfgfile="config.yaml"
+    if not os.path.exists(cfgfile):
+        raise ValueError("Config file (%s) does not exist or is inaccesible (you can also redefine own by CONFIG=path/to/configfile.yaml env variable)" % cfgfile)
+    with open(cfgfile, 'r') as ymlfile:
+        xcfg = yaml.load(ymlfile)
+        if xcfg['document'] != 'modularity-testing':
+            raise ValueError("Bad Config file, not yaml or does not contain proper document type" % cfgfile)
+    return xcfg

From c78e06d339d77279b9bc855b7e77e5cf5671ef88 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Mar 20 2017 13:27:49 +0000
Subject: [PATCH 2/3] added underline bw words


---

diff --git a/docs/example-config.yaml b/docs/example-config.yaml
index 562f2a6..cfdee83 100644
--- a/docs/example-config.yaml
+++ b/docs/example-config.yaml
@@ -11,7 +11,7 @@ packages:
 testdependecies:
     rpms:
         - nc
-defaultmodule: docker
+default_module: docker
 module:
     docker:
         start: "docker run -it -e CACHE_SIZE=128 -p 11211:11211"
diff --git a/moduleframework/module_framework.py b/moduleframework/module_framework.py
index c1d4016..c22cd13 100644
--- a/moduleframework/module_framework.py
+++ b/moduleframework/module_framework.py
@@ -309,8 +309,8 @@ class RpmAvocadoTest(AvocadoTest):
 def get_correct_backend(amodule=os.environ.get('MODULE')):
     readconfig = CommonFunctions()
     readconfig.loadconfig()
-    if readconfig.config.has_key("defaultmodule") and readconfig.config["defaultmodule"] is not None and amodule == None:
-        amodule = readconfig.config["defaultmodule"]
+    if readconfig.config.has_key("default_module") and readconfig.config["default_module"] is not None and amodule == None:
+        amodule = readconfig.config["default_module"]
     if amodule == 'docker':
         return ContainerHelper(), amodule
     elif amodule == 'rpm':

From 41f676682a7d1db66f34311a45c1e31e47041f40 Mon Sep 17 00:00:00 2001
From: Jan Scotka <jscotka@redhat.com>
Date: Mar 20 2017 13:33:36 +0000
Subject: [PATCH 3/3] Automatic commit of package [modularity-testing-framework] release [0.1.6-1].


Created by command:

/usr/bin/tito tag

---

diff --git a/.tito/packages/modularity-testing-framework b/.tito/packages/modularity-testing-framework
index d1e9fb3..1e3ffee 100644
--- a/.tito/packages/modularity-testing-framework
+++ b/.tito/packages/modularity-testing-framework
@@ -1 +1 @@
-0.1.5-1 ./
+0.1.6-1 ./
diff --git a/modularity-testing-framework.spec b/modularity-testing-framework.spec
index e6ed955..8874370 100644
--- a/modularity-testing-framework.spec
+++ b/modularity-testing-framework.spec
@@ -1,5 +1,5 @@
 Name:           modularity-testing-framework
-Version:        0.1.5
+Version:        0.1.6
 Release:        1%{?dist}
 Summary:        Framework for writing tests for modules and containers
 
@@ -41,6 +41,18 @@ install -d -m 755 %{buildroot}%{_datadir}/moduleframework
 
 
 %changelog
+* Mon Mar 20 2017 Jan Scotka <jscotka@redhat.com> 0.1.6-1
+- added underline bw words (jscotka@redhat.com)
+- added better config handling, and allow use defaultmodule parameter in config
+  yaml file (jscotka@redhat.com)
+- changed fedora path to public webs (psklenar@masox.brq.redhat.com)
+- init of haproxy test (psklenar@masox.brq.redhat.com)
+- added explicitly calling start for docker copy functions (jscotka@redhat.com)
+- small changes of tox (jscotka@redhat.com)
+- added tox file to project for CI (jscotka@redhat.com)
+- added tox.ini for CI and improved makefile inside tests for CI
+  (jscotka@redhat.com)
+
 * Thu Mar 16 2017 Jan Scotka <jscotka@redhat.com> 0.1.5-1
 - added possibility call bash stile in config.yaml (jscotka@redhat.com)
 - typo (jscotka@redhat.com)

