library/roles/smartgears/ckan_connector: Fix the web.xml configuration.

This commit is contained in:
Andrea Dell'Amico 2016-07-22 10:44:57 +02:00
parent 76237a9b6b
commit b92af6a7da
2 changed files with 11 additions and 8 deletions

View File

@ -17,7 +17,7 @@
creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/web.xml' creates: '{{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF/web.xml'
- name: Install the CKAN connector web.xml template - 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 - name: Install the CKAN connector fixer script
become: False become: False

View File

@ -1,7 +1,9 @@
#!/bin/bash #!/bin/bash
CK_WEB_DIR={{ smartgears_instance_path }}/webapps/ckan-connector/WEB-INF 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_NAME={{ ckan_db_name }}
CK_DB_USER={{ ckan_db_user }} CK_DB_USER={{ ckan_db_user }}
CK_DB_HOST={{ psql_db_host }} 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 [ $? -ne 0 ] && exit 1
cp $CK_WEB_XML $CK_WEB_XML_TMP
# Use the admin key on the connector web.xml # Use the admin key on the connector web.xml
if [ ! -z $API_KEY ] ; then 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 else
exit 1 exit 1
fi fi
# Use the ckan key on the connector web.xml # Use the ckan key on the connector web.xml
if [ ! -z $CKAN_KEY ] ; then 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 else
exit 1 exit 1
fi fi
{% endraw %}
chown {{ smartgears_user }}:{{ smartgears_user }} $CK_WEB_XML mv $CK_WEB_XML_TMP $CK_WEB_XML_DEST
chmod 440 $CK_WEB_XML chown {{ smartgears_user }}:{{ smartgears_user }} $CK_WEB_XML_DEST
chmod 440 $CK_WEB_XML_DEST
rm -f $SQL_FILE rm -f $SQL_FILE
touch $CK_WEB_DIR/.web.xml.configured touch $CK_WEB_DIR/.web.xml.configured
{% endraw %}
exit 0 exit 0