Repository: jboss-dockerfiles/dogen

Issue:
Rename "url" in sources to "artifact"
It doesn't need to be a URL, it can be a filename only too. It's a bit misleading to call it "url".

Discussion:
dbecvarik: url should be deprecated only, otherwise it will make all of current descriptors unusable.

Patch:
diff --git a/dogen/generator.py b/dogen/generator.py
index 52fa501..d59602d 100644
--- a/dogen/generator.py
+++ b/dogen/generator.py
@@ -58,7 +58,7 @@ class Generator(object):
         r = requests.get(location, verify=self.ssl_verify, stream=True)
 
         if r.status_code != 200:
-            raise Exception("Could not download file from %s" % location)
+            raise Error("Could not download file from %s" % location)
 
         with open(output, 'wb') as f:
             for chunk in r.iter_content(chunk_size=1024):
@@ -253,10 +253,23 @@ class Generator(object):
         self.cfg['artifacts'] = {}
 
         for source in self.cfg['sources']:
-            url = source['url']
-            target = source.get('target')
+            url = source.get('url')
+            artifact = source.get('artifact')
+
+            if url:
+                self.log.warn("The 'url' key is deprecated, please use 'artifact' for specifying the %s artifact location" % url)
+
+                if artifact:
+                    self.log.warn("You specified both: 'artifact' and 'url' for a source file, 'artifact': will be used: %s" % artifact)
+                else:
+                    # Backward compatibility
+                    artifact = url
 
-            basename = os.path.basename(url)
+            if not artifact:
+                raise Error("Artifact location for one or more sources was not provided, please check your image descriptor!")
+
+            basename = os.path.basename(artifact)
+            target = source.get('target')
 
             # In case we specify target name for the artifact - use it
             if not target:
@@ -270,7 +283,7 @@ class Generator(object):
             md5sum = source.get('md5sum')
 
             if md5sum:
-                self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % url)
+                self.log.warn("The 'md5sum' key is deprecated, please use 'md5' for %s. Or better switch to sha256 or sha1." % artifact)
 
                 # Backwards compatibility for md5sum
                 if not source.get('md5'):
@@ -295,17 +308,17 @@ class Generator(object):
                 sources_cache = os.environ.get("DOGEN_SOURCES_CACHE")
 
                 if sources_cache:
-                    url = sources_cache.replace('#filename#', basename)
+                    artifact = sources_cache.replace('#filename#', basename)
 
                     if algorithms:
                         if len(algorithms) > 1:
-                            self.log.warn("You specified multiple algorithms for '%s' url, but only '%s' will be used to fetch it from cache" % (url, algorithms[0]))
+                            self.log.warn("You specified multiple algorithms for '%s' artifact, but only '%s' will be used to fetch it from cache" % (artifact, algorithms[0]))
 
-                        url = url.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
+                        artifact = artifact.replace('#hash#', source[algorithms[0]]).replace('#algorithm#', algorithms[0])
 
-                    self.log.info("Using '%s' as cached location for artifact" % url)
+                    self.log.info("Using '%s' as cached location for artifact" % artifact)
 
-                self._fetch_file(url, filename)
+                self._fetch_file(artifact, filename)
 
                 if algorithms:
                     for algorithm in algorithms:
@@ -327,6 +340,6 @@ class Generator(object):
         filesum = hash.hexdigest()
 
         if filesum.lower() != checksum.lower():
-            raise Exception("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum))
+            raise Error("The %s computed for the '%s' file ('%s') doesn't match the '%s' value" % (algorithm, filename, filesum, checksum))
 
         self.log.debug("Hash is correct.")
diff --git a/dogen/schema/kwalify_schema.yaml b/dogen/schema/kwalify_schema.yaml
index a54aa67..b8035d1 100644
--- a/dogen/schema/kwalify_schema.yaml
+++ b/dogen/schema/kwalify_schema.yaml
@@ -66,8 +66,9 @@ map:
   sources:
     seq:
       - map:
-          url: {type: str}
-          md5sum: {type: str}
+          url: {type: str} # deprecated, use artifact
+          artifact: {type: str}
+          md5sum: {type: str} # deprecated, use md5
           md5: {type: str}
           sha1: {type: str}
           sha256: {type: str}
diff --git a/dogen/template_helper.py b/dogen/template_helper.py
index 3e88f03..e36693b 100644
--- a/dogen/template_helper.py
+++ b/dogen/template_helper.py
@@ -10,7 +10,7 @@ class TemplateHelper(object):
         if target:
             return target
 
-        return os.path.basename(source['url'])
+        return os.path.basename(source['artifact'])
 
     def cmd(self, arr):
         """


Test patch:
diff --git a/tests/schemas/good/openshift_amq_6.2_image.yaml b/tests/schemas/good/openshift_amq_6.2_image.yaml
index fa4f3cf..2cde6e8 100644
--- a/tests/schemas/good/openshift_amq_6.2_image.yaml
+++ b/tests/schemas/good/openshift_amq_6.2_image.yaml
@@ -51,10 +51,10 @@ scripts:
     - package: os-amq-permissions
       exec: install.sh
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-activemq-plugin-1.0.0.Final-redhat-1.jar
       md5: 325fbbaff0f7dbea42203346d9c3bf98
-    - url: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar
+    - artifact: http://redacted/jboss-dmr-1.2.2.Final-redhat-1.jar
       md5: 8df4cbf6f39c3bce21de16ad708084d5
 
diff --git a/tests/schemas/good/openshift_datagrid_6.5_image.yaml b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
index b20b77e..67ff7a1 100644
--- a/tests/schemas/good/openshift_datagrid_6.5_image.yaml
+++ b/tests/schemas/good/openshift_datagrid_6.5_image.yaml
@@ -150,17 +150,17 @@ scripts:
       exec: configure.sh
       user: 185
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/javax.json-1.0.4.jar
+    - artifact: http://redacted/javax.json-1.0.4.jar
       md5: 569870f975deeeb6691fcb9bc02a9555
-    - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+    - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
       md5: 7c743e35463db5f55f415dd666d705c5
-    - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
       md5: bafa4db7efe4082d76cde2fa9499bf84
-    - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
       md5: 71bbfdf795a2c65e4473df242f765490
-    - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
       md5: 145add030a89c3ed588dce27b0f24999
-    - url: http://redacted/oauth-20100527.jar
+    - artifact: http://redacted/oauth-20100527.jar
       md5: 91c7c70579f95b7ddee95b2143a49b41
diff --git a/tests/schemas/good/openshift_eap_6.4_image.yaml b/tests/schemas/good/openshift_eap_6.4_image.yaml
index 2b24f39..0ab9029 100644
--- a/tests/schemas/good/openshift_eap_6.4_image.yaml
+++ b/tests/schemas/good/openshift_eap_6.4_image.yaml
@@ -97,23 +97,23 @@ scripts:
       exec: configure.sh
       user: 185
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/javax.json-1.0.4.jar
+    - artifact: http://redacted/javax.json-1.0.4.jar
       md5: 569870f975deeeb6691fcb9bc02a9555
-    - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+    - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
       md5: 7c743e35463db5f55f415dd666d705c5
-    - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
       md5: bafa4db7efe4082d76cde2fa9499bf84
-    - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
       md5: 71bbfdf795a2c65e4473df242f765490
-    - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
       md5: 145add030a89c3ed588dce27b0f24999
-    - url: http://redacted/oauth-20100527.jar
+    - artifact: http://redacted/oauth-20100527.jar
       md5: 91c7c70579f95b7ddee95b2143a49b41
-    - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+    - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
       md5: 207e17ac8102c93233fe2764d1fe8499
-    - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
       md5: 6fd81306ea4297307dcc5f51712e5f95
-    - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
       md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_eap_7.0_image.yaml b/tests/schemas/good/openshift_eap_7.0_image.yaml
index 08f5a5c..7c0c4b4 100644
--- a/tests/schemas/good/openshift_eap_7.0_image.yaml
+++ b/tests/schemas/good/openshift_eap_7.0_image.yaml
@@ -106,23 +106,23 @@ scripts:
       exec: configure.sh
       user: 185
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/javax.json-1.0.4.jar
+    - artifact: http://redacted/javax.json-1.0.4.jar
       md5: 569870f975deeeb6691fcb9bc02a9555
-    - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+    - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
       md5: 7c743e35463db5f55f415dd666d705c5
-    - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
       md5: bafa4db7efe4082d76cde2fa9499bf84
-    - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
       md5: 71bbfdf795a2c65e4473df242f765490
-    - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
       md5: 145add030a89c3ed588dce27b0f24999
-    - url: http://redacted/oauth-20100527.jar
+    - artifact: http://redacted/oauth-20100527.jar
       md5: 91c7c70579f95b7ddee95b2143a49b41
-    - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+    - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
       md5: 207e17ac8102c93233fe2764d1fe8499
-    - url: http://redacted/rh-sso-7.0.0-eap7-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-eap7-adapter.zip
       md5: 1542c1014d9ebc24522839a5fa8bee4d
-    - url: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-saml-eap7-adapter.zip
       md5: ce858a47c707b362a968ffd5c66768dd
diff --git a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
index 953fa45..9c5855d 100644
--- a/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
+++ b/tests/schemas/good/openshift_fuse-camel_6.3_image.yaml
@@ -100,23 +100,23 @@ scripts:
       user: 185
       exec: configure.sh
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/javax.json-1.0.4.jar
+    - artifact: http://redacted/javax.json-1.0.4.jar
       md5: 569870f975deeeb6691fcb9bc02a9555
-    - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+    - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
       md5: 7c743e35463db5f55f415dd666d705c5
-    - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
       md5: bafa4db7efe4082d76cde2fa9499bf84
-    - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
       md5: 71bbfdf795a2c65e4473df242f765490
-    - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
       md5: 145add030a89c3ed588dce27b0f24999
-    - url: http://redacted/oauth-20100527.jar
+    - artifact: http://redacted/oauth-20100527.jar
       md5: 91c7c70579f95b7ddee95b2143a49b41
-    - url: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
+    - artifact: http://redacted/activemq-rar-5.11.0.redhat-621084.rar
       md5: 207e17ac8102c93233fe2764d1fe8499
-    - url: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-eap6-adapter.zip
       md5: 6fd81306ea4297307dcc5f51712e5f95
-    - url: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
+    - artifact: http://redacted/rh-sso-7.0.0-saml-eap6-adapter.zip
       md5: 3b953c114dd09f86e71e18cd57d8af56
diff --git a/tests/schemas/good/openshift_kieserver_6.2_image.yaml b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
index 3a1bd93..77134f3 100644
--- a/tests/schemas/good/openshift_kieserver_6.2_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.2_image.yaml
@@ -129,12 +129,12 @@ scripts:
       user: 185
       exec: configure.sh
 sources:
-    - url: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip
+    - artifact: http://redacted/jboss-bpmsuite-6.2.1.GA-redhat-2-deployable-eap6.x.zip
       md5: b63c7dfe82a44a140cce3a824c8c2e90
-    - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
       md5: 5858103206d0bcc4695aad38a7430c75
-    - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
       md5: 4a80b12399c49a1d274bbd1c62b49b65
-    - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
       md5: adf602d027020b30cc5743d3d5d8e2f7
 
diff --git a/tests/schemas/good/openshift_kieserver_6.3_image.yaml b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
index caf4912..010b945 100644
--- a/tests/schemas/good/openshift_kieserver_6.3_image.yaml
+++ b/tests/schemas/good/openshift_kieserver_6.3_image.yaml
@@ -130,13 +130,13 @@ scripts:
       user: 185
       exec: configure.sh
 sources:
-    - url: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip
+    - artifact: http://redacted/jboss-bpmsuite-6.3.0.GA-deployable-eap6.x.zip
       md5: 4e283717b0f295adf7025971065d6db8
-    - url: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip
+    - artifact: http://redacted/jboss-bpmsuite-6.3.0.GA-supplementary-tools.zip
       md5: b3d135e2d297f1e89d9ff8357c1e9aac
-    - url: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-common-1.0.2.Final-redhat-1.jar
       md5: 5858103206d0bcc4695aad38a7430c75
-    - url: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-jms-1.0.2.Final-redhat-1.jar
       md5: 4a80b12399c49a1d274bbd1c62b49b65
-    - url: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-kieserver-web-1.0.2.Final-redhat-1.jar
       md5: adf602d027020b30cc5743d3d5d8e2f7
diff --git a/tests/schemas/good/openshift_sso_7.0_image.yaml b/tests/schemas/good/openshift_sso_7.0_image.yaml
index 76cee4f..0c43530 100644
--- a/tests/schemas/good/openshift_sso_7.0_image.yaml
+++ b/tests/schemas/good/openshift_sso_7.0_image.yaml
@@ -96,18 +96,18 @@ scripts:
     - package: os-sso
       exec: configure.sh
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/javax.json-1.0.4.jar
+    - artifact: http://redacted/javax.json-1.0.4.jar
       md5: 569870f975deeeb6691fcb9bc02a9555
-    - url: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
+    - artifact: http://redacted/jboss-logmanager-ext-1.0.0.Alpha2-redhat-1.jar
       md5: 7c743e35463db5f55f415dd666d705c5
-    - url: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-common-1.0.0.Final-redhat-1.jar
       md5: bafa4db7efe4082d76cde2fa9499bf84
-    - url: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-dns-1.0.0.Final-redhat-1.jar
       md5: 71bbfdf795a2c65e4473df242f765490
-    - url: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
+    - artifact: http://redacted/openshift-ping-kube-1.0.0.Final-redhat-1.jar
       md5: 145add030a89c3ed588dce27b0f24999
-    - url: http://redacted/oauth-20100527.jar
+    - artifact: http://redacted/oauth-20100527.jar
       md5: 91c7c70579f95b7ddee95b2143a49b41
 
diff --git a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
index 4c4d54e..c7e5991 100644
--- a/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat7_3.0_image.yaml
@@ -93,11 +93,11 @@ scripts:
       user: 185
       exec: configure.sh
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/json-smart-1.1.1.jar
+    - artifact: http://redacted/json-smart-1.1.1.jar
       md5: c382c9109020d001b96329c2057ba933
-    - url: http://redacted/commons-lang-2.6.0.redhat-4.jar
+    - artifact: http://redacted/commons-lang-2.6.0.redhat-4.jar
       md5: 0da0fbfb0ff2160df3a4832d28003361
-    - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
+    - artifact: http://redacted/jsonevent-layout-1.7-redhat-1.jar
       md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
index 6a0b095..b7039a3 100644
--- a/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
+++ b/tests/schemas/good/openshift_webserver-tomcat8_3.0_image.yaml
@@ -93,11 +93,11 @@ scripts:
       user: 185
       exec: configure.sh
 sources:
-    - url: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
+    - artifact: http://redacted/jolokia-jvm-1.3.2.redhat-1-agent.jar
       md5: 1b996b9083f537917b307309b0e2f16d
-    - url: http://redacted/json-smart-1.1.1.jar
+    - artifact: http://redacted/json-smart-1.1.1.jar
       md5: c382c9109020d001b96329c2057ba933
-    - url: http://redacted/commons-lang-2.6.0.redhat-4.jar
+    - artifact: http://redacted/commons-lang-2.6.0.redhat-4.jar
       md5: 0da0fbfb0ff2160df3a4832d28003361
-    - url: http://redacted/jsonevent-layout-1.7-redhat-1.jar
+    - artifact: http://redacted/jsonevent-layout-1.7-redhat-1.jar
       md5: 08f9aa037ac91c4aaa0d5dabf143a60e
diff --git a/tests/test_unit_generate_configuration.py b/tests/test_unit_generate_configuration.py
index 531ee8e..268f9d5 100644
--- a/tests/test_unit_generate_configuration.py
+++ b/tests/test_unit_generate_configuration.py
@@ -245,7 +245,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_without_specified_md5sum(self, mock_fetch_file):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -257,7 +257,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -270,7 +270,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_multiple_hashes(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -284,7 +284,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_multiple_hashes_and_cache_url(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
 
         k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
         k.start()
@@ -301,7 +301,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_deprecated_md5sum(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5sum: e9013fc202c87be48e3b302df10efc4b".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -314,7 +314,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_sha1(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    sha1: 105bfe02a86ba69be5506cd559a54c4b252fb132".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -327,7 +327,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_sha256(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    sha256: 9912afca5a08e9e05174c5fbb7a9a1510283d5952f90796c6a3e8bc78217e2fb".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -341,7 +341,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_when_local_file_exists_and_is_correct(self, mock_fetch_file, mock_check_sum, mock_path):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -354,7 +354,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_when_local_file_exists_and_is_broken(self, mock_fetch_file, mock_check_sum, mock_path):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -366,7 +366,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_target_filename(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
 
         generator = Generator(self.log, self.args)
         generator.configure()
@@ -378,7 +378,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_cache_url(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b".encode())
 
         k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
         k.start()
@@ -393,7 +393,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_cache_url_and_target_filename(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
 
         k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/get?#algorithm#=#hash#'})
         k.start()
@@ -408,7 +408,7 @@ class TestConfig(unittest.TestCase):
     @mock.patch('dogen.generator.Generator._fetch_file')
     def test_handling_sources_with_cache_url_with_filename_to_replace(self, mock_fetch_file, mock_check_sum):
         with self.descriptor as f:
-            f.write("sources:\n  - url: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
+            f.write("sources:\n  - artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
 
         k = mock.patch.dict(os.environ, {'DOGEN_SOURCES_CACHE':'http://cache/#filename#'})
         k.start()
@@ -418,3 +418,31 @@ class TestConfig(unittest.TestCase):
         k.stop()
 
         mock_fetch_file.assert_called_with('http://cache/file.zip', 'target/target.zip')
+
+    # https://github.com/jboss-dockerfiles/dogen/issues/132
+    @mock.patch('dogen.generator.Generator.check_sum')
+    @mock.patch('dogen.generator.Generator._fetch_file')
+    def test_handling_sources_with_url_and_artifact_keys_set(self, mock_fetch_file, mock_check_sum):
+        with self.descriptor as f:
+            f.write("sources:\n  - url: http://something.com\n    artifact: http://somehost.com/file.zip\n    md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
+
+        generator = Generator(self.log, self.args)
+        generator.configure()
+        generator.handle_sources()
+
+        self.log.warn.assert_any_call("The 'url' key is deprecated, please use 'artifact' for specifying the http://something.com artifact location")
+        self.log.warn.assert_any_call("You specified both: 'artifact' and 'url' for a source file, 'artifact': will be used: http://somehost.com/file.zip")
+        mock_fetch_file.assert_called_with('http://somehost.com/file.zip', 'target/target.zip')
+
+    @mock.patch('dogen.generator.Generator._fetch_file')
+    def test_handling_sources_should_fail_when_no_artifact_nor_url_is_provided(self, mock_fetch_file):
+        with self.descriptor as f:
+            f.write("sources:\n  - md5: e9013fc202c87be48e3b302df10efc4b\n    target: target.zip".encode())
+
+        generator = Generator(self.log, self.args)
+        generator.configure()
+
+        with self.assertRaises(Error) as cm:
+            generator.handle_sources()
+
+        self.assertEquals(str(cm.exception), "Artifact location for one or more sources was not provided, please check your image descriptor!")