diff --git a/salt/modules/tomcat.py b/salt/modules/tomcat.py index 1780eccf3e..3bb608eb2f 100644 --- a/salt/modules/tomcat.py +++ b/salt/modules/tomcat.py @@ -453,7 +453,7 @@ def deploy_war(war, url : http://localhost:8080/manager the URL of the server manager webapp env : base - the environment for WAR file in used by salt.modules.cp.get_file + the environment for WAR file in used by salt.modules.cp.get_url function timeout : 180 timeout for HTTP request @@ -477,10 +477,12 @@ def deploy_war(war, # Copy file name if needed tfile = war - if war[0] != '/': + cache = False + if not os.path.isfile(war): + cache = True tfile = os.path.join(tempfile.gettempdir(), 'salt.' + os.path.basename(war)) - cached = __salt__['cp.get_file'](war, tfile, env) + cached = __salt__['cp.get_url'](war, tfile, env) if not cached: return 'FAIL - could not cache the WAR file' try: @@ -502,7 +504,7 @@ def deploy_war(war, res = '\n'.join(deployed['msg']) # Cleanup - if war[0] != '/': + if cache: __salt__['file.remove'](tfile) return res diff --git a/salt/states/tomcat.py b/salt/states/tomcat.py index 7e7d2d8b0b..c928f232e7 100644 --- a/salt/states/tomcat.py +++ b/salt/states/tomcat.py @@ -64,7 +64,7 @@ def war_deployed(name, war, url='http://localhost:8080/manager', the context path to deploy war absolute path to WAR file (should be accessible by the user running - tomcat) or a path supported by the salt.modules.cp.get_file function + tomcat) or a path supported by the salt.modules.cp.get_url function url : http://localhost:8080/manager the URL of the server manager webapp timeout : 180