Resource Attach displays cryptic HTML error when no revision is specified on CLI
rogpeppe opened this issue · comments
From @lazypower on July 26, 2016 20:47
I'm not entirely certian why this is the case, but the charm command seems to misbehave when the revision is not specified during charm attach
. It gives a bad gateway error, which seems like it should instead tell me that it wants the revision (As you cannot publish any revision of a charm requiring resources, without the resource.
I propose a change, that the charm command itself run a split on the entity we are attempting to attach resources, and if the last characters post split('-') are non numeric, that the charm not reach out over the wire, at all, and complain to the user they need to specify a revision.
The following output was captured during discovery of the behavior:
charles@Tennoki ~/projects/work/builds/certificate-authority/utils $ charm attach cs:~lazypower/certificate-authority cfssl=./cfssl
ERROR can't upload resource: cannot post resource: cannot unmarshal error response "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>502 Bad Gateway</title>\n</head><body>\n<h1>Bad Gateway</h1>\n<p>The proxy server received an invalid\r\nresponse from an upstream server.<br />\r\n</p>\n<hr>\n<address>Apache/2.4.7 (Ubuntu) Server at api.jujucharms.com Port 443</address>\n</body></html>\n": invalid character '<' looking for beginning of value
charles@Tennoki ~/projects/work/builds/certificate-authority/utils $ charm attach cs:~lazypower/certificate-authority cfssl=./cfssl
ERROR can't upload resource: cannot post resource: cannot unmarshal error response "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>502 Bad Gateway</title>\n</head><body>\n<h1>Bad Gateway</h1>\n<p>The proxy server received an invalid\r\nresponse from an upstream server.<br />\r\n</p>\n<hr>\n<address>Apache/2.4.7 (Ubuntu) Server at api.jujucharms.com Port 443</address>\n</body></html>\n": invalid character '<' looking for beginning of value
charles@Tennoki ~/projects/work/builds/certificate-authority/utils $ charm attach cs:~lazypower/certificate-authority-0 cfssl=./cfssl
uploaded revision 0 of cfssl% charles@Tennoki ~/projects/work/builds/certificate-authority/utils $ charm attach cs:~lazypower/certificate-authority-0 cfssljson=./cfssljson
uploaded revision 0 of cfssljson%
Copied from original issue: CanonicalLtd/charmstore-client#222
From @jrwren on November 14, 2016 19:47
This error message is related to an apache reverse proxy (mod_proxy_http) bug. https://bz.apache.org/bugzilla/show_bug.cgi?id=60330
I've submitted a patch to upstream https://bz.apache.org/bugzilla/attachment.cgi?id=34438&action=diff, but it make take some time to get it rolled out.