diff options
| author | Stefan Lendl <s.lendl@proxmox.com> | 2024-04-05 15:18:02 +0200 |
|---|---|---|
| committer | Thomas Lamprecht <t.lamprecht@proxmox.com> | 2024-04-08 17:57:18 +0200 |
| commit | 11d2ac73ff43b5adf687d2df9efc535bb4140fc3 (patch) | |
| tree | 1d8e431a0db546351c6f9b027d8a0e7a749bb9d2 /src/PVE/API2 | |
| parent | 40f020660d5bd2eb7e3e6450cd8f26094a4ccfd3 (diff) | |
sdn: api: extract function that creates the sdn directory.
create_etc_interfaces_sdn_dir creates the /etc/pve/sdn directory.
This allows mocking in tests to prevent system fs access in tests
Signed-off-by: Stefan Lendl <s.lendl@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Stefan Hanreich <s.hanreich@proxmox.com>
Tested-by: Stefan Hanreich <s.hanreich@proxmox.com>
Diffstat (limited to 'src/PVE/API2')
| -rw-r--r-- | src/PVE/API2/Network/SDN/Zones.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/PVE/API2/Network/SDN/Zones.pm b/src/PVE/API2/Network/SDN/Zones.pm index b09c9ad..35e2f7f 100644 --- a/src/PVE/API2/Network/SDN/Zones.pm +++ b/src/PVE/API2/Network/SDN/Zones.pm @@ -186,6 +186,10 @@ __PACKAGE__->register_method ({ return &$api_sdn_zones_config($cfg, $param->{zone}); }}); +sub create_etc_interfaces_sdn_dir { + mkdir("/etc/pve/sdn"); +} + __PACKAGE__->register_method ({ name => 'create', protected => 1, @@ -207,7 +211,7 @@ __PACKAGE__->register_method ({ my $opts = $plugin->check_config($id, $param, 1, 1); PVE::Cluster::check_cfs_quorum(); - mkdir("/etc/pve/sdn"); + create_etc_interfaces_sdn_dir(); PVE::Network::SDN::lock_sdn_config(sub { my $zone_cfg = PVE::Network::SDN::Zones::config(); |
