Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Commit

Permalink
Log warning about usage of the deprecated resolve tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikael Johansson committed Mar 31, 2016
1 parent c59fcd8 commit b1e3ef2
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 9 deletions.
6 changes: 5 additions & 1 deletion src/lighter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,13 @@ def parse_service(filename, targetdir=None, verifySecrets=False):
# Fetch and merge json template from maven
if util.rget(document, 'maven', 'version') or util.rget(document, 'maven', 'resolve'):
coord = document['maven']
versionspec = coord.get('version')
if not versionspec:
versionspec = coord['resolve']
logging.warn("The 'resolve:' tag is deprecated, please switch to 'version:' which is a drop-in replacement in %s" % filename)

resolver = maven.ArtifactResolver(coord['repository'], coord['groupid'], coord['artifactid'], coord.get('classifier'))
version = resolver.resolve(coord.get('version') or coord['resolve'])
version = resolver.resolve(versionspec)

artifact = resolver.fetch(version)
config = util.merge(config, artifact.body)
Expand Down
2 changes: 1 addition & 1 deletion src/lighter/test/deploy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def testResolveMavenJson(self):
lighter.deploy('http://localhost:1/', filenames=['src/resources/yaml/integration/myservice.yml'])
self.assertTrue(self._called)

def testRangeInVersionTag(self):
def testDeprecatedResolveTag(self):
"""
Checks that version ranges can be resolved in the "version: " tag as well
"""
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice'
resolve: '[1.0.0,1.1.0)'
version: '[1.0.0,1.1.0)'
override:
env:
TRUE: '123'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice'
resolve: '[1.0.0,1.1.0)'
version: '[1.0.0,1.1.0)'
override:
env:
INTVAR: 123
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice'
resolve: '[1.0.0,1.1.0)'
version: '[1.0.0,1.1.0)'
override:
cpus: 1.0
env:
DATABASE: 'database:3306'
DATABASE: 'database:3306'
2 changes: 1 addition & 1 deletion src/resources/yaml/integration/myservice-version-range.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice'
version: '[1.0.0,1.1.0)'
resolve: '[1.0.0,1.1.0)'
override:
cpus: 1.0
env:
Expand Down
2 changes: 1 addition & 1 deletion src/resources/yaml/integration/myservice.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice'
resolve: '[1.0.0,1.1.0)'
version: '[1.0.0,1.1.0)'
override:
cpus: 1.0
env:
Expand Down
2 changes: 1 addition & 1 deletion src/resources/yaml/staging/myservice-unique-snapshot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
maven:
groupid: 'com.meltwater'
artifactid: 'myservice-snapshot'
resolve: '[,]-SNAPSHOT'
version: '[,]-SNAPSHOT'
classifier: 'marathon'
override:
cpus: 1.0
Expand Down

0 comments on commit b1e3ef2

Please sign in to comment.