Skip to content

Commit

Permalink
Merge pull request #1025
Browse files Browse the repository at this point in the history
dird: fix `llist jobs current` not displaying correct data
  • Loading branch information
pstorz committed Dec 16, 2021
2 parents 912b3e0 + c22d267 commit 99a6134
Show file tree
Hide file tree
Showing 12 changed files with 284 additions and 94 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
- webui: fix a layout corner case where top navbar is hiding navtabs [PR #1022]
- webui: client details now can be displayed for client names containing dots [PR #1023]
- dird: avoid crash in job listing when "current" and "count" are both specified at the same time [PR #1026]
- Fixed issue with `llist jobs last current enable` that would not display correct data [PR #1025]

### Added
- systemtests: make database credentials configurable [PR #950]
Expand Down Expand Up @@ -363,5 +364,6 @@ and since Bareos version 20 this project adheres to [Semantic Versioning](https:
[PR #1020]: https://github.com/bareos/bareos/pull/1020
[PR #1022]: https://github.com/bareos/bareos/pull/1022
[PR #1023]: https://github.com/bareos/bareos/pull/1023
[PR #1025]: https://github.com/bareos/bareos/pull/1025
[PR #1026]: https://github.com/bareos/bareos/pull/1026
[unreleased]: https://github.com/bareos/bareos/tree/master
4 changes: 2 additions & 2 deletions core/src/cats/dml/0006_list_jobs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client,
Job.StartTime,
CASE
WHEN endtime IS NOT NULL THEN endtime - starttime
ELSE CURRENT_TIMESTAMP(0) - starttime
WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime
ELSE CURRENT_TIMESTAMP(0) - Job.starttime
END as Duration,
Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus
FROM Job
Expand Down
6 changes: 3 additions & 3 deletions core/src/cats/dml/0007_list_jobs_long
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Level,
Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime,
Job.EndTime,
Job.EndTime,Job.RealEndtime,
CASE
WHEN endtime IS NOT NULL THEN endtime - starttime
ELSE CURRENT_TIMESTAMP(0) - starttime
WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime
ELSE CURRENT_TIMESTAMP(0) - Job.starttime
END as Duration,
Job.JobTDate, Job.VolSessionId, Job.VolSessionTime,
Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId,
Expand Down
4 changes: 2 additions & 2 deletions core/src/cats/dml/0009_list_jobs_last
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client,
Job.StartTime,
CASE
WHEN endtime IS NOT NULL THEN endtime - starttime
ELSE CURRENT_TIMESTAMP(0) - starttime
WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime
ELSE CURRENT_TIMESTAMP(0) - Job.starttime
END as Duration,
Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus
FROM Job
Expand Down
4 changes: 2 additions & 2 deletions core/src/cats/dml/0010_list_jobs_long_last
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Lev
Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime,
Job.EndTime, Job.RealEndTime,
CASE
WHEN endtime IS NOT NULL THEN endtime - starttime
ELSE CURRENT_TIMESTAMP(0) - starttime
WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime
ELSE CURRENT_TIMESTAMP(0) - Job.starttime
END as Duration,
Job.JobTDate, Job.VolSessionId, Job.VolSessionTime,
Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId,
Expand Down
18 changes: 9 additions & 9 deletions core/src/cats/mysql_queries.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const char *BareosDbMysql::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand All @@ -70,10 +70,10 @@ const char *BareosDbMysql::query_definitions[] = {
/* 0007_list_jobs_long */
"SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Level, "
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, "
"Job.EndTime,Job.RealEndtime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down Expand Up @@ -105,8 +105,8 @@ const char *BareosDbMysql::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand Down Expand Up @@ -135,8 +135,8 @@ const char *BareosDbMysql::query_definitions[] = {
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, Job.RealEndTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down
18 changes: 9 additions & 9 deletions core/src/cats/postgresql_queries.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const char *BareosDbPostgresql::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand All @@ -70,10 +70,10 @@ const char *BareosDbPostgresql::query_definitions[] = {
/* 0007_list_jobs_long */
"SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Level, "
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, "
"Job.EndTime,Job.RealEndtime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down Expand Up @@ -105,8 +105,8 @@ const char *BareosDbPostgresql::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand Down Expand Up @@ -135,8 +135,8 @@ const char *BareosDbPostgresql::query_definitions[] = {
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, Job.RealEndTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down
18 changes: 9 additions & 9 deletions core/src/cats/sqlite_queries.inc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ const char *BareosDbSqlite::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand All @@ -70,10 +70,10 @@ const char *BareosDbSqlite::query_definitions[] = {
/* 0007_list_jobs_long */
"SELECT DISTINCT Job.JobId, Job.Job, Job.Name, Job.PurgedFiles, Job.Type, Job.Level, "
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, "
"Job.EndTime,Job.RealEndtime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down Expand Up @@ -105,8 +105,8 @@ const char *BareosDbSqlite::query_definitions[] = {
"SELECT DISTINCT Job.JobId,Job.Name, Client.Name as Client, "
"Job.StartTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.Type,Job.Level,Job.JobFiles,Job.JobBytes,Job.JobStatus "
"FROM Job "
Expand Down Expand Up @@ -135,8 +135,8 @@ const char *BareosDbSqlite::query_definitions[] = {
"Job.ClientId, Client.Name as Client, Job.JobStatus, Job.SchedTime, Job.StartTime, "
"Job.EndTime, Job.RealEndTime, "
"CASE "
"WHEN endtime IS NOT NULL THEN endtime - starttime "
"ELSE CURRENT_TIMESTAMP(0) - starttime "
"WHEN Job.endtime IS NOT NULL THEN Job.endtime - Job.starttime "
"ELSE CURRENT_TIMESTAMP(0) - Job.starttime "
"END as Duration, "
"Job.JobTDate, Job.VolSessionId, Job.VolSessionTime, "
"Job.JobFiles, Job.JobBytes, Job.JobErrors, Job.JobMissingFiles, Job.PoolId, "
Expand Down
20 changes: 10 additions & 10 deletions core/src/dird/ua_output.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,13 @@ static bool DoListCmd(UaContext* ua, const char* cmd, e_list_type llist)
if (!count) { // count result is one column, no filtering
SetAclFilter(ua, 2, Job_ACL); /* JobName */
SetAclFilter(ua, 7, Client_ACL); /* ClientName */
SetAclFilter(ua, 21, Pool_ACL); /* PoolName */
SetAclFilter(ua, 24, FileSet_ACL); /* FilesetName */
SetAclFilter(ua, 22, Pool_ACL); /* PoolName */
SetAclFilter(ua, 25, FileSet_ACL); /* FilesetName */
if (current) {
SetResFilter(ua, 2, R_JOB); /* JobName */
SetResFilter(ua, 7, R_CLIENT); /* ClientName */
SetResFilter(ua, 21, R_POOL); /* PoolName */
SetResFilter(ua, 24, R_FILESET); /* FilesetName */
SetResFilter(ua, 22, R_POOL); /* PoolName */
SetResFilter(ua, 25, R_FILESET); /* FilesetName */
}
}
if (enabled) { SetEnabledFilter(ua, 2, R_JOB); /* JobName */ }
Expand Down Expand Up @@ -647,13 +647,13 @@ static bool DoListCmd(UaContext* ua, const char* cmd, e_list_type llist)
case VERT_LIST:
SetAclFilter(ua, 2, Job_ACL); /* JobName */
SetAclFilter(ua, 7, Client_ACL); /* ClientName */
SetAclFilter(ua, 21, Pool_ACL); /* PoolName */
SetAclFilter(ua, 24, FileSet_ACL); /* FilesetName */
SetAclFilter(ua, 22, Pool_ACL); /* PoolName */
SetAclFilter(ua, 25, FileSet_ACL); /* FilesetName */
if (current) {
SetResFilter(ua, 2, R_JOB); /* JobName */
SetResFilter(ua, 7, R_CLIENT); /* ClientName */
SetResFilter(ua, 21, R_POOL); /* PoolName */
SetResFilter(ua, 24, R_FILESET); /* FilesetName */
SetResFilter(ua, 22, R_POOL); /* PoolName */
SetResFilter(ua, 25, R_FILESET); /* FilesetName */
}
if (enabled) { SetEnabledFilter(ua, 2, R_JOB); /* JobName */ }
if (disabled) { SetDisabledFilter(ua, 2, R_JOB); /* JobName */ }
Expand Down Expand Up @@ -950,10 +950,10 @@ static bool DoListCmd(UaContext* ua, const char* cmd, e_list_type llist)
switch (llist) {
case VERT_LIST:
SetAclFilter(ua, 2, Job_ACL); /* JobName */
SetAclFilter(ua, 21, Pool_ACL); /* PoolName */
SetAclFilter(ua, 22, Pool_ACL); /* PoolName */
if (current) {
SetResFilter(ua, 2, R_JOB); /* JobName */
SetResFilter(ua, 21, R_POOL); /* PoolName */
SetResFilter(ua, 22, R_POOL); /* PoolName */
}
if (enabled) { SetEnabledFilter(ua, 2, R_JOB); /* JobName */ }
if (disabled) { SetDisabledFilter(ua, 2, R_JOB); /* JobName */ }
Expand Down
5 changes: 0 additions & 5 deletions systemtests/tests/bareos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,3 @@ set_tests_properties(
PROPERTIES FIXTURES_REQUIRED
"system:bareos:backup-job-fixture;system:bareos-fixture"
)
set_tests_properties(
system:bareos:simple-list-jobs
PROPERTIES FIXTURES_REQUIRED
"system:bareos:backup-job-fixture;system:bareos-fixture"
)
43 changes: 0 additions & 43 deletions systemtests/tests/bareos/testrunner-simple-list-jobs

This file was deleted.

0 comments on commit 99a6134

Please sign in to comment.