Skip to content

Commit

Permalink
Update to tomcat.py
Browse files Browse the repository at this point in the history
-Added "force" (default false) option commensurate with force option in salt.modules.tomcat.deploy_war to allow forced deployment of a .war even if the version strings match.
-Forced successful deploy comment to be a string instead of dict to compensate for #12840
Conflicts:
	salt/states/tomcat.py
  • Loading branch information
perdurabo93 authored and basepi committed Jun 25, 2014
1 parent e63eb5a commit 19c541f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions salt/states/tomcat.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __virtual__():
# Functions
def war_deployed(name,
war,
force,
url='http://localhost:8080/manager',
timeout=180):
'''
Expand All @@ -67,6 +68,8 @@ def war_deployed(name,
war
absolute path to WAR file (should be accessible by the user running
tomcat) or a path supported by the salt.modules.cp.get_url function
force:
force deploy even if version strings are the same, False by default.
url : http://localhost:8080/manager
the URL of the server manager webapp
timeout : 180
Expand Down Expand Up @@ -96,7 +99,7 @@ def war_deployed(name,

# Determine what to do
try:
if version != webapps[name]['version']:
if (version != webapps[name]['version']) or force:
deploy = True
undeploy = True
ret['changes']['undeploy'] = ('undeployed {0} in version {1}'.
Expand Down Expand Up @@ -141,15 +144,15 @@ def war_deployed(name,
# Deploy
deploy_res = __salt__['tomcat.deploy_war'](war,
name,
'yes',
force,
url,
__env__,
timeout)

# Return
if deploy_res.startswith('OK'):
ret['result'] = True
ret['comment'] = __salt__['tomcat.ls'](url, timeout)[name]
ret['comment'] = str(__salt__['tomcat.ls'](url, timeout)[name])
ret['changes']['deploy'] = 'deployed {0} in version {1}'.format(name,
version)
else:
Expand Down

0 comments on commit 19c541f

Please sign in to comment.