]> git.proxmox.com Git - proxmox-backup.git/log
proxmox-backup.git
3 years agoREST: extract and handle API tokens
Fabian Grünbichler [Wed, 7 Oct 2020 11:10:37 +0000 (13:10 +0200)]
REST: extract and handle API tokens

and refactor handling of headers in the REST server while we're at it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoreplace Userid with Authid
Fabian Grünbichler [Fri, 23 Oct 2020 11:33:21 +0000 (13:33 +0200)]
replace Userid with Authid

in most generic places. this is accompanied by a change in
RpcEnvironment to purposefully break existing call sites.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump proxmox dependency to 0.6.0 for api tokens and tfa
Wolfgang Bumiller [Thu, 29 Oct 2020 14:10:23 +0000 (15:10 +0100)]
bump proxmox dependency to 0.6.0 for api tokens and tfa

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoconfig: add token.shadow file
Fabian Grünbichler [Wed, 7 Oct 2020 11:09:13 +0000 (13:09 +0200)]
config: add token.shadow file

containing pairs of token ids and hashed secret values.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapi: add Authid as wrapper around Userid
Fabian Grünbichler [Fri, 23 Oct 2020 11:18:09 +0000 (13:18 +0200)]
api: add Authid as wrapper around Userid

with an optional Tokenname, appended with '!' as delimiter in the string
representation like for PVE.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agobump version to 0.9.3-1 v0.9.3
Thomas Lamprecht [Thu, 29 Oct 2020 13:58:21 +0000 (14:58 +0100)]
bump version to 0.9.3-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoGC: improve task logs
Thomas Lamprecht [Thu, 29 Oct 2020 13:45:32 +0000 (14:45 +0100)]
GC: improve task logs

Make it more clear that removed files are chunks (not indexes or
something like that, user cannot know that we do not touch them here)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoGC: fix logging leftover bad chunks
Thomas Lamprecht [Thu, 29 Oct 2020 13:40:26 +0000 (14:40 +0100)]
GC: fix logging leftover bad chunks

fixes commit b4fb2623355259528587a0ab87e3970e6bb73b40, which copied
over the "Removed bad files:" block, but only adapted the log text,
not the actual variable.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: fix sync/verify job removal prompt
Thomas Lamprecht [Thu, 29 Oct 2020 13:34:31 +0000 (14:34 +0100)]
ui: datastore: fix sync/verify job removal prompt

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: drop id field from verify/sync add window
Thomas Lamprecht [Thu, 29 Oct 2020 13:22:39 +0000 (14:22 +0100)]
ui: drop id field from verify/sync add window

the config is shared between multiple datastores with the ID as, well
the unique ID, but we only show those of a single datastore.

So if a user adds a new one with a fixed ID "12345" but a job with
that ID exists already on another store, they get a error about
duplicate IDs, but cannot relate as that duplicate job is not visible
(filtered away)

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoserver/worker_task: simplify task log writing
Dominik Csapak [Thu, 29 Oct 2020 09:50:13 +0000 (10:50 +0100)]
server/worker_task: simplify task log writing

instead of prerotating 1000 tasks
(which resulted in 2 writes each time an active worker was finished)
simply append finished tasks to the archive (which will be rotated)

page cache should be good enough so that we can get the task logs fast

since existing installations might have an 'index' file, we
still have to read tasks from there, but only if it exists

this simplifies the TaskListInfoIterator a good amount

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoworker task: remove debug print, faster modulo
Thomas Lamprecht [Thu, 29 Oct 2020 11:35:33 +0000 (12:35 +0100)]
worker task: remove debug print, faster modulo

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: datstore status: introduce proper structs and restore compatibility
Dominik Csapak [Thu, 29 Oct 2020 10:51:26 +0000 (11:51 +0100)]
api: datstore status: introduce proper structs and restore compatibility

by moving the properties of the storage status out again to the top
level object

also introduce proper structs for the types used, to get type-safety
and better documentation for the api calls

this changes the backup counts from an array of [groups,snapshots] to
an object/struct with { groups, snapshots } and include 'other' types
(though we do not have any at this moment)

this way it is better documented

this also adapts the ui code to cope with the api changes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agosend sync job status emails
Dietmar Maurer [Thu, 29 Oct 2020 11:07:46 +0000 (12:07 +0100)]
send sync job status emails

3 years agoschedule_datastore_sync_jobs: remove unneccessary clone()
Dietmar Maurer [Thu, 29 Oct 2020 10:27:35 +0000 (11:27 +0100)]
schedule_datastore_sync_jobs: remove unneccessary clone()

3 years agosend_job_status_mail: corectly escape html characters
Dietmar Maurer [Thu, 29 Oct 2020 10:22:08 +0000 (11:22 +0100)]
send_job_status_mail: corectly escape html characters

3 years agogarbage_collection: log deduplication factor
Dietmar Maurer [Thu, 29 Oct 2020 09:37:43 +0000 (10:37 +0100)]
garbage_collection: log deduplication factor

3 years agoui: datastore: use pointer cursor for edit notes
Thomas Lamprecht [Thu, 29 Oct 2020 09:45:37 +0000 (10:45 +0100)]
ui: datastore: use pointer cursor for edit notes

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agogarbage_collection: log bad chunks (still_bad value)
Dietmar Maurer [Thu, 29 Oct 2020 09:24:31 +0000 (10:24 +0100)]
garbage_collection: log bad chunks (still_bad value)

3 years agofix #2998: encode mtime as i64 instead of u64
Dominik Csapak [Thu, 22 Oct 2020 07:05:37 +0000 (09:05 +0200)]
fix #2998: encode mtime as i64 instead of u64

saves files mtime as i64 instead of u64 which enables backup of
files with negative mtime

the catalog_decode_i64 is compatible to encoded u64 values (if < 2^63)
but not reverse, so all "old" catalogs can be read with the new
decoder, but catalogs that contain negative mtimes will decode wrongly
on older clients

also remove the arbitrary maximum value of 2^63 - 1 for
encode_u64 (we just use up to 10 bytes now) and correctly
decode them and update the comments accordingly

adds also test for i64 encode/decode and for compatibility between
u64 encode and i64 decode

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoverify: directly pass manifest to filter function
Dietmar Maurer [Thu, 29 Oct 2020 06:59:19 +0000 (07:59 +0100)]
verify: directly pass manifest to filter function

In order to avoid loading the manifest twice during verify.

3 years agobump version to 0.9.2-2
Thomas Lamprecht [Wed, 28 Oct 2020 22:05:56 +0000 (23:05 +0100)]
bump version to 0.9.2-2

re-use the changelog as this was not released publicly and it's just
a small fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoclient: adapt to change datastroe status return schema
Thomas Lamprecht [Wed, 28 Oct 2020 21:59:39 +0000 (22:59 +0100)]
client: adapt to change datastroe status return schema

fixes commit 16f9f244cfc19f021afa193929f40441434f0349 which extended
the return schema of the status API but did not adapted the client
status command to that.

Simply define our own tiny return schema and use that.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agobump version to 0.9.2-1 v0.9.2
Thomas Lamprecht [Wed, 28 Oct 2020 20:27:15 +0000 (21:27 +0100)]
bump version to 0.9.2-1

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: socket: fix typo in comment
Thomas Lamprecht [Wed, 28 Oct 2020 20:26:11 +0000 (21:26 +0100)]
tools: socket: fix typo in comment

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: rework sync layout, make job ID optional
Thomas Lamprecht [Wed, 28 Oct 2020 20:25:30 +0000 (21:25 +0100)]
ui: datastore: rework sync layout, make job ID optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: rework verify layout, make job ID optional
Thomas Lamprecht [Wed, 28 Oct 2020 20:25:07 +0000 (21:25 +0100)]
ui: datastore: rework verify layout, make job ID optional

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore summary: indentation/whitespace error fix
Thomas Lamprecht [Wed, 28 Oct 2020 20:24:25 +0000 (21:24 +0100)]
ui: datastore summary: indentation/whitespace error fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools/logrotate: fix compression logic
Dominik Csapak [Wed, 28 Oct 2020 09:58:00 +0000 (10:58 +0100)]
tools/logrotate: fix compression logic

we never actually compressed any files, since we only looked at
the extension:
* if it was 'zst' (which was always true for newly rotated files), we
  would not compress it
* even if it was not 'zst', we compressed it inplace, never adding '.zst'
  (possibly compressing them multiple times as zstd)

now we add new rotated files simply as '.X' and add a 'target' to the
compress fn, where we rename it to (but now we have to unlink the source
path)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agod/control.in: bump versioned dependcy for proxmox-widget-toolkit
Thomas Lamprecht [Wed, 28 Oct 2020 17:49:09 +0000 (18:49 +0100)]
d/control.in: bump versioned dependcy for proxmox-widget-toolkit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: show comment, allow to edit notes
Thomas Lamprecht [Wed, 28 Oct 2020 17:25:47 +0000 (18:25 +0100)]
ui: datastore: show comment, allow to edit notes

the "comment" is the first line of the "notes" field from a manifest,
show it in the grid and allow editing the full notes.

Hack the click event listener a bit together for the right aligned
edit action button, but it works out well and is efficient (only one
event listener is much cheaper than per-buttons ones).

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: extend action tooltips with IDs
Thomas Lamprecht [Wed, 28 Oct 2020 17:24:29 +0000 (18:24 +0100)]
ui: datastore: extend action tooltips with IDs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: use simple V. for verify action button
Thomas Lamprecht [Wed, 28 Oct 2020 17:22:20 +0000 (18:22 +0100)]
ui: datastore: use simple V. for verify action button

Choosing a good icon is hard here, while the magnifying glass is
somewhat relatable, it reminds to much of a "Search" function, which
can be quite confusing here.

So use a simple "V.", even if it's probably also not to ideal..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodo_verification_job: fix "never-reverify" and refactor/comment
Thomas Lamprecht [Wed, 28 Oct 2020 14:33:04 +0000 (15:33 +0100)]
do_verification_job: fix "never-reverify" and refactor/comment

commit a4915dfc2bc7bef03354f97f5bbce9fe2df4e0d6 made a wrong fix, as
it did not observed that the last expressions was done under the
invariant that we had a last verification result, because if none
could be loaded we already returned true (include).

It thus broke the case for "never re-verify", which is important when
using multiple schedules, a more high frequent one for new,
unverified snapshots, and a low frequency to re-verify older snapshots,
e.g., monthly.

Fix this case again, rework the code to avoid this easy to oversee
invariant. Use a nested match to better express the implication of
each setting, and add some comments.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodocument verify job structs
Thomas Lamprecht [Wed, 28 Oct 2020 14:32:28 +0000 (15:32 +0100)]
document verify job structs

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agodo verification: always verify if manifest load fails
Thomas Lamprecht [Wed, 28 Oct 2020 12:56:49 +0000 (13:56 +0100)]
do verification: always verify if manifest load fails

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoverify: avoid generics and use &dyn Fn() for filter
Dietmar Maurer [Wed, 28 Oct 2020 12:19:21 +0000 (13:19 +0100)]
verify: avoid generics and use &dyn Fn() for filter

3 years agoverify: improve code reuse, fix filter function
Dietmar Maurer [Wed, 28 Oct 2020 11:58:15 +0000 (12:58 +0100)]
verify: improve code reuse, fix filter function

Try to reuse verify_all_backups(), because this function has better
logging and well defined snaphot order.

3 years agojobstate: fix doctest
Dietmar Maurer [Wed, 28 Oct 2020 09:52:16 +0000 (10:52 +0100)]
jobstate: fix doctest

3 years agofix compile warning
Dietmar Maurer [Wed, 28 Oct 2020 09:47:30 +0000 (10:47 +0100)]
fix compile warning

3 years agosend notification mails for GC and verify jobs
Dietmar Maurer [Tue, 27 Oct 2020 12:36:56 +0000 (13:36 +0100)]
send notification mails for GC and verify jobs

3 years agosrc/server/verify_job.rs: add missing file
Dietmar Maurer [Wed, 28 Oct 2020 06:58:07 +0000 (07:58 +0100)]
src/server/verify_job.rs: add missing file

3 years agomove jobstate to server
Dietmar Maurer [Wed, 28 Oct 2020 06:33:05 +0000 (07:33 +0100)]
move jobstate to server

3 years agoui: datastore summary: clarify that it's a deduplication factor
Thomas Lamprecht [Tue, 27 Oct 2020 16:43:43 +0000 (17:43 +0100)]
ui: datastore summary: clarify that it's a deduplication factor

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: used fixed-width icons for summary
Thomas Lamprecht [Tue, 27 Oct 2020 16:43:10 +0000 (17:43 +0100)]
ui: datastore: used fixed-width icons for summary

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: change GC/Prune title and buttons a bit
Thomas Lamprecht [Tue, 27 Oct 2020 16:42:29 +0000 (17:42 +0100)]
ui: datastore: change GC/Prune title and buttons a bit

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: datastore: add confirmation message to verify all
Thomas Lamprecht [Tue, 27 Oct 2020 16:41:55 +0000 (17:41 +0100)]
ui: datastore: add confirmation message to verify all

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: DataStorePanel: save active tab statefully
Dominik Csapak [Tue, 27 Oct 2020 15:20:11 +0000 (16:20 +0100)]
ui: DataStorePanel: save active tab statefully

so that the last selected tab for datastores will get selected
the next time any datastore is selected, even across browser
reloads

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: MainView/NavigationTree: improve tree selection handling
Dominik Csapak [Tue, 27 Oct 2020 15:20:10 +0000 (16:20 +0100)]
ui: MainView/NavigationTree: improve tree selection handling

this fixes some bugs related to selection handling in the treelist:
* datastores were not selected after a reload
* reloading when in a tabpanel on any tab but the first, would
  not select a treenode
* changing between datastores on any tab but the first would
  not select the same tab on the new datastore

fixed those by mostly rewriting the changePath handling for
datastores and tabpanels in general

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: NavigationTree: add 'Add Datastore' button below datastore list
Dominik Csapak [Tue, 27 Oct 2020 15:20:09 +0000 (16:20 +0100)]
ui: NavigationTree: add 'Add Datastore' button below datastore list

and make 'Datastore' unclickable

since we have all options and information on the relevant datastore panels,
we do not need a datastore config anymore (besides the creation,
which we add here)

this also fixes the sorted insertion and removal of new/old datastores

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: move sync/verify jobs to the datastores
Dominik Csapak [Tue, 27 Oct 2020 15:20:08 +0000 (16:20 +0100)]
ui: move sync/verify jobs to the datastores

add the datastore as parameter for the store, remove
the datastore selector for the edit windows and give the datastore
to it instead

also remove the autostart from the rstore, since we only want to start
it when we change to the relevant tab

and add icons for all other datastore tabs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: add DataStoreSummary and move Statistics into it
Dominik Csapak [Tue, 27 Oct 2020 15:20:07 +0000 (16:20 +0100)]
ui: add DataStoreSummary and move Statistics into it

this adds a 'Summary' panel to the datastores, similar to what we have
for PVE's nodes/guests/storages

contains an info panel with useful information, a comment field, and
the charts from the statistics panel (which can be deleted since it is
not necessary any more)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: add DataStorePruneAndGC panel and add it to datastore panel
Dominik Csapak [Tue, 27 Oct 2020 15:20:06 +0000 (16:20 +0100)]
ui: add DataStorePruneAndGC panel and add it to datastore panel

a simple objectgrid to display datastore gc/prune options
needs the prune inputpanel to be refactored in its own class

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoui: DataStoreContent: add 'Verify All' button
Dominik Csapak [Tue, 27 Oct 2020 15:20:05 +0000 (16:20 +0100)]
ui: DataStoreContent: add 'Verify All' button

to verify the complete datastore

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapi/{verify, syncjobs}: add optional datastore parameter
Dominik Csapak [Tue, 27 Oct 2020 15:20:04 +0000 (16:20 +0100)]
api/{verify, syncjobs}: add optional datastore parameter

to limit the lists to the given datastores

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoadmin/datastore: add more info to status call
Dominik Csapak [Fri, 23 Oct 2020 14:32:33 +0000 (16:32 +0200)]
admin/datastore: add more info to status call

add also the snapshot counts as well as the status of the last garbage
collection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobackup/datastore: save garbage collection status to disk
Dominik Csapak [Fri, 23 Oct 2020 14:32:32 +0000 (16:32 +0200)]
backup/datastore: save garbage collection status to disk

and load it again when opening it

this way we can persist the status of the last garbage collect across
daemon reloads and reboots

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agobackup/datastore: count still bad chunks for the status
Dominik Csapak [Fri, 23 Oct 2020 14:32:31 +0000 (16:32 +0200)]
backup/datastore: count still bad chunks for the status

we want to show the user that there are still bad chunks after a garbage
collection

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agoapt auth: add newline to the end
Thomas Lamprecht [Tue, 27 Oct 2020 12:38:12 +0000 (13:38 +0100)]
apt auth: add newline to the end

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agohack: workaround unused code warning until proxmox-api-macro bump
Thomas Lamprecht [Tue, 27 Oct 2020 16:41:20 +0000 (17:41 +0100)]
hack: workaround unused code warning until proxmox-api-macro bump

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: allow one to delete the description
Thomas Lamprecht [Tue, 27 Oct 2020 11:27:52 +0000 (12:27 +0100)]
ui: allow one to delete the description

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoui: code cleanup
Thomas Lamprecht [Tue, 27 Oct 2020 11:27:38 +0000 (12:27 +0100)]
ui: code cleanup

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: get_hardware_address: better error handling
Thomas Lamprecht [Tue, 27 Oct 2020 11:26:53 +0000 (12:26 +0100)]
tools: get_hardware_address: better error handling

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoimplement subscription handling and api
Thomas Lamprecht [Tue, 27 Oct 2020 11:25:59 +0000 (12:25 +0100)]
implement subscription handling and api

mostly modelled after PVE

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools: http: add simple general post method
Thomas Lamprecht [Tue, 27 Oct 2020 08:52:45 +0000 (09:52 +0100)]
tools: http: add simple general post method

This is intended for when the server needs to do requests on
arbitrary, non PBS, external HTTP resources.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: disks: cleanup use statement
Thomas Lamprecht [Tue, 27 Oct 2020 08:55:19 +0000 (09:55 +0100)]
api: disks: cleanup use statement

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agointroduction: fix title formatting
Dylan Whyte [Tue, 27 Oct 2020 11:07:53 +0000 (12:07 +0100)]
introduction: fix title formatting

fix title formatting to remove warning from build

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agoget_hardware_address: must be uppercased
Thomas Lamprecht [Mon, 26 Oct 2020 19:18:26 +0000 (20:18 +0100)]
get_hardware_address: must be uppercased

we're a bit strict here what we accept, rather than changing that
lets do it like PVE/PMG and uppercase.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapi: add world accessible ping dummy endpoint
Thomas Lamprecht [Fri, 2 Oct 2020 11:12:18 +0000 (13:12 +0200)]
api: add world accessible ping dummy endpoint

This is indented to be used for the PVE storage library, replacing
the missuse of the much more expensive status API call.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agoapt: improve error messages
Fabian Grünbichler [Thu, 22 Oct 2020 15:13:26 +0000 (17:13 +0200)]
apt: improve error messages

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
3 years agoapt: add /changelog API call similar to PVE
Stefan Reiter [Wed, 21 Oct 2020 09:41:16 +0000 (11:41 +0200)]
apt: add /changelog API call similar to PVE

For proxmox packages it works the same way as PVE, by retrieving the
changelog URL and issuing a HTTP GET to it, forwarding the output to the
client. As this is only supposed to be a workaround removed in the
future, a simple block_on is used to avoid async.

For debian packages we can simply call 'apt-get changelog' and forward
it's output.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agofix #2934: list to-be-installed packages in updates
Stefan Reiter [Wed, 21 Oct 2020 09:41:15 +0000 (11:41 +0200)]
fix #2934: list to-be-installed packages in updates

As always, libapt is mocking us with complexity, but we can get the
approximate result we want by retrieving dependencies of all
to-be-updated packages and then seeing if they are missing.

If they are, we assume they will be installed.

For this, query_detailed_info is extended to allow reading details for
non-installed packages, and this is also exposed in
list_installed_apt_packages via 'all_versions_for'. This is necessary so
we can retrieve changelogs for such packages.

Note that we cannot retrieve all that information all the time, as
querying details for packages that aren't installed takes a rather long
time.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: refactor package detail reading into function
Stefan Reiter [Wed, 21 Oct 2020 09:41:14 +0000 (11:41 +0200)]
apt: refactor package detail reading into function

No functional change intended.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: use 'apt-get changelog --print-uris' in get_changelog_url
Stefan Reiter [Wed, 21 Oct 2020 09:41:12 +0000 (11:41 +0200)]
apt: use 'apt-get changelog --print-uris' in get_changelog_url

Avoids custom hardcoded logic, but can only be used for debian packages
as of now. Adds a FIXME to switch over to use --print-uris only once our
package repos support that changelog format.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoapt: allow filter to select different package version
Stefan Reiter [Wed, 21 Oct 2020 09:41:10 +0000 (11:41 +0200)]
apt: allow filter to select different package version

To get package details for a specific version instead of only the
candidate.

Also cleanup filter function with extra struct instead of unnamed &str
parameters.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoupid: use systemd escape to decode/encode the worker_id
Dietmar Maurer [Thu, 22 Oct 2020 06:24:37 +0000 (08:24 +0200)]
upid: use systemd escape to decode/encode the worker_id

This way we can store values containing "/" and ":".

3 years agoadd tools::http for generic HTTP GET and move HttpsConnector there
Stefan Reiter [Wed, 21 Oct 2020 09:41:11 +0000 (11:41 +0200)]
add tools::http for generic HTTP GET and move HttpsConnector there

...to avoid having the tools:: module depend on api2.

The get_string function is based directly on hyper and thus relatively
simple, not supporting redirects for example.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
3 years agoui: verify config: eslint fix
Thomas Lamprecht [Wed, 21 Oct 2020 13:53:54 +0000 (15:53 +0200)]
ui: verify config: eslint fix

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
3 years agotools/zip: fix doc tests
Dominik Csapak [Wed, 21 Oct 2020 12:14:22 +0000 (14:14 +0200)]
tools/zip: fix doc tests

the doc code was not compiling and blocking cargo test

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 years agopostinst: correct invalid old datastore configs
Hannes Laimer [Tue, 20 Oct 2020 09:10:12 +0000 (11:10 +0200)]
postinst: correct invalid old datastore configs

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi proxy: remove old verification scheduling
Hannes Laimer [Tue, 20 Oct 2020 09:10:11 +0000 (11:10 +0200)]
api proxy: remove old verification scheduling

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add task descriptions for the different types of verification(job, snapshot,...
Hannes Laimer [Tue, 20 Oct 2020 09:10:10 +0000 (11:10 +0200)]
ui: add task descriptions for the different types of verification(job, snapshot, group, ds)

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add verification job edit window
Hannes Laimer [Tue, 20 Oct 2020 09:10:09 +0000 (11:10 +0200)]
ui: add verification job edit window

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoui: add verification job view
Hannes Laimer [Tue, 20 Oct 2020 09:10:08 +0000 (11:10 +0200)]
ui: add verification job view

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoset a different worker_type based on what is going to be verified(snapshot, group...
Hannes Laimer [Tue, 20 Oct 2020 09:10:07 +0000 (11:10 +0200)]
set a different worker_type based on what is going to be verified(snapshot, group, ds)

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoproxy: add scheduling for verification jobs
Hannes Laimer [Tue, 20 Oct 2020 09:10:06 +0000 (11:10 +0200)]
proxy: add scheduling for verification jobs

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi2: add verification admin endpoint and do_verification_job function
Hannes Laimer [Tue, 20 Oct 2020 09:10:05 +0000 (11:10 +0200)]
api2: add verification admin endpoint and do_verification_job function

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoapi2: add verification job config endpoint
Hannes Laimer [Tue, 20 Oct 2020 09:10:04 +0000 (11:10 +0200)]
api2: add verification job config endpoint

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agorename VERIFY_SCHEDULE_SCHEMA to VERIFICATION_SCHEDULE_SCHEMA
Hannes Laimer [Tue, 20 Oct 2020 09:10:03 +0000 (11:10 +0200)]
rename VERIFY_SCHEDULE_SCHEMA to VERIFICATION_SCHEDULE_SCHEMA

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
3 years agoadd test for escape_unit
Dietmar Maurer [Wed, 21 Oct 2020 09:30:49 +0000 (11:30 +0200)]
add test for escape_unit

3 years agosystemd::escape_unit - allow '.' and '_'
Dietmar Maurer [Wed, 21 Oct 2020 08:36:25 +0000 (10:36 +0200)]
systemd::escape_unit - allow '.' and '_'

3 years agopass params by ref to recurse_files
Wolfgang Bumiller [Wed, 21 Oct 2020 08:47:41 +0000 (10:47 +0200)]
pass params by ref to recurse_files

gets rid of the return value and moving around of the zip
and decoder data
avoids cloning the path prefix on every recursion

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agowhitespace fixup
Wolfgang Bumiller [Wed, 21 Oct 2020 08:45:44 +0000 (10:45 +0200)]
whitespace fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agoapi2/admin/datastore/pxar_file_download: download directory as zip
Dominik Csapak [Wed, 21 Oct 2020 07:29:08 +0000 (09:29 +0200)]
api2/admin/datastore/pxar_file_download: download directory as zip

by using the new ZipEncoder and recursively add files to it
the zip only contains directories, normal files and hardlinks (by simply
copying the content), no symlinks, etc.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agotools: add AsyncChannelWriter
Dominik Csapak [Wed, 21 Oct 2020 07:29:07 +0000 (09:29 +0200)]
tools: add AsyncChannelWriter

similar to StdChannelWriter, but implements AsyncWrite and sends
to a tokio::sync::mpsc::Sender

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agotools: add zip module
Dominik Csapak [Wed, 21 Oct 2020 07:29:06 +0000 (09:29 +0200)]
tools: add zip module

This modules contains the 'ZipEncoder' struct, which wraps an async writer,
to create a ZIP archive on the fly

To create a ZIP file, have a target that implements AsyncWrite,
give it to ZipEncoder::new, add entries via 'add_entry' and
at the end, call 'finish'

for now, this does not implement compression (uses ZIPs STORE mode), and
does not support empty directories or hardlinks (or any other special
files)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
3 years agofix for prevoius patch: we want to copy all valid tickets
Dietmar Maurer [Wed, 21 Oct 2020 06:40:04 +0000 (08:40 +0200)]
fix for prevoius patch: we want to copy all valid tickets

3 years agofix #3038: check user before renewing ticket
Dylan Whyte [Tue, 20 Oct 2020 09:29:16 +0000 (11:29 +0200)]
fix #3038: check user before renewing ticket

Fixes a bug in which the userid of the ticket cache is updated,
when a user connects, but the ticket itself is not.
This means a newly connected user has a previously connected
user's ticket and thus, cannot do anything, as the client will
attempt to use the invalid ticket.

e.g. if john@pbs connected to the server first, followed by
mike@pbs, the following would be stored in the ticket cache.

{
  "localhost": {
    "mike@pbs": {
      "ticket": "PBS:john@pbs:AAAA",
      "timestamp": 1601039326,
      "token": "BBBB"
    }
  }
}

Signed-off-by: Dylan Whyte <d.whyte@proxmox.com>
3 years agobackup: avoid Transport endpoint is not connected error
Dietmar Maurer [Tue, 20 Oct 2020 12:18:14 +0000 (14:18 +0200)]
backup: avoid Transport endpoint is not connected error

We simply supress the error message if the finish flag is set.

3 years agopaperkey: use svg as image format to provide better scalability
Dietmar Maurer [Tue, 20 Oct 2020 10:04:51 +0000 (12:04 +0200)]
paperkey: use svg as image format to provide better scalability