Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Merge pull request #174 from Alfresco/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Enzo Rivello authored Dec 2, 2016
2 parents 50b21e0 + e76d0da commit df9771d
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 5 deletions.
7 changes: 7 additions & 0 deletions attributes/libreoffice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
default['libreoffice']['initialise'] = false
default['libreoffice']['command']['host'] = '127.0.0.1'
default['libreoffice']['command']['accept'] = "\"--accept=socket,host=#{node['libreoffice']['command']['host']},port=#{node['alfresco']['properties']['jodconverter.portNumbers']};urp;\""
default['libreoffice']['command']['user_installation_path'] = "/var/cache/tomcat-alfresco/temp/.jodconverter_socket_host-#{node['libreoffice']['command']['host']}_port-#{node['alfresco']['properties']['jodconverter.portNumbers']}"
default['libreoffice']['command']['env'] = "-env:UserInstallation=file://#{node['libreoffice']['command']['user_installation_path']}"
default['libreoffice']['command']['params'] = '--headless --nocrashreport --nodefault --nofirststartwizard --nolockcheck --nologo --norestore'
default['libreoffice']['command']['full'] = "#{node['libreoffice']['command']['accept']} #{node['libreoffice']['command']['env']} #{node['libreoffice']['command']['params']}"
1 change: 1 addition & 0 deletions attributes/transformations.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default['libreoffice']['user'] = node['alfresco']['user']
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
issues_url 'https://github.com/Alfresco/chef-alfresco/issues'
source_url 'https://github.com/Alfresco/chef-alfresco'
version '0.7.14'
version '0.7.15'

supports 'centos', '>= 7.0'
supports 'redhat', '>= 7.0'
Expand Down
18 changes: 18 additions & 0 deletions recipes/initialise_libreoffice.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
execute 'start_libreoffice' do
command "#{node['alfresco']['properties']['jodconverter.officeHome']}program/soffice.bin #{node['libreoffice']['command']['full']}"
user node['libreoffice']['user']
group node['libreoffice']['user']
returns 81
creates node['libreoffice']['command']['user_installation_path']
only_if { node['alfresco']['components'].include?('transform') }
not_if { Mixlib::ShellOut.new('pgrep -f soffice.bin').run_command.exitstatus == 0 }
notifies :delete, "directory[#{node['libreoffice']['command']['user_installation_path']}]", :immediately
ignore_failure true
end

directory node['libreoffice']['command']['user_installation_path'] do
recursive true
action :nothing
user node['libreoffice']['user']
group node['libreoffice']['user']
end
1 change: 1 addition & 0 deletions recipes/redeploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# The derived values (ie node['artifacts']['share']['version'] = node['alfresco']['version'])
# would not take the right value, if a calling cookbook changes (ie default['alfresco']['version'])
#
include_recipe 'alfresco::initialise_libreoffice' if node['libreoffice']['initialise']
include_recipe "tomcat::_attributes"
include_recipe "alfresco::_common-attributes"
include_recipe "alfresco::_tomcat-attributes"
Expand Down
8 changes: 6 additions & 2 deletions recipes/transformations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

remote_file "#{Chef::Config[:file_cache_path]}/#{libre_office_tar_name}" do
source libre_office_tar_url
owner 'root'
group 'root'
owner node['libreoffice']['user']
group node['libreoffice']['user']
end

execute 'unpack-libreoffice' do
Expand All @@ -43,6 +43,10 @@
command "yum -y localinstall #{Chef::Config[:file_cache_path]}/#{libre_office_name}/RPMS/*.rpm"
not_if "yum list installed | grep libreoffice"
end

execute 'change-libreoffice-permissions' do
command "chown #{node['libreoffice']['user']}:#{node['libreoffice']['user']} -R #{node['alfresco']['properties']['jodconverter.officeHome']}"
end
end

if node['platform_family'] == "ubuntu"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/community/inspec/components_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

describe file("/opt/libreoffice4.4/") do
it { should exist }
its('owner') { should eq 'root' }
it { should be_owned_by 'tomcat' }
end

describe command("cat /usr/share/tomcat/shared/classes/alfresco-global.properties") do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
describe "LibreOffice installation" do
describe file("/opt/libreoffice4.4/") do
it { should exist }
it { should be_owned_by 'root' }
it { should be_owned_by 'tomcat' }
end

describe command("cat /usr/share/tomcat/shared/classes/alfresco-global.properties") do
Expand Down

0 comments on commit df9771d

Please sign in to comment.