Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33fe251

Browse files
committed
Fixed missing actions, added path
1 parent 383fc40 commit 33fe251

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

libraries/provider_java_remote_file.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ def load_current_resource
2828
super
2929
end
3030

31+
def action_deploy
32+
action_create_if_missing
33+
end
34+
35+
def action_force_deploy
36+
action_create
37+
end
3138
end
3239
end
3340
end

libraries/resource_java_remote_file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
class Chef
2323
class Resource
2424
class JavaRemoteFile < Chef::Resource::RemoteFile
25-
2625
alias :user :owner
2726
alias :revision :checksum
2827
alias :repository :source
@@ -32,6 +31,7 @@ def initialize(name, run_context=nil)
3231
@resource_name = :java_remote_file
3332
@provider = Chef::Provider::JavaRemoteFile
3433
@deploy_to = nil
34+
@allowed_actions.push(:deploy, :force_deploy)
3535
end
3636

3737
def provider

providers/tomcat.rb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@
3737

3838
# remove ROOT application
3939
# TODO create a LWRP to enable/disable tomcat apps
40-
directory "#{node['tomcat']['webapp_dir']}/ROOT" do
41-
recursive true
42-
action :delete
43-
not_if "test -L #{node['tomcat']['context_dir']}/ROOT.xml"
40+
if new_resource.path == "/" or new_resource == "ROOT"
41+
directory "#{node['tomcat']['webapp_dir']}/ROOT" do
42+
recursive true
43+
action :delete
44+
not_if "test -L #{node['tomcat']['context_dir']}/ROOT.xml"
45+
end
4446
end
4547

4648
end
@@ -50,7 +52,9 @@
5052

5153
action :before_symlink do
5254

53-
link "#{node['tomcat']['context_dir']}/ROOT.xml" do
55+
path = new_resource.path == "/" ? "ROOT" : new_resource.pathnew_resource.path
56+
57+
link "#{node['tomcat']['context_dir']}/#{path}.xml" do
5458
to "#{new_resource.application.path}/shared/#{new_resource.application.name}.xml"
5559
notifies :restart, resources(:service => "tomcat")
5660
end

resources/tomcat.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@
1818
#
1919

2020
include Chef::Resource::ApplicationBase
21+
attribute :path, :default => "ROOT"

templates/default/context.xml.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Context docBase="<%= @war %>" path="/"
1+
<Context docBase="<%= @war %>"
22
debug="5" reloadable="true" crossContext="true" allowLinking="true">
33
<Environment name="appEnvironment" value="<%= node.chef_environment %>"
44
type="java.lang.String" override="false"/>

0 commit comments

Comments
 (0)