Open chri2 opened 1 month ago
about https://github.com/YunoHost/yunohost/pull/547 - 2 seconds sleep - just in case
I'll take this out of the sub for the following reasons:
ynh_systemd_action
@frju365 @maniackcrudelis @Josue-T - please evaluate whether the original problem can be fixed by using the above mentioned ynh_systemd_action
and checking some logfile for nginx becoming available with the service that is called by ynh_local_curl
.
# Curl abstraction to help with POST requests to local pages (such as installation forms)
#
# usage: ynh_local_curl "page" "key1=value1" "key2=value2" ...
# | arg: -l --line-match: check answer for a regex to return true
# | arg: -P --put: PUT instead of POST, requires --data (see below)
# | arg: -H --header: add a header to the request (can be used multiple times)
# | arg: -n --no_wait: don't wait 2 seconds *eg*
# | arg: -d --data: data to be posted if not provided as optional "key=value" pairs.
# | arg: page - either the PAGE part in 'https://$domain/$path/PAGE' or an URL like 'http://doma.in/path/file.ext'
# | arg: key1=value1 - (Optional, POST only) POST key and corresponding value
# | arg: key2=value2 - (Optional, POST only) Another POST key and corresponding value
# | arg: ... - (Optional, POST only) More POST keys and values
#
# example: ynh_local_curl "/install.php?installButton" "foo=$var1" "bar=$var2"
# → will open a POST request to "https://$domain/$path/install.php?installButton" posting "foo=$var1" and "bar=$var2"
# example: ynh_local_curl -P --header "Accept: application/json" -H "Content-Type: application/json" \
# --data "{\"members\":{\"names\": [\"${app}\"],\"roles\": [\"editor\"]}}" -l '"ok":true' \
# "http://localhost:5984/"
# → will open a POST request to "http://localhost:5984/" adding headers with "Accept: application/json"
# and "Content-Type: application/json" sending the data from the "--data" argument. ynh_local_curl will
# return with an error if the servers response does not match the extended regex '"ok":true'.
#
# For multiple calls, cookies are persisted between each call for the same app.
#
# `$domain` and `$path_url` need to be defined externally if the first form for the 'page' argument is used.
Another idea could be: leave the old command alone and introduce two new ones like ynh_local_put
and ynh_local_post
?
matrix, selfhoster1312:
ChriChri, why introduce different commands when curl has simple -X/--request flag for this? it makes the docs longer to read :P (also it should be
ynh_local_curl_put
and notynh_local_put
because there are other things than the web out there)
option to add headers: https://github.com/YunoHost/issues/issues/1696 improvement of return code and option to check for a string in the answer of the call: https://codeberg.org/flohmarkt/flohmarkt_ynh/issues/51#issuecomment-1833652
Follow work here:
https://codeberg.org/flohmarkt/flohmarkt_ynh/src/branch/testing/scripts/_common.sh#L52