Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Lorenzo Martinico
slapos
Commits
0e789a1b
Commit
0e789a1b
authored
Dec 07, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check_url_available recipe support certificate and key for client authentication
parent
68aa5e7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
slapos/recipe/check_url_available/__init__.py
slapos/recipe/check_url_available/__init__.py
+3
-0
slapos/recipe/check_url_available/template/check_url.in
slapos/recipe/check_url_available/template/check_url.in
+19
-1
No files found.
slapos/recipe/check_url_available/__init__.py
View file @
0e789a1b
...
@@ -39,6 +39,9 @@ class Recipe(GenericBaseRecipe):
...
@@ -39,6 +39,9 @@ class Recipe(GenericBaseRecipe):
'curl_path'
:
self
.
options
[
'curl_path'
],
'curl_path'
:
self
.
options
[
'curl_path'
],
'check_secure'
:
self
.
options
.
get
(
'check-secure'
,
0
),
'check_secure'
:
self
.
options
.
get
(
'check-secure'
,
0
),
'http_code'
:
self
.
options
.
get
(
'http_code'
,
'200'
),
'http_code'
:
self
.
options
.
get
(
'http_code'
,
'200'
),
'ca-cert-file'
:
self
.
options
.
get
(
'ca-cert-file'
,
''
),
'cert-file'
:
self
.
options
.
get
(
'cert-file'
,
''
),
'key-file'
:
self
.
options
.
get
(
'key-file'
,
''
),
}
}
# XXX-Cedric in this script, curl won't check certificate
# XXX-Cedric in this script, curl won't check certificate
...
...
slapos/recipe/check_url_available/template/check_url.in
View file @
0e789a1b
...
@@ -3,13 +3,31 @@
...
@@ -3,13 +3,31 @@
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
URL="%(url)s"
URL="%(url)s"
F_TIMEOUT="%(time_out)s"
TIMEOUT=20
CA_CERT="%(ca-cert-file)s"
CERT="%(cert-file)s"
KEY="%(key-file)s"
if [ -z "$URL" ]; then
if [ -z "$URL" ]; then
echo "No URL specified." >&2
echo "No URL specified." >&2
exit 3
exit 3
fi
fi
CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} --max-time 10 -o /dev/null)
if [ -s "$F_TIMEOUT" ]; then
TIMEOUT=$(cat $F_TIMEOUT)
result=$(echo $TIMEOUT | grep -E ^[0-9]+$)
if [ -z $result ]; then
# Not an integer
TIMEOUT=20
fi
fi
if [ -z "$CA_CERT" ] || [ -z "$CERT" ] || [ -z "$KEY" ]; then
CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} --max-time $TIMEOUT -o /dev/null)
else
CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} --max-time $TIMEOUT -o /dev/null --cacert $CA_CERT --cert $CERT --key $KEY)
fi
if [ $? -eq 3 ]; then
if [ $? -eq 3 ]; then
echo "URL malformed: $URL." >&2
echo "URL malformed: $URL." >&2
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment