add more information about claiming failures (#19735)
Costa Tsaousis committed
Feb 28, 2025 at 13:39 UTC
337d603093d80ee4b54d22a88e6680a571abc19c
3 files changed
+13
-5
src/claim/claim-with-api.c
+11
-3
@@ -148,7 +148,7 @@ static int debug_callback(CURL *handle, curl_infotype type, char *data, size_t s
148
return 0;
149
}
150
151
-static bool send_curl_request(const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, int insecure, bool *can_retry) {
151
+static bool send_curl_request(const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, bool insecure, bool *can_retry) {
152
CURL *curl;
153
CURLcode res;
154
char target_url[2048];
@@ -270,8 +270,16 @@ static bool send_curl_request(const char *machine_guid, const char *hostname, co
270
// execute the request
271
res = curl_easy_perform(curl);
272
if (res != CURLE_OK) {
273
- claim_agent_failure_reason_set("Request failed with error: %s (proxy is set to '%s')",
274
- curl_easy_strerror(res), proxy);
273
+ claim_agent_failure_reason_set("Request failed with error: %s\n"
274
+ "proxy: '%s',\n"
275
+ "insecure: %s,\n"
276
+ "public key file: '%s',\n"
277
+ "trusted key file: '%s'",
278
+ curl_easy_strerror(res),
279
+ proxy,
280
+ insecure ? "true" : "false",
281
+ public_key_file ? public_key_file : "none",
282
+ trusted_key_file ? trusted_key_file : "none");
283
curl_easy_cleanup(curl);
284
curl_slist_free_all(headers);
285
*can_retry = true;
src/claim/claim.h
+1
-1
@@ -24,7 +24,7 @@ bool load_claiming_state(void);
24
void cloud_conf_load(int silent);
25
void cloud_conf_init_after_registry(void);
26
bool cloud_conf_save(void);
27
-bool cloud_conf_regenerate(const char *claimed_id_str, const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, int insecure);
27
+bool cloud_conf_regenerate(const char *claimed_id_str, const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, bool insecure);
28
CLOUD_STATUS claim_reload_and_wait_online(void);
29
30
const char *cloud_config_url_get(void);
src/claim/cloud-conf.c
+1
-1
@@ -102,7 +102,7 @@ bool cloud_conf_save(void) {
102
return true;
103
}
104
105
-bool cloud_conf_regenerate(const char *claimed_id_str, const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, int insecure) {
105
+bool cloud_conf_regenerate(const char *claimed_id_str, const char *machine_guid, const char *hostname, const char *token, const char *rooms, const char *url, const char *proxy, bool insecure) {
106
// for backwards compatibility (older agents), save the claimed_id to its file
107
claimed_id_save_to_file(claimed_id_str);
108