Am 02.03.22 um 15:28 schrieb Hannes Laimer: > Am 02.03.22 um 11:16 schrieb Fabian Ebner: >> Am 01.03.22 um 09:51 schrieb Hannes Laimer: >>> ... on destroy if 'purge' is selected >>> >>> Signed-off-by: Hannes Laimer <h.lai...@proxmox.com> >>> --- >>> src/PVE/API2/LXC.pm | 1 + >>> 1 file changed, 1 insertion(+) >>> >>> diff --git a/src/PVE/API2/LXC.pm b/src/PVE/API2/LXC.pm >>> index 84712f7..2e4146e 100644 >>> --- a/src/PVE/API2/LXC.pm >>> +++ b/src/PVE/API2/LXC.pm >>> @@ -758,6 +758,7 @@ __PACKAGE__->register_method({ >>> print "purging CT $vmid from related configurations..\n"; >>> PVE::ReplicationConfig::remove_vmid_jobs($vmid); >>> PVE::VZDump::Plugin::remove_vmid_from_backup_jobs($vmid); >>> + PVE::Jobs::Plugin::remove_vmid_from_jobs($vmid); >> >> Should add a >> use PVE::Jobs::Plugin; >> (or PVE::Jobs if the function is moved there) to the imports. > The reason I did not do that in the first place is that it is only used > once in the whole file and I felt like I would make an already quite > large import section even bigger. Should the previous two lines also use > use? Do we have some kind of policy for when and when not to use use?
If the module is not imported explicitly, it will only work if you're lucky and it's already imported (e.g. if C imports B and B imports A, then C can call functions from A). But then things are brittle: Imagine that at some point, B might not use anything from A anymore and so the import is dropped there. Then Perl still will compile fine, but suddenly the call in C is broken! Ideally, each module lists all the modules it uses explicitly. Unfortunately, Perl is very lax here (and everywhere :P). >> >> Same for the next patch. >> >>> if ($ha_managed) { >>> PVE::HA::Config::delete_service_from_config("ct:$vmid"); _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel