
Vertica JDBC jar can't be redistributed so require user to place jar in directory where vagrant up is done. This cookbook will then place the jar in the correct place. Also, updated maintainer information in metadata.rb Change-Id: I426d9585b4564872b5ad43eed4e2082148b5597b
71 lines
1.5 KiB
Ruby
71 lines
1.5 KiB
Ruby
# encoding: UTF-8#
|
|
#
|
|
|
|
package 'mon-api' do
|
|
action :upgrade
|
|
end
|
|
|
|
service 'mon-api' do
|
|
action :enable
|
|
provider Chef::Provider::Service::Upstart
|
|
end
|
|
|
|
directory '/var/log/mon-api' do
|
|
recursive true
|
|
owner node[:mon_api][:owner]
|
|
group node[:mon_api][:group]
|
|
mode 0755
|
|
action :create
|
|
end
|
|
|
|
creds = data_bag_item(node[:mon_api][:data_bag], 'mon_credentials')
|
|
setting = data_bag_item(node[:mon_api][:data_bag], 'mon_api')
|
|
|
|
# Create the config file
|
|
template '/etc/mon/mon-api-config.yml' do
|
|
action :create
|
|
owner 'root'
|
|
group node[:mon_api][:group]
|
|
mode '640'
|
|
source 'mon-service-config.yml.erb'
|
|
variables(
|
|
creds: creds,
|
|
setting: setting
|
|
)
|
|
notifies :restart, 'service[mon-api]'
|
|
end
|
|
|
|
if setting['database-configuration']['database-type'] == 'vertica'
|
|
|
|
# Create the directory for the vertica JDBC jar
|
|
directory '/opt/mon/vertica' do
|
|
recursive true
|
|
owner 'root'
|
|
group 'root'
|
|
mode 0755
|
|
action :create
|
|
end
|
|
|
|
# Copy the vertica jdbc jar from /vagrant
|
|
bash 'vertica_jdbc.jar' do
|
|
action :run
|
|
code <<-EOL
|
|
DEST=/opt/mon/vertica/vertica_jdbc.jar
|
|
if [ ! -s ${DEST} ]; then
|
|
SRC=`ls /vagrant/vertica-jdbc-*.jar`
|
|
if [ $? != 0 ]; then
|
|
echo 'You must place a Vertica JDBC jar in the directory where you do the "vagrant up"' 1>&2
|
|
exit 1
|
|
fi
|
|
cp "$SRC" $DEST
|
|
RC=$?
|
|
if [ $RC != 0 ]; then
|
|
exit $RC
|
|
fi
|
|
chown root:root $DEST
|
|
chmod 0555 $DEST
|
|
fi
|
|
EOL
|
|
end
|
|
end
|