Mime type for static JSON options provider

478 views
Skip to first unread message

Anthony Shortland

unread,
Apr 4, 2011, 12:51:28 PM4/4/11
to rundeck...@googlegroups.com
I've noticed a problem when you setup static JSON file options provider using Apache:

[root@rundeck simpleapp]# pwd
/var/www/html/simpleapp
[root@rundeck simpleapp]# cat tomcat.json 

If you configure this file as an option provider via HTTP. e.g.:

<option name="tomcat" enforcedvalues="true" required="true" valuesUrl="http://localhost/simpleapp/tomcat.json" description="tomcat zip"/> 

... you get the following error in the UI and the Rundeck log:

getRemoteJSON error: URL http://localhost/simpleapp/simple.json : Unexpected content type received: text/plain; charset=UTF-8

Turns out that the default Apache install (on CentOS/Redhat at least) uses /etc/mime.types to set header information:

[root@rundeck simpleapp]# rpm -q --whatprovides /etc/mime.types
mailcap-2.1.23-1.fc6

... which includes no specific mapping for ".json" files.

I fixed the problem as follows:

[root@rundeck conf]# diff /etc/mime.types /etc/mime.types.orig 
12d11
< application/json                json

... and option processing works after Apache is restarted.

Is the Rundeck code just too picky with the HTTP content type, or is that strictly necessary? It would be a lot more convenient if Rundeck accepted text/plain type content so that we could avoid having to change the default Apache configuration?

Guess the JSON MIME type hasn't made it to the CentOS distribution.

Anthony.




Noah Campbell

unread,
Apr 4, 2011, 1:02:56 PM4/4/11
to rundeck...@googlegroups.com
What version of CentOS are you using?  

cat /etc/issues

-Noah

Anthony Shortland

unread,
Apr 4, 2011, 1:06:34 PM4/4/11
to rundeck...@googlegroups.com
The most recent:

[anthony@rundeck jobs]$ cat /etc/redhat-release 
CentOS release 5.5 (Final)
[anthony@rundeck jobs]$ uname -a
Linux rundeck 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

[anthony@rundeck jobs]$ rpm -qi httpd
Name        : httpd                        Relocations: (not relocatable)
Version     : 2.2.3                             Vendor: CentOS
Release     : 43.el5.centos.3               Build Date: Mon 30 Aug 2010 09:32:10 AM PDT
Install Date: Thu 10 Feb 2011 05:20:10 PM PST      Build Host: builder10.centos.org
Group       : System Environment/Daemons    Source RPM: httpd-2.2.3-43.el5.centos.3.src.rpm
Size        : 3457202                          License: Apache Software License
Signature   : DSA/SHA1, Mon 30 Aug 2010 09:57:21 AM PDT, Key ID a8a447dce8562897
URL         : http://httpd.apache.org/
Summary     : Apache HTTP Server
Description :
The Apache HTTP Server is a powerful, efficient, and extensible
web server.
[anthony@rundeck jobs]$ rpm -qi mailcap
Name        : mailcap                      Relocations: (not relocatable)
Version     : 2.1.23                            Vendor: CentOS
Release     : 1.fc6                         Build Date: Sat 06 Jan 2007 06:42:46 PM PST
Install Date: Tue 23 Nov 2010 10:11:39 AM PST      Build Host: builder6.centos.org
Group       : System Environment/Base       Source RPM: mailcap-2.1.23-1.fc6.src.rpm
Size        : 18295                            License: public domain
Signature   : DSA/SHA1, Tue 03 Apr 2007 05:24:54 PM PDT, Key ID a8a447dce8562897
Summary     : Associates helper applications with particular file types.
Description :
The mailcap file is used by the metamail program.  Metamail reads the
mailcap file to determine how it should display non-text or multimedia
material.  Basically, mailcap associates a particular type of file
with a particular program that a mail agent or other program can call
in order to handle the file.

Mailcap should be installed to allow certain programs to be able to
handle non-text files.

Anthony.

Noah Campbell

unread,
Apr 4, 2011, 1:10:00 PM4/4/11
to rundeck...@googlegroups.com
If the file is local to rundeck, you can use the file:/// protocol.  This is what we're doing on site, and probably why we didn't bump into it.  

Short term workaround would be to modify the mime.conf to include that file type.

-Noah

Anthony Shortland

unread,
Apr 4, 2011, 1:55:22 PM4/4/11
to rundeck...@googlegroups.com
Both of those approaches work. 

My point was whether Rundeck can be changed to be more flexible and forgiving in this regard in order to avoid the need to make this configuration change in the first place?

Anthony.
Reply all
Reply to author
Forward
0 new messages