forked from ISTI-ansible-roles/ansible-roles
library/roles/smartgears/ckan_connector: Fix the web.xml configuration.
This commit is contained in:
parent
76237a9b6b
commit
b92af6a7da
|
@ -17,7 +17,7 @@
|
|||
creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/web.xml'
|
||||
|
||||
- name: Install the CKAN connector web.xml template
|
||||
template: src=ckan-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/web.xml mode=0440
|
||||
template: src=ckan-web.xml.j2 dest={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/.web.xml.tpl mode=0440
|
||||
|
||||
- name: Install the CKAN connector fixer script
|
||||
become: False
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
CK_WEB_DIR={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF
|
||||
CK_WEB_XML=$CK_WEB_DIR/web.xml
|
||||
CK_WEB_XML=$CK_WEB_DIR/.web.xml.tpl
|
||||
CK_WEB_XML_TMP=$CK_WEB_DIR/.web.xml.tmp
|
||||
CK_WEB_XML_DEST=$CK_WEB_DIR/web.xml
|
||||
CK_DB_NAME={{ ckan_db_name }}
|
||||
CK_DB_USER={{ ckan_db_user }}
|
||||
CK_DB_HOST={{ psql_db_host }}
|
||||
|
@ -36,29 +38,30 @@ CKAN_KEY=$( grep ^beaker\.session\.secret $CK_INI | awk '{ print $3 }' )
|
|||
|
||||
[ $? -ne 0 ] && exit 1
|
||||
|
||||
cp $CK_WEB_XML $CK_WEB_XML_TMP
|
||||
# Use the admin key on the connector web.xml
|
||||
if [ ! -z $API_KEY ] ; then
|
||||
sed -i -e "s#@CKAN_API_KEY@#${API_KEY}#g" $CK_WEB_XML
|
||||
sed -i -e "s#@CKAN_API_KEY@#${API_KEY}#g" $CK_WEB_XML_TMP
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use the ckan key on the connector web.xml
|
||||
if [ ! -z $CKAN_KEY ] ; then
|
||||
sed -i -e "s#@CKAN_SECRET@#${CKAN_KEY}#g" $CK_WEB_XML
|
||||
sed -i -e "s#@CKAN_SECRET@#${CKAN_KEY}#g" $CK_WEB_XML_TMP
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
{% endraw %}
|
||||
|
||||
chown {{ smartgears_user }}:{{ smartgears_user }} $CK_WEB_XML
|
||||
chmod 440 $CK_WEB_XML
|
||||
mv $CK_WEB_XML_TMP $CK_WEB_XML_DEST
|
||||
chown {{ smartgears_user }}:{{ smartgears_user }} $CK_WEB_XML_DEST
|
||||
chmod 440 $CK_WEB_XML_DEST
|
||||
|
||||
rm -f $SQL_FILE
|
||||
touch $CK_WEB_DIR/.web.xml.configured
|
||||
|
||||
{% endraw %}
|
||||
|
||||
|
||||
exit 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue