diff options
author | Emmanuel Vasilakis <mrzammler@mm.st> | 2022-04-07 19:53:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-07 19:53:38 +0300 |
commit | 2d293e2f87874e19d7ee30ae794521a46c459304 (patch) | |
tree | f39a92662549d7de3f221c47098e68f6593df937 /web | |
parent | 005d817ea88b8f982405b642d5213a67794afde0 (diff) |
Don't do fatal on error writing the health api management key. (#12623)
* dont fatal on error writing the management key
* make message more descriptive
Diffstat (limited to 'web')
-rw-r--r-- | web/api/web_api_v1.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index 3369ab6812..26700d8fec 100644 --- a/web/api/web_api_v1.c +++ b/web/api/web_api_v1.c @@ -137,16 +137,25 @@ char *get_mgmt_api_key(void) { // save it fd = open(api_key_filename, O_WRONLY|O_CREAT|O_TRUNC, 444); - if(fd == -1) - fatal("Cannot create unique management API key file '%s'. Please fix this.", api_key_filename); + if(fd == -1) { + error("Cannot create unique management API key file '%s'. Please adjust config parameter 'netdata management api key file' to a proper path and file.", api_key_filename); + goto temp_key; + } - if(write(fd, guid, GUID_LEN) != GUID_LEN) - fatal("Cannot write the unique management API key file '%s'. Please fix this.", api_key_filename); + if(write(fd, guid, GUID_LEN) != GUID_LEN) { + error("Cannot write the unique management API key file '%s'. Please adjust config parameter 'netdata management api key file' to a proper path and file with enough space left.", api_key_filename); + close(fd); + goto temp_key; + } close(fd); } return guid; + +temp_key: + info("You can still continue to use the alarm management API using the authorization token %s during this Netdata session only.", guid); + return guid; } void web_client_api_v1_management_init(void) { |