Repository: cekit/cekit

Issue:
Modules and packages defined in overrides are ignored
**Describe the bug**
When modules are defined in overrides, these are ignored.

* the modules to install variable were always empty unless you define the modules on the root image.yaml file.
* The packages install was also being ignored.

But if you define at least one package on the main image.yaml file, with that said, all packages listed to be installed in the overrides files are correctly configured.

**To reproduce**
Reproducer: https://github.com/spolti/submarine-cloud/tree/cekit

```bash
$ cekit -v build --overrides-file image.yaml --overrides-file kaas-quarkus-centos-s2i-overrides.yaml docker --no-squash
```
**Expected behavior**
Modules should be fetched and installed.

**Logs**
```
2019-04-19 09:23:16,156 cekit        DEBUG    Running version 3.0.0
2019-04-19 09:23:16,156 cekit        DEBUG    Configuring CEKit...
2019-04-19 09:23:16,157 cekit        INFO     You are running on known platform: Fedora 29 (Twenty Nine)
2019-04-19 09:23:16,157 cekit        DEBUG    Checking CEKit core dependencies...
2019-04-19 09:23:16,157 cekit        DEBUG    Checking if 'git' dependency is provided...
2019-04-19 09:23:16,157 cekit        DEBUG    CEKit dependency 'git' provided via the '/usr/bin/git' executable.
2019-04-19 09:23:16,158 cekit        DEBUG    All dependencies provided!
2019-04-19 09:23:16,228 cekit        INFO     Generating files for docker engine
2019-04-19 09:23:16,228 cekit        DEBUG    Loading override 'image.yaml'
2019-04-19 09:23:16,228 cekit        DEBUG    Reading descriptor from 'image.yaml' file...
2019-04-19 09:23:16,238 cekit        DEBUG    Loading override 'kaas-quarkus-centos-s2i-overrides.yaml'
2019-04-19 09:23:16,238 cekit        DEBUG    Reading descriptor from 'kaas-quarkus-centos-s2i-overrides.yaml' file...
2019-04-19 09:23:16,242 cekit        INFO     Initializing image descriptor...
2019-04-19 09:23:16,242 cekit        DEBUG    Checking CEKit generate dependencies...
2019-04-19 09:23:16,242 cekit        DEBUG    No dependencies found, skipping...
2019-04-19 09:23:16,242 cekit        DEBUG    Reading descriptor from 'image.yaml' file...
2019-04-19 09:23:16,254 cekit        DEBUG    Downloading module repository: 'modules'
2019-04-19 09:23:16,254 cekit        INFO     Preparing resource 'modules'
2019-04-19 09:23:16,254 cekit        DEBUG    Copying repository from '/home/goldmann/work/submarine/submarine-cloud/s2i/modules' to 'target/repo/modules'.
2019-04-19 09:23:16,260 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/kaas-quarkus-centos/module.yaml' file...
2019-04-19 09:23:16,261 cekit        DEBUG    Adding module 'kaas-quarkus-centos', path: 'target/repo/modules/kaas-quarkus-centos'
2019-04-19 09:23:16,262 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/kaas-springboot-centos/module.yaml' file...
2019-04-19 09:23:16,263 cekit        DEBUG    Adding module 'kaas-springboot-centos', path: 'target/repo/modules/kaas-springboot-centos'
2019-04-19 09:23:16,264 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/add-submarine-user/module.yaml' file...
2019-04-19 09:23:16,265 cekit        DEBUG    Adding module 'add-submarine-user', path: 'target/repo/modules/add-submarine-user'
2019-04-19 09:23:16,265 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/maven/3.6.0/module.yaml' file...
2019-04-19 09:23:16,271 cekit        DEBUG    Adding module 'maven', path: 'target/repo/modules/maven/3.6.0'
2019-04-19 09:23:16,271 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/kaas-springboot-centos-s2i/module.yaml' file...
2019-04-19 09:23:16,273 cekit        DEBUG    Adding module 'kaas-springboot-centos-s2i', path: 'target/repo/modules/kaas-springboot-centos-s2i'
2019-04-19 09:23:16,273 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/java-openjdk/1.8.0/module.yaml' file...
2019-04-19 09:23:16,276 cekit        DEBUG    Adding module 'java-openjdk', path: 'target/repo/modules/java-openjdk/1.8.0'
2019-04-19 09:23:16,277 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/graalvm/1.0.0-rc15/module.yaml' file...
2019-04-19 09:23:16,282 cekit        DEBUG    Adding module 'graalvm', path: 'target/repo/modules/graalvm/1.0.0-rc15'
2019-04-19 09:23:16,282 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/graalvm/1.0.0-rc14/module.yaml' file...
2019-04-19 09:23:16,287 cekit        DEBUG    Adding module 'graalvm', path: 'target/repo/modules/graalvm/1.0.0-rc14'
2019-04-19 09:23:16,287 cekit        DEBUG    Reading descriptor from '/home/goldmann/work/submarine/submarine-cloud/s2i/target/repo/modules/kaas-quarkus-centos-s2i/module.yaml' file...
2019-04-19 09:23:16,288 cekit        DEBUG    Adding module 'kaas-quarkus-centos-s2i', path: 'target/repo/modules/kaas-quarkus-centos-s2i'
2019-04-19 09:23:16,289 cekit        DEBUG    Loading configuration for repository: 'scl' from 'repositories'.
2019-04-19 09:23:16,293 cekit        DEBUG    No artifacts to fetch
2019-04-19 09:23:16,293 cekit        INFO     Rendering Dockerfile...
2019-04-19 09:23:16,325 cekit        DEBUG    Dockerfile rendered
2019-04-19 09:23:16,325 cekit        DEBUG    Checking CEKit build dependencies...
2019-04-19 09:23:16,325 cekit        DEBUG    Checking if 'python-docker' dependency is provided...
2019-04-19 09:23:16,325 cekit        DEBUG    Required CEKit library 'python-docker' was found as a 'docker' module!
2019-04-19 09:23:16,325 cekit        DEBUG    Checking if 'docker-squash' dependency is provided...
2019-04-19 09:23:16,325 cekit        DEBUG    Required CEKit library 'docker-squash' was found as a 'docker_squash' module!
2019-04-19 09:23:16,325 cekit        DEBUG    All dependencies provided!
2019-04-19 09:23:16,325 cekit        INFO     Building container image using Docker...
2019-04-19 09:23:16,325 cekit        DEBUG    Building image with tags: 'quay.io/kiegroup/kaas-quarkus-centos-s2i:1.0', 'quay.io/kiegroup/kaas-quarkus-centos-s2i:latest'
2019-04-19 09:23:16,353 cekit        INFO     Docker: Step 1/10 : FROM centos:latest
2019-04-19 09:23:16,353 cekit        INFO     Docker: ---> 75835a67d134
2019-04-19 09:23:16,354 cekit        INFO     Docker: Step 2/10 : USER root
2019-04-19 09:23:16,354 cekit        INFO     Docker: ---> Using cache
2019-04-19 09:23:16,355 cekit        INFO     Docker: ---> f772c4805a04
2019-04-19 09:23:16,355 cekit        INFO     Docker: Step 3/10 : RUN yum --setopt=tsflags=nodocs install -y centos-release-scl
2019-04-19 09:23:16,379 cekit        INFO     Docker: ---> Running in f0259fcb0198
2019-04-19 09:23:17,024 cekit        INFO     Docker: Loaded plugins: fastestmirror, ovl
2019-04-19 09:23:17,180 cekit        INFO     Docker: Determining fastest mirrors
2019-04-19 09:23:18,787 cekit        INFO     Docker: * base: ftp.icm.edu.pl
2019-04-19 09:23:18,789 cekit        INFO     Docker: * extras: ftp.agh.edu.pl
2019-04-19 09:23:18,789 cekit        INFO     Docker: * updates: ftp.icm.edu.pl
2019-04-19 09:23:20,932 cekit        INFO     Docker: Resolving Dependencies
2019-04-19 09:23:20,932 cekit        INFO     Docker: --> Running transaction check
2019-04-19 09:23:20,933 cekit        INFO     Docker: ---> Package centos-release-scl.noarch 0:2-3.el7.centos will be installed
2019-04-19 09:23:20,933 cekit        INFO     Docker: --> Processing Dependency: centos-release-scl-rh for package: centos-release-scl-2-3.el7.centos.noarch
2019-04-19 09:23:21,036 cekit        INFO     Docker: --> Running transaction check
2019-04-19 09:23:21,037 cekit        INFO     Docker: ---> Package centos-release-scl-rh.noarch 0:2-3.el7.centos will be installed
2019-04-19 09:23:21,143 cekit        INFO     Docker: --> Finished Dependency Resolution
2019-04-19 09:23:21,148 cekit        INFO     Docker: Dependencies Resolved
2019-04-19 09:23:21,149 cekit        INFO     Docker: ================================================================================
2019-04-19 09:23:21,149 cekit        INFO     Docker:  Package                    Arch        Version               Repository   Size
2019-04-19 09:23:21,149 cekit        INFO     Docker: ================================================================================
2019-04-19 09:23:21,149 cekit        INFO     Docker: Installing:
2019-04-19 09:23:21,150 cekit        INFO     Docker:  centos-release-scl         noarch      2-3.el7.centos        extras       12 k
2019-04-19 09:23:21,150 cekit        INFO     Docker: Installing for dependencies:
2019-04-19 09:23:21,150 cekit        INFO     Docker:  centos-release-scl-rh      noarch      2-3.el7.centos        extras       12 k
2019-04-19 09:23:21,150 cekit        INFO     Docker: 
2019-04-19 09:23:21,150 cekit        INFO     Docker: Transaction Summary
2019-04-19 09:23:21,150 cekit        INFO     Docker: ================================================================================
2019-04-19 09:23:21,150 cekit        INFO     Docker: Install  1 Package (+1 Dependent package)
2019-04-19 09:23:21,150 cekit        INFO     Docker: Total download size: 24 k
2019-04-19 09:23:21,151 cekit        INFO     Docker: Installed size: 39 k
2019-04-19 09:23:21,151 cekit        INFO     Docker: Downloading packages:
2019-04-19 09:23:21,297 cekit        INFO     Docker: warning: /var/cache/yum/x86_64/7/extras/packages/centos-release-scl-2-3.el7.centos.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
2019-04-19 09:23:21,299 cekit        INFO     Docker: Public key for centos-release-scl-2-3.el7.centos.noarch.rpm is not installed
2019-04-19 09:23:21,336 cekit        INFO     Docker: --------------------------------------------------------------------------------
2019-04-19 09:23:21,338 cekit        INFO     Docker: Total                                              130 kB/s |  24 kB  00:00
2019-04-19 09:23:21,340 cekit        INFO     Docker: Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2019-04-19 09:23:21,363 cekit        INFO     Docker: Importing GPG key 0xF4A80EB5:
2019-04-19 09:23:21,363 cekit        INFO     Docker:  Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
2019-04-19 09:23:21,363 cekit        INFO     Docker:  Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
2019-04-19 09:23:21,364 cekit        INFO     Docker:  Package    : centos-release-7-5.1804.4.el7.centos.x86_64 (@Updates)
2019-04-19 09:23:21,364 cekit        INFO     Docker:  From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2019-04-19 09:23:21,383 cekit        INFO     Docker: Running transaction check
2019-04-19 09:23:21,386 cekit        INFO     Docker: Running transaction test
2019-04-19 09:23:21,389 cekit        INFO     Docker: Transaction test succeeded
2019-04-19 09:23:21,390 cekit        INFO     Docker: Running transaction
2019-04-19 09:23:21,457 cekit        INFO     Docker: Installing : centos-release-scl-rh-2-3.el7.centos.noarch                  1/2
2019-04-19 09:23:21,491 cekit        INFO     Docker: Installing : centos-release-scl-2-3.el7.centos.noarch                     2/2
2019-04-19 09:23:21,526 cekit        INFO     Docker: Verifying  : centos-release-scl-2-3.el7.centos.noarch                     1/2
2019-04-19 09:23:21,564 cekit        INFO     Docker: Verifying  : centos-release-scl-rh-2-3.el7.centos.noarch                  2/2
2019-04-19 09:23:21,655 cekit        INFO     Docker: Installed:
2019-04-19 09:23:21,656 cekit        INFO     Docker:   centos-release-scl.noarch 0:2-3.el7.centos                                    
2019-04-19 09:23:21,656 cekit        INFO     Docker: 
2019-04-19 09:23:21,656 cekit        INFO     Docker: Dependency Installed:
2019-04-19 09:23:21,656 cekit        INFO     Docker:   centos-release-scl-rh.noarch 0:2-3.el7.centos
2019-04-19 09:23:21,656 cekit        INFO     Docker: Complete!
2019-04-19 09:23:22,218 cekit        INFO     Docker: ---> 4992839ab480
2019-04-19 09:23:22,237 cekit        INFO     Docker: Removing intermediate container f0259fcb0198
2019-04-19 09:23:22,238 cekit        INFO     Docker: Step 4/10 : ENV SUBMARINE_HOME "/home/submarine"
2019-04-19 09:23:22,301 cekit        INFO     Docker: ---> Running in ba06d489418a
2019-04-19 09:23:22,353 cekit        INFO     Docker: ---> 0c78d03a09fe
2019-04-19 09:23:22,365 cekit        INFO     Docker: Removing intermediate container ba06d489418a
2019-04-19 09:23:22,368 cekit        INFO     Docker: Step 5/10 : LABEL description "Platform for building KaaS based on Quarkus" io.cekit.version "3.0.0" io.k8s.description "Platform for building KaaS based on Quarkus" io.k8s.display-name "KaaS based on Quarkus" io.openshift.expose-services "8080:http" io.openshift.s2i.destination "/tmp" io.openshift.s2i.scripts-url "image:///usr/local/s2i" io.openshift.tags "builder,kaas,quarkus" maintainer "Submarine <submarine@kiegroup.com>" summary "Platform for building KaaS based on Quarkus"
2019-04-19 09:23:22,394 cekit        INFO     Docker: ---> Running in fe18f1aae942
2019-04-19 09:23:22,443 cekit        INFO     Docker: ---> 1cec8e93413c
2019-04-19 09:23:22,455 cekit        INFO     Docker: Removing intermediate container fe18f1aae942
2019-04-19 09:23:22,456 cekit        INFO     Docker: Step 6/10 : USER root
2019-04-19 09:23:22,482 cekit        INFO     Docker: ---> Running in 93c474562559
2019-04-19 09:23:22,535 cekit        INFO     Docker: ---> 151af8cd768c
2019-04-19 09:23:22,550 cekit        INFO     Docker: Removing intermediate container 93c474562559
2019-04-19 09:23:22,553 cekit        INFO     Docker: Step 7/10 : RUN [ ! -d /tmp/scripts ] || rm -rf /tmp/scripts
2019-04-19 09:23:22,588 cekit        INFO     Docker: ---> Running in b59dfb1b9967
2019-04-19 09:23:23,045 cekit        INFO     Docker: ---> 26e05fe4aeba
2019-04-19 09:23:23,055 cekit        INFO     Docker: Removing intermediate container b59dfb1b9967
2019-04-19 09:23:23,056 cekit        INFO     Docker: Step 8/10 : RUN [ ! -d /tmp/artifacts ] || rm -rf /tmp/artifacts
2019-04-19 09:23:23,082 cekit        INFO     Docker: ---> Running in a5235a2793b8
2019-04-19 09:23:23,530 cekit        INFO     Docker: ---> 2937f385d3ee
2019-04-19 09:23:23,539 cekit        INFO     Docker: Removing intermediate container a5235a2793b8
2019-04-19 09:23:23,539 cekit        INFO     Docker: Step 9/10 : USER 1001
2019-04-19 09:23:23,566 cekit        INFO     Docker: ---> Running in 8aaeb1978387
2019-04-19 09:23:23,634 cekit        INFO     Docker: ---> 5bb3085adf7b
2019-04-19 09:23:23,642 cekit        INFO     Docker: Removing intermediate container 8aaeb1978387
2019-04-19 09:23:23,642 cekit        INFO     Docker: Step 10/10 : CMD /usr/local/s2i/run
2019-04-19 09:23:23,669 cekit        INFO     Docker: ---> Running in bc9f4d8eeec5
2019-04-19 09:23:23,725 cekit        INFO     Docker: ---> 602d74a46e0b
2019-04-19 09:23:23,734 cekit        INFO     Docker: Removing intermediate container bc9f4d8eeec5
2019-04-19 09:23:23,734 cekit        INFO     Docker: Successfully built 602d74a46e0b
2019-04-19 09:23:23,755 cekit        INFO     Image built and available under following tags: quay.io/kiegroup/kaas-quarkus-centos-s2i:1.0, quay.io/kiegroup/kaas-quarkus-centos-s2i:latest
2019-04-19 09:23:23,755 cekit        INFO     Finished!
```

**Environment information:**
3.0.0

**Additional context**
None


Discussion:
goldmann: @jmtd @spolti @luck3y This is a fairly small PR, but I would like to ask you to test it before we do the release.

Patch:
diff --git a/cekit/builders/osbs.py b/cekit/builders/osbs.py
index 56ec962..f735056 100644
--- a/cekit/builders/osbs.py
+++ b/cekit/builders/osbs.py
@@ -257,7 +257,7 @@ class OSBSBuilder(Builder):
 
             # Get the url of the repository
             url = subprocess.check_output(
-                ["git", "remote", "get-url", "origin"]).strip().decode("utf8")
+                ["git", "config", "--get", "remote.origin.url"]).strip().decode("utf8")
             # Get the latest commit hash
             commit = subprocess.check_output(["git", "rev-parse", "HEAD"]).strip().decode("utf8")
             # Parse the dist-git repository url
diff --git a/cekit/descriptor/image.py b/cekit/descriptor/image.py
index 671b4ab..37c8a9b 100644
--- a/cekit/descriptor/image.py
+++ b/cekit/descriptor/image.py
@@ -246,7 +246,6 @@ class Image(Descriptor):
             if override.osbs != None:
                 self.osbs = override.osbs.merge(self.osbs)
 
-            # should we really allow overrides to contribute content?
             for package in override.packages.install:
                 if package not in self.packages.install:
                     self.packages.install.append(package)
@@ -271,9 +270,9 @@ class Image(Descriptor):
                 # collect override so we can apply it to modules.
                 # this allows us to override module versions without affecting ordering.
                 module_overrides[name] = module
-                if name in image_modules:
-                    # apply override to image descriptor
-                    image_modules[name] = module
+                # Apply override to image descriptor
+                # If the module does not exists in the original descriptor, add it there
+                image_modules[name] = module
             self.modules._descriptor['install'] = list(image_modules.values())
 
             if override.run != None:
diff --git a/cekit/descriptor/module.py b/cekit/descriptor/module.py
index f4cbcf8..5b9b474 100644
--- a/cekit/descriptor/module.py
+++ b/cekit/descriptor/module.py
@@ -33,4 +33,4 @@ class Module(Image):
 
     @property
     def execute(self):
-        return self.get('execute', [])
+        return self.get('execute')
diff --git a/cekit/descriptor/modules.py b/cekit/descriptor/modules.py
index 52c828e..72fe741 100644
--- a/cekit/descriptor/modules.py
+++ b/cekit/descriptor/modules.py
@@ -27,11 +27,11 @@ class Modules(Descriptor):
 
     @property
     def repositories(self):
-        return self.get('repositories', [])
+        return self.get('repositories')
 
     @property
     def install(self):
-        return self.get('install', [])
+        return self.get('install')
 
 
 
diff --git a/cekit/descriptor/packages.py b/cekit/descriptor/packages.py
index 8e2739b..d0dc740 100644
--- a/cekit/descriptor/packages.py
+++ b/cekit/descriptor/packages.py
@@ -71,17 +71,19 @@ class Packages(Descriptor):
         self._descriptor['repositories'] = [Repository(x)
                                             for x in self._descriptor.get('repositories', [])]
 
+        self._descriptor['install'] = self._descriptor.get('install', [])
+
     @property
     def manager(self):
         return self.get('manager')
 
     @property
     def repositories(self):
-        return self.get('repositories', [])
+        return self.get('repositories')
 
     @property
     def install(self):
-        return self.get('install', [])
+        return self.get('install')
 
     @property
     def content_sets(self):


Test patch:
diff --git a/tests/test_builder.py b/tests/test_builder.py
index 234a255..a7dad3f 100644
--- a/tests/test_builder.py
+++ b/tests/test_builder.py
@@ -186,7 +186,7 @@ def test_osbs_builder_run_brew_stage(mocker):
     builder.run()
 
     check_output.assert_has_calls([
-        call(['git', 'remote', 'get-url', 'origin']),
+        call(['git', 'config', '--get', 'remote.origin.url']),
         call(['git', 'rev-parse', 'HEAD']),
         call(['/usr/bin/brew-stage', 'call', '--python', 'buildContainer', '--kwargs',
               "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}"])
@@ -206,7 +206,7 @@ def test_osbs_builder_run_brew(mocker):
     builder.run()
 
     check_output.assert_has_calls([
-        call(['git', 'remote', 'get-url', 'origin']),
+        call(['git', 'config', '--get', 'remote.origin.url']),
         call(['git', 'rev-parse', 'HEAD']),
         call(['/usr/bin/brew', 'call', '--python', 'buildContainer', '--kwargs',
               "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}"])
@@ -224,7 +224,7 @@ def test_osbs_builder_run_koji(mocker):
     builder.run()
 
     check_output.assert_has_calls([
-        call(['git', 'remote', 'get-url', 'origin']),
+        call(['git', 'config', '--get', 'remote.origin.url']),
         call(['git', 'rev-parse', 'HEAD']),
         call(['/usr/bin/koji', 'call', '--python', 'buildContainer', '--kwargs',
               "{'src': 'git://something.redhat.com/containers/openjdk#c5a0731b558c8a247dd7f85b5f54462cd5b68b23', 'target': 'some-branch-containers-candidate', 'opts': {'scratch': True, 'git_branch': 'some-branch', 'yum_repourls': []}}"])
diff --git a/tests/test_validate.py b/tests/test_validate.py
index b2694b6..b932300 100644
--- a/tests/test_validate.py
+++ b/tests/test_validate.py
@@ -55,6 +55,13 @@ image_descriptor = {
                 'install': [{'name': 'foo'}]}
 }
 
+simple_image_descriptor = {
+    'schema_version': 1,
+    'from': 'centos:latest',
+    'name': 'test/image',
+    'version': '1.0'
+}
+
 feature_label_test = """
 @test
 Feature: Test test
@@ -408,6 +415,51 @@ def test_module_override(tmpdir, mocker):
     assert check_dockerfile(image_dir, 'RUN [ "bash", "-x", "/tmp/scripts/foo/script" ]')
 
 
+# https://github.com/cekit/cekit/issues/489
+def test_override_add_module_and_packages_in_overrides(tmpdir, mocker):
+    image_dir = str(tmpdir.mkdir('source'))
+    copy_repos(image_dir)
+
+    with open(os.path.join(image_dir, 'image.yaml'), 'w') as fd:
+        yaml.dump(simple_image_descriptor, fd, default_flow_style=False)
+
+    overrides_descriptor = {
+        'schema_version': 1,
+        'modules': {
+            'repositories': [
+                {
+                    'name': 'modules',
+                    'path': 'tests/modules/repo_3'
+                }
+            ]
+        }
+    }
+
+    with open(os.path.join(image_dir, 'overrides.yaml'), 'w') as fd:
+        yaml.dump(overrides_descriptor, fd, default_flow_style=False)
+
+    run_cekit(image_dir,
+              ['-v',
+               'build',
+               '--dry-run',
+               '--overrides-file', 'overrides.yaml',
+               '--overrides', '{"modules": {"install": [{"name": "master"}, {"name": "child"}] } }',
+               '--overrides', '{"packages": {"install": ["package1", "package2"] } }',
+               '--overrides', '{"artifacts": [{"name": "test", "path": "image.yaml"}] }',
+               'docker'])
+
+    module_dir = os.path.join(image_dir,
+                              'target',
+                              'image',
+                              'modules',
+                              'foo')
+
+    assert check_dockerfile(
+        image_dir, 'RUN yum --setopt=tsflags=nodocs install -y package1 package2 \\')
+    assert check_dockerfile(image_dir, 'RUN [ "bash", "-x", "/tmp/scripts/master/script_a" ]')
+    assert check_dockerfile_text(image_dir, 'COPY \\\n    test \\\n    /tmp/artifacts/')
+
+
 def check_dockerfile(image_dir, match):
     with open(os.path.join(image_dir, 'target', 'image', 'Dockerfile'), 'r') as fd:
         for line in fd.readlines():