Skip to content

Commit

Permalink
API: drop netplan_generate
Browse files Browse the repository at this point in the history
It's not properly implemented and unused.
  • Loading branch information
slyon committed Jan 24, 2024
1 parent 5d960a8 commit f6af1be
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
3 changes: 0 additions & 3 deletions include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
NETPLAN_PUBLIC gboolean
netplan_delete_connection(const char* id, const char* rootdir);

NETPLAN_PUBLIC gboolean
netplan_generate(const char* rootdir);

/**
* @brief Extract the <a href="/structure-id/#device-configuration-ids">Netplan ID</a> from the filepath of a NetworkManager keyfile.
* @details Copies a `NUL`-terminated string into a sized @p out_buffer. If the
Expand Down
14 changes: 0 additions & 14 deletions src/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,20 +571,6 @@ netplan_delete_connection(const char* id, const char* rootdir)
return ret;
}

gboolean
netplan_generate(const char* rootdir)
{
/* TODO: refactor logic to actually be inside the library instead of spawning another process */
const gchar *argv[] = { SBINDIR "/" "netplan", "generate", NULL , NULL, NULL };
if (rootdir) {
argv[2] = "--root-dir";
argv[3] = rootdir;
}
if (getenv("TEST_NETPLAN_CMD") != 0)
argv[0] = getenv("TEST_NETPLAN_CMD");
return g_spawn_sync(NULL, (gchar**)argv, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
}

/**
* Extract the netplan netdef ID from a NetworkManager connection profile (keyfile),
* generated by netplan. Used by the NetworkManager YAML backend.
Expand Down
9 changes: 0 additions & 9 deletions tests/test_libnetplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

from generator.base import TestBase
from parser.base import capture_stderr
from tests.test_utils import MockCmd

from utils import state_from_yaml
from netplan_cli.cli.commands.set import FALLBACK_FILENAME
Expand Down Expand Up @@ -63,14 +62,6 @@ def test_parse_keyfile_missing(self):
parser.load_keyfile(f)
self.assertIn('No such file or directory', str(ctx.exception))

def test_generate(self):
self.mock_netplan_cmd = MockCmd("netplan")
os.environ["TEST_NETPLAN_CMD"] = self.mock_netplan_cmd.path
self.assertTrue(lib.netplan_generate(self.workdir.name.encode()))
self.assertEqual(self.mock_netplan_cmd.calls(), [
["netplan", "generate", "--root-dir", self.workdir.name],
])

def test_delete_connection(self):
os.environ["TEST_NETPLAN_CMD"] = exe_cli
orig = os.path.join(self.confdir, 'some-filename.yaml')
Expand Down

0 comments on commit f6af1be

Please sign in to comment.