Commit c1ecf017 authored by Kirill Smelkov's avatar Kirill Smelkov

check-url: Quote $URL in -z check

If one wants to check URLs on UNIX-sockets, there is no full URL schema
in curl for this, but the following has to be used instead:

    curl --unix-socket /path/to/socket http:/<url-path>

For this to work, one can do e.g. the following trick:

    [promise-unicorn]
    recipe  = slapos.cookbook:check_url_available
    url     = --unix-socket ${unicorn:socket}  http:/

but then generated promise scripts fails this way:

    ./etc/promise/unicorn: line 7: [: too many arguments

via quoting $URL in emptiness check we can support both usual URLs and
urls with --unix-socket prepended trick.

/reviewed-by @cedric.leninivin  (on nexedi/slapos!31)
parent 35024175
......@@ -4,7 +4,7 @@
URL="%(url)s"
if [ -z $URL ]; then
if [ -z "$URL" ]; then
echo "No URL specified." >&2
exit 3
fi
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment