util.mount_cb only supports passing through a single (positional) argument to the wrapped function
This bug was originally filed in Launchpad as LP: #1884979
Launchpad details
affected_projects = [] assignee = None assignee_name = None date_closed = None date_created = 2020-06-24T14:45:54.248299+00:00 date_fix_committed = None date_fix_released = None id = 1884979 importance = undecided is_complete = False lp_url = https://bugs.launchpad.net/cloud-init/+bug/1884979 milestone = None owner = oddbloke owner_name = Dan Watkins private = False status = triaged submitter = oddbloke submitter_name = Dan Watkins tags = [] duplicates = []
Launchpad user Dan Watkins(oddbloke) wrote on 2020-06-24T14:45:54.248299+00:00
This makes it difficult to use with a function that needs to take more than a single positional parameter, or any keyword arguments; you have to partially apply the function before calling mount_cb.
I propose adding args and kwargs parameters, which will be passed to the callback function using *args and **kwargs. (For bonus points, refactor all current callsites to pass args so we can drop the data argument entirely.)
Launchpad user Dan Watkins(oddbloke) wrote on 2020-06-26T17:45:27.389475+00:00
I haven't started work on this specific feature, but I have started looking at writing tests for mount_cb's current behaviour as it is presently untested.
Launchpad user Dan Watkins(oddbloke) wrote on 2020-06-26T19:46:45.211155+00:00
That testing is now up at https://github.com/canonical/cloud-init/pull/463