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
Alain Takoudjou
slapos
Commits
a9fbc474
Commit
a9fbc474
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
f4e47b9e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-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
+8
-1
No files found.
slapos/recipe/check_url_available/__init__.py
View file @
a9fbc474
...
@@ -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 @
a9fbc474
...
@@ -3,13 +3,20 @@
...
@@ -3,13 +3,20 @@
# BEWARE: It will be overwritten automatically
# BEWARE: It will be overwritten automatically
URL="%(url)s"
URL="%(url)s"
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 [ -z "$CA_CERT" ] || [ -z "$CERT" ] || [ -z "$KEY" ]; then
CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} --max-time 10 -o /dev/null)
else
CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} --max-time 10 -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