elkarbackup icon indicating copy to clipboard operation
elkarbackup copied to clipboard

Error getting diskUsage on API

Open sakrow opened this issue 4 years ago • 0 comments

Describe the bug

When you request to API to get all jobs, the diskUsage value is null always. We are using the Docker lastest tag image: latest

Steps to reproduce the behavior

  1. Create a client
  2. Create a job
  3. Run job
  4. Request to an API to get all jobs (http://elkarbackupserver.com/api/jobs.json)

Example response:

[
    {
        "backupLocation": 1,
        "client": 1,
        "description": null,
        "diskUsage": 0,
        "exclude": "*/cache\r\n*/dbcache",
        "id": 1,
        "include": null,
        "isActive": true,
        "minNotificationLevel": 400,
        "name": "var-www",
        "notificationsEmail": null,
        "notificationsTo": [
            "owner"
        ],
        "path": "/var/www/",
        "policy": 1,
        "postScripts": [],
        "preScripts": [],
        "token": null,
        "useLocalPermissions": true
    },
    {
        "backupLocation": 1,
        "client": 1,
        "description": "example",
        "diskUsage": 0,
        "exclude": null,
        "id": 2,
        "include": null,
        "isActive": true,
        "minNotificationLevel": 400,
        "name": "etc",
        "notificationsEmail": null,
        "notificationsTo": [
            "owner"
        ],
        "path": "/etc",
        "policy": 1,
        "postScripts": [],
        "preScripts": [],
        "token": null,
        "useLocalPermissions": true
    }
]

But in database the job has diskUsage:

mysql> select id, client_id, name, path, diskUsage from elkarbackup.Job;
+----+-----------+---------+-----------+-----------+
| id | client_id | name    | path      | diskUsage |
+----+-----------+---------+-----------+-----------+
|  1 |         1 | var-www | /var/www/ |  19250984 |
|  2 |         1 | etc     | /etc      |     38984 |
+----+-----------+---------+-----------+-----------+
2 rows in set (0,00 sec)

The other data that we checked is updating well

sakrow avatar Sep 10 '21 09:09 sakrow